mirror of
https://github.com/PfandBoss/SemesterGameJam2022.git
synced 2025-11-12 04:16:12 +01:00
players
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)
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user