logo hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    Code for emery chasing you

    Scheduled Pinned Locked Moved
    Help and Support
    2
    5
    230
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • SavageBuilderKidS
      SavageBuilderKid
      last edited by

      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?

      1 Reply Last reply Reply Quote 1
      • RobinsonXR
        RobinsonX
        last edited by

        Is your RPG top-down or side-view? They would have very different functionality. @SavageBuilderKid

        SavageBuilderKidS 1 Reply Last reply Reply Quote 0
        • SavageBuilderKidS
          SavageBuilderKid @RobinsonX
          last edited by

          @RobinsonX it is side view

          1 Reply Last reply Reply Quote 0
          • RobinsonXR
            RobinsonX
            last edited by

            @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!

            1 Reply Last reply Reply Quote 0
            • RobinsonXR
              RobinsonX
              last edited by

              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)

              1 Reply Last reply Reply Quote 0
              • First post
                Last post