This tutorial is the continuation of “How to Make an Interactive Pixelated Game in 30 Minutes Without Coding“. This time, we are going to add sound effects, camera scrolling, a health counter, and more.
Firstly, you want to remove the solid wall we created so we can make the level longer. This time, experiment with adding additional types of blocks and making some objects (like flowers) non-solid. Don’t be afraid to expand the level horizontally.
Make sure you add a block that will negatively impact your player’s health like the spikes we have.
Adjusting Camera Component and Damage Blocks
Next, we’re going to open the behaviour workspace for our player. Add the camera block to the workspace from the components menu. Select the camera component and increase the right property until it includes the newly added components in your level then click ok.
Next, add a collision block from the triggers menu and change the type to the spikes. Add a number block, name it damage, and set the current value to -1.
Then, add another number block, name it health, and set the current value to 3. Next, to create the labels, we add two label blocks from GUI. Give one the value of 3 and the other the value of “Health”. Then connect the blocks as shown in the image below. (Don’t forget to organise your labels as we did in the previous tutorials).
Game Over Function
After that, we want the game to reset if the player’s life reaches 0. To do that we add a filter block from logic and math and change the properties to “less than” “1” and we add a restart game block from game flow and connect the blocks to the health block as shown below.
Music and Sound
Lastly, we’re going to add music and sounds. To do this add the once block in the triggers menu, then add the sound block from components. Complete the sound block by selecting background music from the music folder. Lastly, Connect out to play.
Lastly, add two more sound blocks. Connect once to the spikes collision block and the other to the coin collision block. Find a sound from the effects folder to represent the action. Then connect the hit of the collision block to the play of the sound block.
Congratulations you have taken your pixelated game to the next level! Here’s the link to our finished version! Feel free to mention me on Twitter so I can share your new and amazing game with the world!
Create your free account to unlock your custom reading experience.