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)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login