Code for emery chasing you
-
I am attempting to make a RPG game on HyperPad, but I’m stuck trying to get the characters to chase me, can anyone screenshot the code to do that, or can someone walk me through it?
-
Is your RPG top-down or side-view? They would have very different functionality. @SavageBuilderKid
-
@RobinsonX it is side view
-
@SavageBuilderKid You can have a timer in the enemy that would constantly trigger the following:
- Get the position of enemy and player
- If enemy's x position < player's x position:
Move right. (You can use set velocity, apply force, move by, etc. depends on what you are doing.)
- Otherwise, move left.
This is a very simple method to emulate an enemy chasing the player. Let me know if you need more!
-
If you wanted to, you can have the enemy jump. The code below would make the enemy jump if the player is at a higher position than itself.
- If enemy's y position > player's y position:
Jump (use the jump behavior)