Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | sihela |
when the AnimatedSprite move its only playing one frame.I Make all frames and make a looooooooong scripts but its only works one frame i recheck but it doesn’t so any solution?
this is a top down game
Here my script,
` extends KinematicBody2D
export (int) var speed = 200
var velocity = Vector2()
func get_input():
velocity = Vector2()
if Input.is_action_pressed(“ui_right”):
velocity.x += 1
$AnimatedSprite.play(“Runside”)
else:
$AnimatedSprite.play(“Idle”)
if Input.is_action_pressed(‘ui_left’):
velocity.x -= 1
$AnimatedSprite.play(“Runside”)
if Input.is_action_pressed(‘ui_down’):
velocity.y += 1
$AnimatedSprite.play(“rundown”)
if Input.is_action_pressed(‘ui_up’):
velocity.y -= 1
$AnimatedSprite.play(“Runup”)
velocity = velocity.normalized() * speed
func _physics_process(delta):
get_input()
velocity = move_and_slide(velocity)`
note:I am a total noob at scripting and making games pls help
Edit:sorry p7f i cannot see a button in tool but i see {} which make no sense
Would you share a project so i can check? Also, i recommend you that when you paset code here, you use the code sample format (there is a button in the toolbar when you write messages) So we can understand it.
p7f | 2020-06-30 12:53
when player press wasd it only works one frame that i made
Do you know how to share the project because this is my first time in Q&A also i cant upload any images really
sihela | 2020-06-30 18:02