How do I a Target System?

  • I'm trying to create a target system. Pressing the A key, an icon appears on the monster and every time you press the F to punch action. The character must look in the direction of the target. Using behavior 4 direction.

    I tried this way did not work.

    Can someone help me?

  • Not sure if its the core of the problem, but I thought compare angles needed to have the low number first.

    ie is between 45 and 135 degrees.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • No, this is not the real problem. I've tried every way with this example showed.But it does not work, just turn to one side.

    I need to know if there's another way.

  • Well, you could use:

    enemy.X > player.X enemy is to the right of the player

    enemy.X < player.X enemy is to the left of the player

  • Thanks, i will try. *---*

  • My game has 8 Directions. This does not work, but thanks.

  • Up.

    Can anyone tell me a way to make the character turn to a place immediately and without help control the keyboard. I can continue the work. Please.

  • Up.

    Can anyone tell me a way to make the character turn to a place immediately and without help control the keyboard. I can continue the work. Please.

    If you are using a sprite for your targeting icon, you can use the action "set angle towards position" and then for the X and Y positions type in "TargetingIcon.x" and "TargetingIcon.y" where "TargetingIcon" is the name of your sprite.

  • When you use this code your player instead of looking to the south, north, east or west. It spins like being inside of a tractor wheel.

  • You're going to need to provide more details if you want help. Are you using the 8-direction behavior for the player? Have you got your targeting icon to work properly? Are you wanting to make your player face in the exact direction of the target, or just in one of 8 directions? Etc.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)