Change touched and non-touched objects values

0 favourites
  • 6 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • 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?

  • 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.

    <img src="http://storage.wertle.com/construct2/TogglePick.PNG" border="0" />

    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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks! That's exactly what I needed!

  • 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

  • @skyhunter93 , PaulGhs , Wertle

    The possibly simplest way to achieve this:

  • Old post, but am glad I found this. It is still relevant.

    I forgot about 'System - Pick all'

    It allowed me to remove a lot of extra events and variables.

    Thanks Wertle

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)