Hw to make a counter like "collect x/10" objects

  • Hi everybody

    I would like to make a counter for a collectable object.

    The counter displays the number of collectable object available at the launch of the level.

    Curently I have a counter wich display the number of objects collected.

    [quote:1i2oa6ga]It work like this :

    System-> every tick -> define text : Player.PlayerCoin & "/"

    Thanks for your help

  • Use CollectibleSprite.Count to get the number of all instances of this object on the layout.

    So you can create a variable TotalCollectibles and set it to CollectibleSprite.Count at start of the layout.

  • Hoo thanks Dop2000

    I'm looking for : CollectibleSprite.Count

    But I don't find it.

    Is it a behavior ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "CollectableSprite" is your sprite, I don't know how you named it in your project (could be "Coin" or something else).

    ".Count" is an expression, which return the number of sprite instances on your layout.

    Create a variable TotalCollectables.

    Add this event to your "On start of layout":

    Set TotalCollectables to CollectableSprite.count

    Then you can display TotalCollectables in that text:

    System-> every tick -> define text : Player.PlayerCoin & "/" & TotalCollectables

  • Ok, I finaly found it. ouf ^^

    It's in an expression for a variable instance in the various category.

    Thanks again it's nice of you to help me

  • haha lol our message crossed.

    Thanks again. I made exactly what's you wrote and it works perfectly

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