Micro Bit Doodle Jump Micro Bit programming Please
Micro: Bit Doodle Jump
Micro: Bit programming Please remember if you are not in class you won’t be able to use the Micro: Bit classroom but you can do the same code on either: 1. https: //python. microbit. org/v/2. 0 2. Mu by downloading it here https: //codewith. mu/en/download
Starting the program • The beginning of this is pretty simple. Like with the previous coding we need to import the microbit and random modules.
Functions • We now need to create a function to check the values in our game are between and maximum value.
Variables • We need some variables which we can use in our coding, variables can store data which changes as the program goes on. We are also going to define some constants these are similar to variables but don’t change. Variables are lower case constants are upper case.
Background and list • We are now going to initialize the background and create a list which defines how the game changes on each level. • The levels list shows that the repeat will be 30 times on level 1, 25 on level 2…
Main loop • The main loop ensures the game will keep running until the break command is given. Here we are adding gravity and the button controls.
Main loop continues • We now makes sure doodle x and y coordinates are correct, show the platform, scale the doodle and increase the frame rate.
More main loop • We now need to scroll down, advance to the next level and create a new platform (watch the indent)
End of loop • We can now end the loop and then test it, I’ve repeated the top line so you can see the indent
- Slides: 10