Bailiú na míreanna chríochnaigh

This week we finished building our Item collecting game

We set up our variables to manage different parts of our game, Comhaireamh ( count ), Mír ( item ), leibhéil ( level ) and index

We then imported out character and set it up to be controlled by the arrows keys on the keyboard

We then introduced a new concept, Functions. A function is a self contained piece of code that does a certain task

In our game we created the function Tosaigh to create a new level

Each new level has a new background colour, spawns 10 items plus what number level we are on to collect

So level 1 will have 11 items, level 2 has 12 items and so on

We then set each item to spawn in a random location within the game screen

For each level we also reset the comhaireamh to 0

The last part of our game sets up our main character to collect the items using the overlap block

Once all the items are collected, we trigger the function to start a new level

Have a look at the code below and test it in the simulator

Next
Next

Bailiú na Míreanna