Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
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.
Develop games in your browser. Powerful, performant & highly capable.
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.
It displays 1 because you don't do anything when it can't pick any. Add an Else, and set to 0.