Rename Player to Unit
This commit is contained in:
@@ -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
|
||||
|
@@ -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")]
|
||||
|
Reference in New Issue
Block a user