From 12bce947f6d81b4fb73ecc68756089ccad8e62d0 Mon Sep 17 00:00:00 2001 From: eggman20339 Date: Tue, 10 Sep 2024 15:24:43 -0400 Subject: [PATCH] added flipping of idle sprite anim and added flipping of actionable detector based on left or right facing --- Assets/Characters/Friendly/Tellik/tellick.gd | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Assets/Characters/Friendly/Tellik/tellick.gd b/Assets/Characters/Friendly/Tellik/tellick.gd index 8bd44dc..7abe39a 100644 --- a/Assets/Characters/Friendly/Tellik/tellick.gd +++ b/Assets/Characters/Friendly/Tellik/tellick.gd @@ -7,6 +7,8 @@ const MIN_JUMP_DURATION = 0.01 const GRAVITY = 980 const FALL_GRAVITY_MULTIPLIER = 2 +var isFacingRight: bool + var jump_timer = 0.0 var is_jumping = false @@ -36,6 +38,19 @@ func _physics_process(delta): # Handle horizontal movement var direction = Input.get_axis("move_left", "move_right") + + if direction < 0: + isFacingRight = false + elif direction > 0: + isFacingRight = true + + if isFacingRight: + $Marker2D.scale.x = 1 + $AnimatedSprite2D.scale.x = 1 * 0.2 + else: + $Marker2D.scale.x = -1 + $AnimatedSprite2D.scale.x = -1 * 0.2 + if direction: velocity.x = direction * SPEED else: