Change touched and non-touched objects values

Get help using Construct 2

Post » Mon Oct 28, 2013 3:56 pm

I have 5 objects in a family called enemies.
I want that, when I touch one of them, their variable "isActive" changes to "1" and the non-touched objects "isActive" variable changes to "0".
Only one object can be active at the time.
I used on touched object to change the touched object, but how about the non-touched? I tried invert is touching object, but then it changes the touched object when I stop touching it too, not just the others.

How can I do that?skyhunter932013-10-28 16:12:52
B
35
S
4
G
5
Posts: 84
Reputation: 4,860

Post » Mon Oct 28, 2013 4:38 pm

This is a little clunky, but when you touch the sprite, you could save its UID, then use that to pick all objects NOT with that UID to set their variable to inactive.



I solved the "toggle active" issue in a way similar to this, only I used another instance variable to do the check for the not-being-touched objects in the family.Wertle2013-10-28 16:42:45
B
11
S
2
Posts: 87
Reputation: 1,112

Post » Mon Oct 28, 2013 8:16 pm

Thanks! That's exactly what I needed!
B
35
S
4
G
5
Posts: 84
Reputation: 4,860

Post » Sun Jan 25, 2015 5:15 pm

Wertle wrote:This is a little clunky, but when you touch the sprite, you could save its UID, then use that to pick all objects NOT with that UID to set their variable to inactive.



I solved the "toggle active" issue in a way similar to this, only I used another instance variable to do the check for the not-being-touched objects in the family.Wertle2013-10-28 16:42:45


thanks. helped alot
B
9
S
1
Posts: 18
Reputation: 568

Post » Sun Jan 25, 2015 6:36 pm

>@skyhunter93 , @PaulGhs , @Wertle

The possibly simplest way to achieve this:
You do not have the required permissions to view the files attached to this post.
B
8
S
3
Posts: 197
Reputation: 1,207


Return to How do I....?

Who is online

Users browsing this forum: LaurenceBedford and 5 guests