16.07.2015 Views

MicroBit-Quick-Start-Teacher-Guide

MicroBit-Quick-Start-Teacher-Guide

MicroBit-Quick-Start-Teacher-Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Quick</strong> <strong>Start</strong> <strong>Guide</strong> for <strong>Teacher</strong>s07Repeat steps 2−6 to create all the variables foryour game. You will need to create four variablesin total: score, x (to control the position of thebasket), obstacle x (to control the horizontalposition of the egg) and obstacle y (to controlthe vertical position of the egg.)PREVIEWOnce you have finished setting up each of thevariables, you should have something whichlooks like the following.Assign initial values to each of the global variablesAs with any programming language, when you declare your variables, you need to set themto a value. This value can be manipulated and changed later on.08Return to your main script. Click do nothingbelow the main function, then select the databutton from the keyboard.09Select the variable x to begin with. Remember:x controls the position of the basket.10To assign a value to the x variable, select theassignment button (:=) from the keyboard. Wewant the basket to sit in the centre of the bottomrow of the display, so type in 2. Click on the +button below the x variable to add lines for theother three variables.11Assign values to the remaining three variablesby following the steps above. We want the egg tostart falling from the top centre of the display atthe beginning of our program, so set obstacle xto 2 (middle) and obstacle y to 0 (top). Set thescore to 0 (because we haven’t scoredanything yet).22

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!