fix: player movement
This commit is contained in:
@@ -59,6 +59,8 @@ func _ready():
|
||||
screen_size = get_viewport_rect().size
|
||||
|
||||
func _process(delta):
|
||||
if (moveState != MoveState.Dashing):
|
||||
updateMoveDirection();
|
||||
if (dashOnCooldown):
|
||||
dashCooldownTime += delta;
|
||||
if (dashCooldownTime >= dashCooldown):
|
||||
@@ -68,19 +70,16 @@ func _process(delta):
|
||||
if moveState == MoveState.Loading:
|
||||
null
|
||||
# Idk dude, thought it might be a fun effect when you take damage
|
||||
elif moveState != MoveState.Dashing:
|
||||
updateMoveDirection();
|
||||
velocity = moveDirection.normalize() * speed;
|
||||
|
||||
if velocity.x || velocity.y:
|
||||
moveState = MoveState.Moving;
|
||||
elif moveState != MoveState.Dashing:
|
||||
moveState = MoveState.Still;
|
||||
elif Input.is_action_pressed("dash") or actionState == MoveState.Dashing:
|
||||
if (moveState != MoveState.Dashing):
|
||||
updateMoveDirection();
|
||||
moveState = MoveState.Dashing;
|
||||
dash(delta);
|
||||
else:
|
||||
velocity = moveDirection.normalize() * speed;
|
||||
if velocity.x || velocity.y:
|
||||
moveState = MoveState.Moving;
|
||||
else:
|
||||
moveState = MoveState.Still;
|
||||
|
||||
|
||||
# Handle actionState
|
||||
if Input.is_action_pressed("deploy"):
|
||||
|
||||
Reference in New Issue
Block a user