Detecting when sprites are touching?

Get help using Construct 2

Post » Mon Aug 28, 2017 6:10 pm

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?
B
12
S
5
G
2
Posts: 11
Reputation: 1,976

Post » Mon Aug 28, 2017 7:11 pm

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.
B
60
S
16
G
13
Posts: 826
Reputation: 17,925

Post » Mon Aug 28, 2017 7:38 pm

That works perfectly! Thank you!
B
12
S
5
G
2
Posts: 11
Reputation: 1,976


Return to How do I....?

Who is online

Users browsing this forum: facecrime and 10 guests