How do I make an object visible when touching another object

Get help using Construct 2

Post » Wed Nov 30, 2016 3:51 pm

I have 2 objects... I want to make the one of them visible when they touch each other... Else invisible... Can someone help me??
B
14
S
1
Posts: 66
Reputation: 771

Post » Wed Nov 30, 2016 3:56 pm

mikelantzelo wrote:I have 2 objects... I want to make the one of them visible when they touch each other... Else invisible... Can someone help me??


Set them invisible.

then

'Object' -> On collision with 'Object' -> Set visible

Then you can use the invert

'Object' -> (inverted) On collision with 'Object' -> Set visible
B
21
S
9
G
8
Posts: 188
Reputation: 6,069

Post » Wed Nov 30, 2016 4:19 pm

inverted cannot be applied to (on collision) :-(
B
14
S
1
Posts: 66
Reputation: 771

Post » Wed Nov 30, 2016 4:31 pm

You can also use these conditions below or combined with a trigger event to make it work.

Image
B
54
S
23
G
12
Posts: 747
Reputation: 11,910

Post » Wed Nov 30, 2016 4:43 pm

the 2 objects are physics objects and cannot ovelapp each other...
B
14
S
1
Posts: 66
Reputation: 771

Post » Wed Nov 30, 2016 4:46 pm

Overlap them by an offset of a few pixels then. The smaller number the closer they have to be to overlap.

Image
B
54
S
23
G
12
Posts: 747
Reputation: 11,910

Post » Wed Nov 30, 2016 4:57 pm

I want Sprite 2 to be visible everytime it touches the ground. I include the .capx file

https://drive.google.com/file/d/0Byb2YP ... sp=sharing
B
14
S
1
Posts: 66
Reputation: 771

Post » Wed Nov 30, 2016 5:15 pm

But your ball bounces so it only overlaps the ground on 1 frame and then goes back up again. So sprite 2 is only visible 1 frame and then gone again :P Do you want the green arrow to show when the ball is going up and red arrow when going down instead?
B
54
S
23
G
12
Posts: 747
Reputation: 11,910

Post » Wed Nov 30, 2016 5:26 pm

Thank you for your help! i find a solution
sprite visible on collision
system wait 0.1 sec
sprite invisible
B
14
S
1
Posts: 66
Reputation: 771

Post » Wed Nov 30, 2016 5:33 pm

@mikelantzelo Ok, glad it worked. You can look at this capx to get an idea of how to make the code a bit smaller :) Good luck with the project.

https://drive.google.com/file/d/0B0vVdV ... sp=sharing
B
54
S
23
G
12
Posts: 747
Reputation: 11,910


Return to How do I....?

Who is online

Users browsing this forum: lukewasthefish and 15 guests