mirror of
https://github.com/PfandBoss/SemesterGameJam2022.git
synced 2025-11-12 04:16:12 +01:00
Engine basic added
This commit is contained in:
10
Cannon.gd
10
Cannon.gd
@@ -3,6 +3,7 @@ extends Module
|
|||||||
class_name Cannon
|
class_name Cannon
|
||||||
|
|
||||||
enum STATE {INACTIVE, RELOADING, SHOOTING}
|
enum STATE {INACTIVE, RELOADING, SHOOTING}
|
||||||
|
|
||||||
#------------Methods-------------#
|
#------------Methods-------------#
|
||||||
func _ready():
|
func _ready():
|
||||||
var root = get_tree().root.get_child(0)
|
var root = get_tree().root.get_child(0)
|
||||||
@@ -22,8 +23,9 @@ func interact():
|
|||||||
return
|
return
|
||||||
|
|
||||||
func _on_signal_shooting():
|
func _on_signal_shooting():
|
||||||
if currentStashValue == 1:
|
if currentStashValue == 1 and currentState == STATE.INACTIVE:
|
||||||
currentState = STATE.SHOOTING
|
currentState = STATE.SHOOTING
|
||||||
#TODO: SHOOTING
|
#TODO: SHOOTING
|
||||||
currentState = STATE.INACTIVE
|
currentState = STATE.INACTIVE
|
||||||
pass
|
|
||||||
|
return
|
||||||
|
|||||||
32
Engine.gd
Normal file
32
Engine.gd
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
extends Module
|
||||||
|
class_name TrainEngine
|
||||||
|
|
||||||
|
|
||||||
|
enum STATE {RUNNING, DEAD}
|
||||||
|
|
||||||
|
#------------Methods-------------#
|
||||||
|
func _ready():
|
||||||
|
var root = get_tree().root.get_child(0)
|
||||||
|
maxStashValue = 100
|
||||||
|
currentStashValue = 100
|
||||||
|
currentState = STATE.RUNNING
|
||||||
|
#TODO: FINISH
|
||||||
|
func interact():
|
||||||
|
if currentState == STATE.RUNNING:
|
||||||
|
if currentStashValue < maxStashValue:
|
||||||
|
currentStashValue += 10
|
||||||
|
if currentStashValue > maxStashValue:
|
||||||
|
currentStashValue = maxStashValue
|
||||||
|
|
||||||
|
return
|
||||||
|
#TODO: Repair Train
|
||||||
|
currentState = STATE.RUNNING
|
||||||
|
|
||||||
|
if currentStashValue == 1 and currentState == STATE.INACTIVE:
|
||||||
|
currentState = STATE.SHOOTING
|
||||||
|
#TODO: SHOOTING
|
||||||
|
currentState = STATE.INACTIVE
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
@@ -18,10 +18,16 @@ _global_script_classes=[{
|
|||||||
"class": &"Module",
|
"class": &"Module",
|
||||||
"language": &"GDScript",
|
"language": &"GDScript",
|
||||||
"path": "res://Module.gd"
|
"path": "res://Module.gd"
|
||||||
|
}, {
|
||||||
|
"base": "Module",
|
||||||
|
"class": &"TrainEngine",
|
||||||
|
"language": &"GDScript",
|
||||||
|
"path": "res://Engine.gd"
|
||||||
}]
|
}]
|
||||||
_global_script_class_icons={
|
_global_script_class_icons={
|
||||||
"Cannon": "",
|
"Cannon": "",
|
||||||
"Module": ""
|
"Module": "",
|
||||||
|
"TrainEngine": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|||||||
Reference in New Issue
Block a user