Merge branch 'main' of github.com:PfandBoss/SemesterGameJam2022

This commit is contained in:
2022-12-10 12:21:55 +01:00
3 changed files with 18 additions and 8 deletions

View File

@@ -3,7 +3,8 @@ extends Module
class_name Cannon class_name Cannon
enum STATE {INACTIVE, RELOADING, SHOOTING} enum STATE {INACTIVE, RELOADING, SHOOTING}
enum AMMO {NORMAL, HEAVY, LIGHT}
var currentAmmo: AMMO
var CAN_ENGAGE = true var CAN_ENGAGE = true
var DAMAGE = 5 var DAMAGE = 5
@onready var train = get_parent() as Train @onready var train = get_parent() as Train
@@ -15,13 +16,13 @@ func _ready():
currentState = STATE.INACTIVE currentState = STATE.INACTIVE
#TODO: FINISH #TODO: FINISH
func interact(): func interact():
if currentState == STATE.INACTIVE: if currentState == STATE.INACTIVE:
#TODO: RELOADING #TODO: RELOADING
if currentStashValue < maxStashValue: if currentStashValue < maxStashValue:
currentState = STATE.RELOADING currentState = STATE.RELOADING
currentStashValue += 1 currentStashValue += 1
return return
return return
func shoot(): func shoot():

View File

@@ -3,6 +3,10 @@ class_name TrainEngine
enum STATE {RUNNING, DEAD} enum STATE {RUNNING, DEAD}
const maxSpeed = 6
const refuelRate = 0.5
@onready var train = get_parent() as Train
#------------Methods-------------# #------------Methods-------------#
func _ready(): func _ready():
@@ -13,13 +17,17 @@ func _ready():
#TODO: FINISH #TODO: FINISH
func interact(): func interact():
if currentState == STATE.RUNNING: if currentState == STATE.RUNNING:
if currentStashValue < maxStashValue: if (train.current_speed + refuelRate) <= maxSpeed:
currentStashValue += 10 train.current_speed += refuelRate
if currentStashValue > maxStashValue: if train.current_speed >= maxSpeed:
currentStashValue = maxStashValue train.current_speed = maxSpeed
return return
#TODO: Repair Train #TODO: Repair Train
currentState = STATE.RUNNING currentState = STATE.RUNNING
#
func _process(delta):
if not train.is_dead():
train.current_speed -= 0.1 * delta

View File

@@ -31,4 +31,5 @@ func _on_signal_shooting():
func is_dead(): func is_dead():
if current_speed <= 0: if current_speed <= 0:
game_over.emit() game_over.emit()
return true
return false