Bryn's Concentrated Clocks
This game is based on code written with Bryn during one of our lessons. Bryn took an example program from the page on the matrix - the one which does a slideshow of the built-in images. He removed all of the images except the ones that were clock hands. He adjusted the speed of the animation and ended up with a line that was spinning round in circles. Having played the other concentration game, he realised that you could make another version based on stopping the rotating line at when it is in the 12 o'clock position.
The line will spin around when the game starts. It can spin happily for as long as you want. You need to stop it when it reaches the 12 position. If you are successful, you get a point and the game speeds up a little.
I reordered the clock images and built upon the code we wrote in class. Here is a basic version of the game that you can adapt to suit your purposes.
from microbit import * clocks = [ Image.CLOCK1,Image.CLOCK2,Image.CLOCK3, Image.CLOCK4,Image.CLOCK5,Image.CLOCK6, Image.CLOCK7,Image.CLOCK8,Image.CLOCK9, Image.CLOCK10,Image.CLOCK11,Image.CLOCK12] counter = 0 start = 200 paws = start score = 0 while True: display.show(clocks[counter]) # extra help on the last tick if counter==11: sleep(paws/10) if button_a.was_pressed(): sleep(500) if counter==11: display.show(Image.HAPPY) score += 1 paws = paws - 10 paws = max(10, paws) sleep(500) else: display.show(Image.SAD) display.scroll(str(score)) sleep(500) score = 0 paws = start counter += 1 if counter>11: counter = 0 sleep(paws)
As you read through the program, you should be able to see which numbers and calculations you can change to alter the pace of the game. The variable paws is the key one for this.
- Start by getting the game play settings as you want them.
- Everyone seems to like using Play-Doh buttons for these games. Why should this one be any different?
- This game idea would also work by having the user have to wait for a number of cycles before stoppping the clock.
- Another variant of this game would be to have the user need to stop the clock in different positions. This could be a curious way of getting answers to questions in some sort of quiz-based affair.