0 votes

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 getinput():
velocity = Vector2()
if Input.is
velocity.x += 1
if Input.isactionpressed('uileft'):
velocity.x -= 1
if Input.is
velocity.y += 1
if Input.isactionpressed('ui_up'):
velocity.y -= 1
velocity = velocity.normalized() * speed

func physicsprocess(delta):
velocity = move

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

asked Jun 30 in Engine by sihela (17 points)
edited Jul 1 by sihela

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.

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

1 Answer

+1 vote
Best answer

you need to copy your code correctly as there is some typos that affect the code, however, i can see in your code that you initial velocity is Vector2() ,(and repeated 2 times in your script) , that means velocity.x = 0 and velocity.y = 0 , and the last line you need to check the correct variables, you are missing some.

I would recommend just to look the step by step 1st game of godot docs, the explain what just I mentioned but more clear.

good luck

answered Jul 1 by Jorge (198 points)
selected Jul 1 by sihela

it worked Thank you

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.