Detecting when sprites are touching?

0 favourites
  • 3 posts
From the Asset Store
Surena Touch
$1.25 USD
50% off
A wrap from official Touch plugin to export touch/mouse input to other plugins.
  • I'm making an RPG and want to make it so that when the player's sprite is touching another sprite and presses a key (let's just say "A" for now) it opens a dialog box. For reference, this sort of thing can be seen in games like Legend of Zelda, Pokemon, Undertale, basically any RPG. I figured out how to program the second part, however I can't for the life of me figure out what to put in to make the sprite detect that it's touching another sprite. The closest thing I could figure out was collisions, and that's not what I want because you have to run into the person and be holding the A key to activate it. I want you to be able to stand still in front of them. Is there a value or command that I could use to detect when the sprites are touching, or at least how close they are?

  • What I did was use a trigger sprite in front what I wanted to interact with. So lets say there was a sign I wanted people to read. I would place the sign and then I would place a transparent sprite, in the location the player should be standing when they want to read the sign. I used to an event similar to this:

    If Player is overlapping TriggerSign06

    And Presses KeyboardButton A

    DisplayMessage()

    You would really only create one pop up window and then, based on which trigger was triggered, you'd send in a string of text.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That works perfectly! Thank you!

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