The finished game

Here’s the finished game code. Try it in the simulator but also give it a try on a physical micro:bit if you’ve got one handy – it’s much more fun.

If you’ve made it this far, going through all of the steps – well done!

If you’ve gone straight to the end to see the finished game – fair enough. But do play around with the code and come back here if you need an explanation of how any of it works.

 

 

Extend it with code

Complete the game!

So far, the game doesn’t get harder as you play for longer. You could do this by increasing the speed the pipes scroll across over time or by making the pipes closer together as you play for longer.

You could also experiment with adding sound effects. If you connect a speaker to pin 0 and GND, you can play simple music and sound effects. Have a look here for more info. I’ll hopefully post a tutorial on music and sound effects soon.

If you can get any of the above extensions working, or can think of a different / better way of doing any of the code, I’d love to hear from you. Leave a comment on this post with a link to your code on create.withcode.uk