check_charge() #checks player charge for game over
var direction := Input.get_axis("left", "right")
set_state(direction)
velocity += get_gravity() * delta
if state == States.IDLE:
velocity.x = direction * SPEED
animatedSprite2d.play("idle")
elif state == States.WALKING:
animatedSprite2d.flip_h = (direction ==-1) #flips animation WHEN WALKING STATE
if direction:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
animatedSprite2d.play("walking")
elif state == States.WALL_SLIDING:
if direction != 0:
velocity.x = direction * SPEED
#ADD SLOWER GRAVITY
animatedSprite2d.play("wall_sliding")
elif state == States.JUMPING:
if rayCastLeft.is_colliding():
if rayCastLeft.collider == "Terrain":
velocity.y = JUMP_VELOCITY #JUMPING STATE
velocity.x = -direction * (SPEED)
elif rayCastRight.collider == "Terrain":
velocity.y = JUMP_VELOCITY #JUMPING STATE
velocity.x = -direction * (SPEED)
velocity.y = JUMP_VELOCITY #JUMPING STATE
elif state == States.FALLING:
pass#velocity += get_gravity() * delta #FALLING STATE
move_and_slide()```
#How to properly establish wait after a wall jump
4 messages · Page 1 of 1 (latest)
if is_on_wall_only():
state = States.WALL_SLIDING
print("state WALL SLIDING")
elif direction !=0:
state = States.WALKING
print("state WALKING")
else:
state = States.IDLE
print("state IDLE")
if Input.is_action_just_pressed("ui_accept"):
state = States.JUMPING
print("state JUMPING")```
You could use a Timer node, checking if it's running !is_stopped() starting after it the wall jump start()
Godot Engine documentation
Inherits: Node< Object A countdown timer. Description: The Timer node is a countdown timer and is the simplest way to handle time-based logic in the engine. When a timer reaches the end of its w...
Yeah that's the idea I'm currently trying to implement. Its awkward finding a space that doesn't disrupt actual movement though