Leo - bug fixes

This commit is contained in:
2022-12-11 06:14:57 +01:00
parent 275c6205e6
commit b5c78c1302
4 changed files with 16 additions and 11 deletions

View File

@@ -7,20 +7,25 @@ var minSpeed = 0.0
var deg
var rad
var player
@onready var root = self.get_parent()
#acceptable rotations range from -35 to +35 degrees
func _ready():
player = root.player_id
#get Game Node reference
while not root is Game:
root = root.get_parent()
func _process(_delta):
currentSpeed = root.p1_train.current_speed
if player == 1:
currentSpeed = root.p1_train.current_speed
else:
currentSpeed = root.p2_train.current_speed
deg = currentSpeed * (70.0/maxSpeed) - 35.0
rad = (deg * 3.14) / 180
self.get_node("Pfeil").rotation = rad
func _on_stats_player_1_resized():
print("resized")
pass # Replace with function body.

View File

@@ -1,10 +1,8 @@
extends Control
func _ready():
pass
func _process(delta):
var player_id = 1

View File

@@ -1,5 +1,7 @@
extends Control
var player_id = 2
func _ready():
var gui = self.get_node("Speedometer_player1")
for body in gui.get_children():

View File

@@ -37,7 +37,7 @@ func _ready():
p2_train.is_P1 = false
p1_train.hit.connect(_on_hit_player)
p2_train.hit.connect(_on_hit_player)
p1_train.current_speed = 20
p1_train.current_speed = 9
p2_train.current_speed = 6
func getMapSize(node, is_start):