For Each + Trigger Once

0 favourites
  • 7 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • Hi guys

    I want to do the following:

    <img src="" border="0" />

    For each Sprite when instance variable aaa becomes 0, to add 1 to global variable zzz only once.

    Any thoughts how i should do it?

    Thanks in advance.

  • I think it will be ok if you remove the Trigger once condition. And put the add 1 to zzz as an action in the For each Sprite condition.

    I'm sure that will give you the result you're looking for.

  • The problem is i want to add 1 to zz only once. If i put it with For Each event it starts continuously adding.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Store the last value of aaa in another variable then you can check if aaa = 0 and last_aaa not = aaa, add 1 to zzz. At the end of the event sheet, set last_aaa to aaa.

  • Drop the for each, and change the instance variable back to its original state in the same event.

    +on your trigger, set instance variable to 1

    +instance variable =1, system add 1 to global variable, instance set variable back to 0

    If you need to keep the instance from changing again, add a condition for that.

    Here is a tut on how to use for each properly.

  • Add 1 to zzz

    Set aaa to -1

    Maby this will help... <img src="smileys/smiley17.gif" border="0" align="middle" />

  • Thanks for help guys. I thought it can be done only with For Each expression but it seems i was all wrong (not my first time :). Ill defenetly check the tutorial newt, thanks.

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