Skip to content

Commit

Permalink
Merge pull request #51 from nezvers/melee_nested_projectile
Browse files Browse the repository at this point in the history
Update MoverTopDown2D.gd
  • Loading branch information
nezvers authored Sep 15, 2024
2 parents 3dc0e7a + 968ab52 commit d97c300
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scripts/actor/MoverTopDown2D.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ func _physics_process(delta:float)->void:
acceleration = delta * actor_stats_resource.acceleration
character_body.velocity = character_body.velocity.move_toward(target_velocity, acceleration)

if character_body.velocity.length_squared() > 0.01:
# Bug workaround
character_body.move_and_slide()
# Bug workaround
if character_body.velocity.length_squared() < 0.01:
return

var collided:bool = character_body.move_and_slide()
# Weird, this should happen with nove_and_slilde by it self
if collided:
character_body.velocity = Vector2.ZERO

## Adds an impulse to velocity, like a kickback
func add_impulse(impulse:Vector2)->void:
Expand Down

0 comments on commit d97c300

Please sign in to comment.