What is coding?
Coding is our way of giving a computer program a set of instructions. Computer programs can include websites, games, apps or even how our computers and phones work.
Did you know?
We can code in lots of different languages. The key thing we need to remember is to make sure our code is laid out with really clear sequences of instructions so that the program understands what we want it to do. Before we code using a computer, let's see how important sequences, or the order of our instructions can be.
Try this out at home
What you will need: Pen/pencil, paper
This is called the "Birthday Algorithm". After completing the steps below using your pen/pencil and paper, the final result should be your birthday. Please note: the result will be the month followed by a decimal place and then the day.
- Start with the number 7
- Multiply by the month you were born (number 1-12)
- Subtract 1
- Multiply by 13
- Add 5
- Subtract 2
- Add the day you were born (number 1-31)
- Multiply by 11
- Subtract the day you were born (number 1-31)
- Subtract the month you were born (number 1-12)
- Divide by 5
- Add 22
- Divide by 200
- If your result is not a match of the month.day of your birthday, carefully re-read the instructions and check your answers at each step.
- If you got the month.day of your birthday, then change around one of the steps. Does the algorithm still work?
What have we learnt with the "Birthday Algorithm"?
Firstly, an 'algorithm' is just a formula that someone has developed that will work to give us the correct solution or output at the end. Secondly, it has to be followed in the correct sequence. Otherwise, it won’t work. The sequence is so important.
So, to build our game using sequences, we are going to use a coding language called MakeCode. With MakeCode, we will build out our instructions using blocks. However, if you have done some coding before this, you can toggle over to the programming language JavaScript.
These instructions will then control how our game develops lesson by lesson. So, if you are ready, watch Lesson One below. Game on!
So, now that you have learned about sequences, bugs, variables and coordinates, can you complete the home challenge before moving onto the next lesson. The DreamSpace team want you to attempt to complete the following with the game you have just created.
- Recreate all of your sprites to match your game idea
- Recreate your background
- Add blocks from the 'Info' category to make the game more engaging
- Make your food sprite move to a random position when it overlaps with the player (debug what was going wrong in our game above)
Download the PDF below for some Home Challenge support documents including a Pixel Art template to help you redesign your sprites!