Hello, idk what is causing this problem, but in this platform, when the player going up activate my "falling" state, but when goes down the player stay 1 pixel abode the collision shape of the platform.
Here's my code:
func state_fall(delta):
vel.y = vel.y + grav * delta
var dir = Input.get_action_strength("direita") - Input.get_action_strength("esquerda")
if abs(dir) > 0:
dir_sprite = sign(dir)
vel.x = speed * sign(dir)
else:
vel.x = 0
$anims.play(anim + str(dir_sprite))
vel = move_and_slide(vel, Vector2.UP)
if Input.is_action_just_pressed("mouse"):
init_attack()
if Input.is_action_just_pressed("jump") and jumps < 1:
jumps += 1
init_jump()
if is_on_floor():
jumps = 0
if abs(vel.x) > 0:
init_run()
else:
init_idle()
And here the image:
