This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+2 votes

here is an example of unity3d game: link
i want 2d enemy jump like frog and follow the player

in Engine by (14 points)

1 Answer

0 votes

In this case, I guess it has a simple AI, which just decide, if the player is on the right or left side. So based on that, it just decides to jump to the left or to the right, nothing more.

Usually characters in this type of games are from type KinematicBody. So the easiest way to archieve this is to have a reference to the player and some logic in the process function, which does nothing more than decide, whether the player is to the left or to the right (as mentioned above) and then set the velocity of the body corresponding to the direction of the player.

Good Luck!

by (260 points)

but, what if there's a level in game that has a building with multiple floors? then sometimes it must not jump and just fall. what if i want AI not to jump but walk, and when it reach an wall, it jump?

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 Frequently asked questions and 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 [email protected] with your username.