Thursday, 12 May 2016

BBC Micro:Bits Pong

BBC Micro:Bit Pong (A rudimentary version of the classic game)
Again, a project suggested by the children. This got a bit more complex as I went along but when creating it, I could stop off at points and witness my programming working. The issue with this one was that the end idea was needed, but I am sure the children can be led to this...


First off, create the Paddle and make it possible to move it left and right, using the A and B buttons.



Now we need to create the ball. There is no way to connect two paddles so I took the idea of a one player game, dropping the ball from the top and then it bouncing up and down.



This ball needs to then drop from the ceiling. After playing around with a couple of ideas, I decided that the best idea would be to have a variable to tell it to move down. This could then be adapted when I wanted the ball to move up again.

This allows the ball to drop from the ceiling and get to the bottom. I now needed to add an IF statement to allow it to bounce up if it hit the paddle.

And now to make it bounce back down again when it touches the top. At this point I should note that there is an 'IF touching edge' command. This is great if the ball is in the middle, not so much if it starts at the side.

The next step for me was to add the game element. I added the idea that IF the ball is on row Y=4 AND NOT touching the paddle, then it was game over.


I also added an 'Add to score' when I successfully rebounded the ball.



Finally, after much juggling of commands, I decided that the ball, when it reached the top, ideally needed to move along a little to make sure that it didn't always come back down in the same place...

One final touch that might be nice is that the longer the game runs, the shorter the break between movements of the ball becomes, thus making the game get harder and harder.

1 comment:

  1. Good program,but still need some fixing! Despite this version was older, I had fun generating this! Thank you

    ReplyDelete