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