0 votes

como seria el codigo para el movimiento de un enemigo ("KinematicBody2d")

in Engine by (91 points)

1 Answer

0 votes

The way I make the enemies move in my game is by using an animation player. I can try to walk you through using one.

1)Add the animation sprite to your scene.
2)There should be a button on there that says "Animation". Click that, click new, and then give the animation a name (name doesnt matter at all).
3)On right side of the little bars that appears, you should see an arrow (pointing to the right) thats says "A+". If you want the enemies to move when the scene starts, click that on.
4)You should also see a bar that says "Add Track". If you follow this bar to the very end of it you should see two arrows that go in a circle. Click this little button (so enemy movements loop)
5)Make the the little blue line on the "add track" is on 0
6)Nearby the two arrows that go in a circle you should the number "1". This little section is important because this can affect how fast and how many different ways your enemies can move. I recommend changing the "1" to "4" and test that out.

Lets start animating your enemies

7)With the little animation bar at the bottom of the screen still up, Click on the enemy that you want to move. Hover over to the inspector tab and find transform. Open that. Now before we animate the enemy, move the enemy to the place you want the enemy to start at. Under the transform tab, next to "position" you should see a little key. Click that key
8)After you click the key, click create.
9) Now move the blue line on the "track" created for the enemy (animation tab bar) and move it over to "2". Now move your enemy to the place you want your enemy to stop moving at. Now hit the key next to position again.

If you followed all of my steps, your enemy should be moving now

by (50 points)
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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.