Bailiú na Míreanna
This week we continued 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
Have a look at the code below and test it in the simulator