summaryrefslogtreecommitdiffstats
path: root/scripts/DwarfNPC.gd
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/DwarfNPC.gd')
-rw-r--r--scripts/DwarfNPC.gd5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/DwarfNPC.gd b/scripts/DwarfNPC.gd
index 3cacc3c..b55fff2 100644
--- a/scripts/DwarfNPC.gd
+++ b/scripts/DwarfNPC.gd
@@ -15,7 +15,8 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
+ # Look at target node
var target_x: float = target_node.position[0]
var dx = target_x - self.position[0]
- var scale_val = -1 if dx < .0 else 1
- $Sprite.set_scale(Vector2(scale_val, 1))
+ var dir = -1 if dx < .0 else 1
+ $Sprite.set_scale(Vector2(dir, 1))