How do I fix this overlap issue?

Get help using Construct 2

Post » Fri Mar 10, 2017 5:51 pm

Hello,

I made this example: https://drive.google.com/open?id=0B15_8 ... XdUWmFwVFk

As you can see, if you drag the Blue sprite over the Green sprite on the left and then the one on the right both of them will change their opacity.
How can I fix it so only the last collided will change opacity?

Thanks :)
@coyowl

coyowl.com

Game studio with a portfolio of 3 Apple Featured games.
B
31
S
7
G
2
Posts: 111
Reputation: 2,412

Post » Fri Mar 10, 2017 9:37 pm

B
33
S
18
G
28
Posts: 2,470
Reputation: 20,904

Post » Fri Mar 10, 2017 9:42 pm

The easiest way would be to add a For Each Green sprite:

Blue sprite - DragDrop is dragging
- For Each Green Sprite
- - Blue sprite is overlapping Green sprite > set opacity to 10
- - Else set opacity to 100

This doesn't actually test for which one last collided, if blue sprite is over one Green one, it will go to 10%, if it is over both, they both will go to 10%

If you really want only one green sprite at 10% (and the "last collided"), even if the blue one is touching both, then you would have to use instance variables to keep tract of when the green sprite collided - so you can know which one was last.
B
94
S
33
G
20
Posts: 438
Reputation: 17,615

Post » Fri Mar 10, 2017 10:05 pm

Or use a boolean and simple pick logic as in my example.
B
33
S
18
G
28
Posts: 2,470
Reputation: 20,904

Post » Sun Mar 12, 2017 8:25 am

Thank you guys for the help! ;)
@coyowl

coyowl.com

Game studio with a portfolio of 3 Apple Featured games.
B
31
S
7
G
2
Posts: 111
Reputation: 2,412


Return to How do I....?

Who is online

Users browsing this forum: alextro, mikehive, Yahoo [Bot] and 9 guests