how to make 2d Platformer Jumping Enemy

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By uxeer

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

:bust_in_silhouette: Reply From: RenenerG

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!

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?

ProXFox | 2019-02-23 03:19