Do something for duration of collision...

Get help using Construct 2

Post » Fri Dec 13, 2013 9:08 pm

Say I wanted to change the opacity of a sprite (or whatever) for the duration that it was colliding with another sprite? I get that I can used the "On collision with" condition, but I don't see a "while colliding with" or "when collision ends" condition. I'm sure I'm missing some basic theory here.
B
4
Posts: 25
Reputation: 302

Post » Fri Dec 13, 2013 9:10 pm

What about 'Is Overlapping'?
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,386
Reputation: 58,454

Post » Fri Dec 13, 2013 9:20 pm

"Is overlapping" doesn't seem to do anything. Do collision volumes overlap? Isn't the point of collision to keep them from overlapping?
B
4
Posts: 25
Reputation: 302

Post » Fri Dec 13, 2013 9:33 pm

Very simplified version of what I'm seeing: capx
B
4
Posts: 25
Reputation: 302

Post » Sat Dec 14, 2013 6:36 am

when collision ends" condition:

add Event / overlapping / set opacity to ~~.

then right click the event / click on Invert .

is that what you are looking for ?



when an event is inverted you will see the red X in the event,

so that event means, when spy is not overlapping sunny, then set opacity to 100producermark112013-12-14 06:50:04
B
35
S
10
G
4
Posts: 250
Reputation: 7,938

Post » Sat Dec 14, 2013 9:54 pm

Ah, I didn't realize that "is not Is Overlapping" would trigger an event! And it doesn't need to be done on every tick?

Also, I fixed the sharing on that capx, so it should be downloadable now.moiremusic2013-12-14 22:06:05
B
4
Posts: 25
Reputation: 302

Post » Sat Dec 14, 2013 9:59 pm

@moiremusic It does not. All events that are not triggers (the green arrow) are checked every tick, so adding the every tick condition is meaningless. ^^
B
25
S
6
G
3
Posts: 197
Reputation: 3,355

Post » Sat Dec 14, 2013 10:58 pm

I just don't get it. I can't get this to work. Can someone check this? capx
B
4
Posts: 25
Reputation: 302

Post » Sun Dec 15, 2013 2:09 am

The player never overlaps the NPCs because they are solid. But a collision is a one off event so there's no such thing as 'while colliding'. You can however use 'overlapping at offset' to check if the player is (not) near an NPC.

overlapOffset.capx (r152)
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650

Post » Sun Dec 15, 2013 3:32 am

So each of these events is checking at a different point outside the player's collision volume for an overlap?
B
4
Posts: 25
Reputation: 302

Next

Return to How do I....?

Who is online

Users browsing this forum: David181, FacuLNF and 49 guests