Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Douglas Levita |
I’m still studying the godot scripts and I’m having a problem with the RayCast, I can’t make it turn in the x direction along with the character. This is my code, I know it’s very amateur, but I’m still new. can anybody help me?`
func get_input():
var left = Input.is_action_pressed(“esquerda”)
var right = Input.is_action_pressed(“direita”)
if left:
velocity.x -= run_speed
Sprite.flip_h = true
Vector2.RayCast2D(0, -1)
$AnimatedSprite.play("andando")
elif right:
velocity.x += run_speed
Sprite.flip_h = false
$AnimatedSprite.play("andando")
else:
$AnimatedSprite.play("parado")
if not is_on_floor():
$AnimatedSprite.play("pulando")
`