Skip to content

Commit

Permalink
Fix knockback
Browse files Browse the repository at this point in the history
  • Loading branch information
Molytho committed Apr 15, 2024
1 parent eaae256 commit 682701c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/scenes/enemies/enemy.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ bg_color = Color(1, 0, 0, 1)
collision_layer = 32
collision_mask = 16
script = ExtResource("1_4befo")
MOVEMENT_SPEED = 0.0

[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]

Expand Down
1 change: 1 addition & 0 deletions src/scenes/enemies/unicorn.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ size = Vector2(20, 17)

[node name="Unicorn" instance=ExtResource("1_0f2vi")]
script = ExtResource("2_68sav")
MOVEMENT_SPEED = 10.0

[node name="AnimatedSprite2D" parent="." index="0"]
position = Vector2(-4, 0)
Expand Down
2 changes: 2 additions & 0 deletions src/scripts/enemies/enemy.gd
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func _physics_process(delta: float):
# about to fall down
_flip_direction()

# This ensures that knockback is applied correctly
velocity.x = 0
do_physics(delta)
move_and_slide()

Expand Down

0 comments on commit 682701c

Please sign in to comment.