Kingdom Hearts-Esque Targeting?

0 favourites
  • 3 posts
From the Asset Store
Perfect for Strategy, Tower Defence, or any game that requires epic, powerful music.
  • I am completely stumped. All I want is to be able to use a targeting system like unto Kingdom Hearts, where the game automatically picks the nearest target (provided that they are in a predetermined range) so that when the attack command is selected the player sprite will "dash" to coordinates adjacent to the targeted enemy and perform an attack. This is what I have tried so far.

    I have created an ATKRadius circle object. I test for whether the ATKRadius object is overlapping any of the objects in the Enemies family. If it's true, then I want the player to move to and attack the nearest enemy. My event looks like this.

    Although in debug mode I can tell that it does select the nearest instance, when I call the moveto command, it will always send me to the Enemy whose UID is lower. No matter where I am on the map.

    I thought I could be clever and have a turret do this work for me, selecting nearest opponents and what not, but doggone it there is no way (as far as I can tell) to return the coordinates for the target the turret acquired. (For that matter, I can't get C2 to return anything about the target, despite documentation that an expression for TargetUID exists.)

    How should I do this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In the second event on keyboard s pressed (don't crop out the event numbers in the future), you don't pick any Enemies object. So you don't specify a target to move to, even though you saved the correct UID in the overlap event (no sub event needed here by the way).

    In the conditions, add an Enemies - pick by UID PlayerBox1.ATKTargetX and it should work.

  • I am exceedingly grateful! I was so close! I will remember not to crop out the numbers next time either.

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