Want to add an item to your game so players can collect it and get score? Or maybe you would like to give players something to pick up in your game. Either way, you can do this by following the steps below.
https://wiki.hypehype.com/how_to/collect-apples.mp4
- Open the Asset Library and look for collectable. Add the Score: Collectable Gem.
- Now add a player to collect the gems. Search for Platformer Player and add that.
- Playtest. Run towards the gem and pick it up!
Now you have added a collectable gem that works perfectly. You can add more gems to your game by opening the Build menu in the ToolBar. Tap the gem and then tap on the scene where you want to place it. You can also drag them from the same menu.
https://wiki.hypehype.com/how_to/collectable-gems.mp4
- Open the Asset library, search for Platformer Player, and add it to your scene.
- Now add the object you would like to collect. For this example, let's use pumpkins.
- Select the pumpkin, open the details panel, and go to advanced.
- Tap on the plus icon next to Object and add a Collision Trigger node. Make sure it triggers with the green group.
- Now add a Destroyer node to the pumpkin in the same way.
- Drag a link from Collision Trigger - On Collision Start to the pumpkin, and select Destroyer - Execute. This will make it so that when the player touches the pumpkin, it will disappear.
To add the logic in order to make it add score, you need to do the following:
- Add the following nodes:
- Number
- Broadcaster
- Drag a link from the Collision Trigger - On Collision Start to Number - Value, convert the link type, change the value to 1, and change Set to Add.
- Open the Number node and change Value to 0.0. This will make it so that the player starts with a score of 0.
- Drag a link from Number - Output to Broadcaster - Execute (with data).
- Now open the Broadcaster node, and tap on the Signal Out. It will open a new menu where we can add a new signal.
- Tap on the plus symbol to create a new signal, and name it "Add Score."
- Select the pumpkin, number, and broadcaster nodes. You will see the ToolBar has an option called Make Reusable (you might need to scroll a bit to the right). Tap it and name your reusable "Pumpkin."
Now you have created a reusable! This will allow you to add more copies of the pumpkin to the game, and each of them will add score to the player.
To actually add the score, do the following:
- Add the following nodes to the scene:
- Broadcast Listener
- Text
- Open the Broadcast Listener and tap on Listen To. Select the "Add Score" signal you created earlier.
- Drag a link from Broadcast Listener - On Signal Received to Text - Value. Convert the link type and change Set to Add.
- Now add more pumpkins to your scene by opening the Build Menu, and either tapping on the pumpking and then on the scene; or by dragging from the pumpking to the scene.
- Playtest. Now you should be able to run around collecting pumpkins and adding to your score!
http://wiki.hypehype.com/how_to/collect-pumpkins.mp4
- The gem you added as a premade is called a reusable. Copies of the reusable in your game are called instances.
- If you don't like the Gem, you can change it to something else, like an apple, for example. Simply tap on the gem in the details panel, and search for apple in the search that becomes available.
Pro Creator Tip: Make sure you create an enticing collectable! You want players to want to collect them. This can be done by making them spin or making them shiny, for example.
https://wiki.hypehype.com/how_to/shiny-pumpkins.mp4