mirror of
https://github.com/PfandBoss/SemesterGameJam2022.git
synced 2025-11-12 12:16:14 +01:00
Merge branch 'main' of https://github.com/PfandBoss/SemesterGameJam2022
This commit is contained in:
@@ -44,7 +44,14 @@ func _on_hit_player(player1,dmg):
|
||||
func _process(delta):
|
||||
p1_train.current_distance += p1_train.current_speed * delta
|
||||
p2_train.current_distance += p2_train.current_speed * delta
|
||||
p1_train.distance_from_start += p1_train.current_speed * delta
|
||||
p2_train.distance_from_start += p1_train.current_speed * delta
|
||||
|
||||
if(p1_node == StartNode && p1_train.distance_from_start > 5):
|
||||
p1_train.distance_from_start = 0
|
||||
if(p2_node == StartNode && p2_train.distance_from_start > 5):
|
||||
p2_train.distance_from_start = 0
|
||||
|
||||
if(p1_train.current_distance >= p1_node.LENGTH):
|
||||
var distance_delta = p1_train.current_distance - p1_node.LENGTH
|
||||
p1_node = p1_node._on_train_exit(p1_train)
|
||||
|
||||
9
scripts/Modules/Bin.gd
Normal file
9
scripts/Modules/Bin.gd
Normal file
@@ -0,0 +1,9 @@
|
||||
extends Module
|
||||
|
||||
class_name Bin
|
||||
|
||||
@onready var train = get_parent() as Train
|
||||
|
||||
#------------Methods-------------#
|
||||
func interact():
|
||||
train.get_node("CharacterBody3D").inventory = 0
|
||||
@@ -23,7 +23,6 @@ func interact():
|
||||
currentState = STATE.RELOADING
|
||||
currentStashValue += 1
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
func shoot():
|
||||
|
||||
@@ -3,6 +3,10 @@ class_name TrainEngine
|
||||
|
||||
|
||||
enum STATE {RUNNING, DEAD}
|
||||
const maxSpeed = 6
|
||||
const refuelRate = 0.5
|
||||
|
||||
@onready var train = get_parent() as Train
|
||||
|
||||
#------------Methods-------------#
|
||||
func _ready():
|
||||
@@ -13,13 +17,17 @@ func _ready():
|
||||
#TODO: FINISH
|
||||
func interact():
|
||||
if currentState == STATE.RUNNING:
|
||||
if currentStashValue < maxStashValue:
|
||||
currentStashValue += 10
|
||||
if currentStashValue > maxStashValue:
|
||||
currentStashValue = maxStashValue
|
||||
if (train.current_speed + refuelRate) <= maxSpeed:
|
||||
train.current_speed += refuelRate
|
||||
if train.current_speed >= maxSpeed:
|
||||
train.current_speed = maxSpeed
|
||||
return
|
||||
#TODO: Repair Train
|
||||
currentState = STATE.RUNNING
|
||||
|
||||
#
|
||||
func _process(delta):
|
||||
if not train.is_dead():
|
||||
train.current_speed -= 0.1 * delta
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
extends Node
|
||||
extends StaticBody3D
|
||||
|
||||
class_name Module
|
||||
#-----------Parameters----------------'
|
||||
|
||||
@@ -13,12 +13,23 @@ var is_alive = true
|
||||
#---------------Methods--------------#
|
||||
|
||||
func _physics_process(delta):
|
||||
if(velocity.length() > 0):
|
||||
$AnimatedSprite3D.play("walking")
|
||||
else:
|
||||
$AnimatedSprite3D.play("idle")
|
||||
|
||||
movement = Vector3(0,0,0)
|
||||
|
||||
check_interaction()
|
||||
check_input()
|
||||
velocity = movement * SPEED
|
||||
if velocity.x < 0:
|
||||
$AnimatedSprite3D.rotation.y = deg_to_rad(90)
|
||||
if velocity.x > 0:
|
||||
$AnimatedSprite3D.rotation.y = deg_to_rad(-90)
|
||||
if velocity.z > 0:
|
||||
$AnimatedSprite3D.rotation.y = deg_to_rad(-180)
|
||||
if velocity.z < 0:
|
||||
$AnimatedSprite3D.rotation.y = deg_to_rad(0)
|
||||
move_and_slide()
|
||||
|
||||
func check_input():
|
||||
|
||||
@@ -6,6 +6,7 @@ signal game_over
|
||||
|
||||
var is_P1 = true
|
||||
var current_distance = 0
|
||||
var distance_from_start = 0
|
||||
var current_speed = 5
|
||||
var CANNONS = []
|
||||
var STORAGES = []
|
||||
@@ -30,4 +31,5 @@ func _on_signal_shooting():
|
||||
func is_dead():
|
||||
if current_speed <= 0:
|
||||
game_over.emit()
|
||||
|
||||
return true
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user