How do I count each objects on the layout...

0 favourites
  • 7 posts
From the Asset Store
An educational game for counting pictures. An easy to use template for developers to build larger games
  • How do I count how many objects are appear in the layout?

    I also use an action to create 10 same sprite objects with different size.

    So how can I count objects with more condition like count number of object that only has width greater than 250pixels. (The other objects created with less than 250pixels don't count.)

  • Same sprites? use the pick all event. System, pick all.

    So if you had a sprite named box you create the even under system - pick all.

    Object (pick the box)

    expression would be self.width

    comparison > (greater than)

    value = 250

  • Same sprites? use the pick all event. System, pick all.

    So if you had a sprite named box you create the even under system - pick all.

    Object (pick the box)

    expression would be self.width

    comparison > (greater than)

    value = 250

    Thank you so much!! I have never known that it could be this simple to pick something with special property.

    By the way, is it a way to know how many objects we have picked?

    I'm struggling with having Text to show how many '250<obj' is on the screen. I've used trigger add+1 to global variable when true and -1 when destroyed but it was not functioning individually.

  • Create a variable to store the numbers (lets call it count)

    Then do a for event, for each sprite make the action add 1 to count

  • Life saving! "For each" does the trick.

    Thanks.

  • There is also mysprite.count that does that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is also mysprite.count that does that.

    Thanks for another the suggestion.

    I've changed to something like mysprite.PickedCount and it woks best for me.

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