In my game Vegetabomb blocks can either be veggies or bombs based on a random draw that assigns each of them an instance variable (<2 for a veggie and >=2 for a bomb). I would like to count the amount of bombs (blocks with a >=2 value) that are on the field currently and display it to the player.
There is a for each instance thing, it's a system loop. Make a variable and add 1 to it every time.
Use PickedCount property:
Sprite type="bomb" -> Text set text "Number of bombs: " & Sprite.PickedCount
Thanks! It works for the most part but when the amount of bombs is reduced to 0 it still displays a 1.
Develop games in your browser. Powerful, performant & highly capable.
It displays 1 because you don't do anything when it can't pick any. Add an Else, and set to 0.