By LadylexUK
Many action, platformer and RPG games have collection challenges. Sometimes the items you need to collect are part of a quest, to obtain an achievement, or resource gathering. In Project Spark it is pretty simple to set up. You can use the ready made coin for a collection quest or create your own object. You can place your objects in the game yourself (recommended if you want the items to be hidden a bit) or you can randomly spawn them across your map (see Making a fire by collecting wood).
In this example you are picking flowers.
In your flower:
- WHEN [detect][player] DO // make the detect area quite close to the flower so the player has to get on top of it to collect it
- …WHEN [started to] DO [it][flowers][increment by][1] // this counts the number of flowers collected
- …WHEN DO [destroy][me]
You will notice I have not used pick up or inventory. It is not necessary to do this with objects that you are not going to drop. For most collection quests the object is just collected, so adding to a variable is all you need to do. You can use that variable to level up a player when they collect a certain amount, or give them a special skill. The choices are endless.
You can then display that variable which is housed in the player brain.You can do this on a special menu screen or on screen at all times, something like this:
WHEN DO [display][text: Flowers ][numvar:flowers][+][text: /50][screen top center]