Rename Player to Unit

This commit is contained in:
2024-02-26 13:06:12 -05:00
parent 75a720eb45
commit beabc319e5
6 changed files with 160 additions and 41 deletions

View File

@@ -14,7 +14,7 @@ func _init():
# Called when the node enters the scene tree for the first time.
func _ready():
homes = tiles.filter(is_home)
$Player.position = homes[0].position
$Unit.position = homes[0].position
next_home = homes[1].position
homes = [homes[0], homes[1], homes[3], homes[2]]
pass
@@ -25,8 +25,9 @@ func is_home(tile):
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if $Player.position != next_home:
$Player.position = $Player.position.move_toward(next_home, 4)
var move_speed = delta * 60.0
if $Unit.position != next_home:
$Unit.position = $Unit.position.move_toward(next_home, move_speed * 8)
else:
x += 1
next_home = homes[x % 4].position

View File

@@ -6,4 +6,4 @@
[node name="Field" type="Node2D"]
script = ExtResource("1_6uvjw")
[node name="Player" parent="." instance=ExtResource("2_oi7aa")]
[node name="Unit" parent="." instance=ExtResource("2_jhvjp")]