Check all instances of a Sprite with a condition??

0 favourites
  • 6 posts
From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • Hey

    How do I check all instances of a sprite with a condition? example..

    let's say I have 10 sprites and all of them have opacity 10, when all of them get opacity 100 then trigger an action.

    This seems very simple but for some reason I have no idea how to do that hahaha..

    I've tried using for each sprite+opacity=100 but didn't worked, also tried pick all sprites but no success too..

    I appreciate some help, thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Might try adding global, then do a for each on the sprite.

    for each sprite

    spite.opacity = 100 add 1 to global

    Then when global= 10....

  • Might try adding global, then do a for each on the sprite.

    for each sprite

    >spite.opacity = 100 add 1 to global

    Then when global= 10....yEA, That's a solution, is it possible to achieve that without any variables? That was what I was aiming for, but for now I really appreciate your help ;)

  • You can use a condition "Sprite: Compare opacity = 100" and then a "System: Compare two values" condition and check the system expression "PickedCount" for the sprite object (so "Sprite: Pickedcount") and makes sure it's equal to "Sprite.Count".

    <img src="https://dl.dropbox.com/u/36472942/construct/forumhelp/PickedCount.PNG" border="0" />

  • There's

    +Sprite: Opacity < 100 
      -> do nothing
    +Else
      -> do your thing 

    The idea is that, if at least one sprite has an opacity under 100 the else will never be triggered, because it's a logical else that doesnt mess with picking.

  • You can use a condition "Sprite: Compare opacity = 100" and then a "System: Compare two values" condition and check the system expression "PickedCount" for the sprite object (so "Sprite: Pickedcount") and makes sure it's equal to "Sprite.Count".

    <img src="https://dl.dropbox.com/u/36472942/construct/forumhelp/PickedCount.PNG" border="0" />

    Thanks I used this method, worked very well!

    also thanks for every1 else for their tips and solutions ;)

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