Commando Jump Game For The Micro:bit In Touch Develop
Written by Mike James   
Thursday, 18 February 2016
Article Index
Commando Jump Game For The Micro:bit In Touch Develop
Top Down Programming
Complete Listing

Ending the game

While the playGame function is complicated the end game handling can be as complicated as you like. You could add a scoreboard, a best score, a play again, etc.

For simplicity all we are going to do in the endGame function is to animate a final sequence depending on whether or not the commando got over the wall.

If the commando did get to the top of the wall within the time limit then an animation that moves the block horizontally and then down the "screen" is performed.

If it didn't make it, then the commando block simply falls back down. 

 

endgame

 

If man->y=0 then the commando is over the wall and we call an animation function to move the LED to the far left.   If the commando has or hasn't made it then the moveVertical function is used to drop the commando down from its current position to its final position.

The horizontal move is easy:

horz

 

All we need is a for loop that moves the sprite from 0,4 to 0,0. 

The vertical move is just as easy and either moves the sprite from 0,0 down to 0,4 or from wherever the sprite got to down to 4,4. Notice that this makes use of the fact that the sprite doesn't ever move beyond the LED display boundary. 

vert

The commando starts at x,position and moves down to x,4.

That's it - Game Over. 

You can now play commando jump on the BBC micro:bit. 

 

jump

 

What could you do next?

Add some sound as the commando struggles to get up the wall and falls back down or gets over. 

Alter the difficulty level if the player wins and start the game again. 

Complete Prrogram Listing

program

More Information

https://www.microbit.co.uk/

Related Articles

Micro:bit Commando Jump In The Microsoft Block Editor

BBC Micro:Bit Finally Ships to 1 Million For Free    

BBC micro:bit Your Next Computer?       

BBC Giving Away 1 Million Microcomputers       

Teach Code In School - Before It's Too Late! 

UK Micros of the 1980s 

Four Generations - Video of BBC Micro 

 

C book

 

Comments




or email your comment to: comments@i-programmer.info

 

 



Last Updated ( Saturday, 23 April 2016 )