Shoot Em Up Kit
You’ve got a town to save and a dragon to shoot!
This here is the formula to get your own tabletop shooter arcade working in good form!
- Connect all the parts of the Shoot Em Up Kit
- Code the micro:bit to fly dragons, detect lasers and score your player!
Step 5 – The real challenge – calibration.
Calibrate your dragon to make sure it’s flying back and forth in the sky and not face flat into the ground repeatedly.
- With your servo firmly in place – code the micro:bit to turn your servo to 0 deg when button A is pressed, and to turn to 180 deg when button B is pressed.
- Place a servo arm onto the head of the servo after pressing button A and watch to see where it goes when you press button B. If the servo arm points too far down or to the side, adjust the arm and reduce the angle coded. (e.g. adjust 0 – 180 deg to 20 – 160 deg)
- Replace the servo arm with the dragon arm at the same angle and screw it down to secure it.
Step 6 – Calibration Part 2
On to the light sensor. We’ve got to capture the current light levels and when a laser passes over, the sensor will alert the micro:bit that the light levels has suddenly gone way up.
- Thread the light sensor through the hole under the pop-up and to the front of the box.
- Place the light sensor into the dragon’s mouth and tape it down to secure it.
- Code the micro:bit to detect the light level through the light sensor when a button is pressed.
Step 7 – Putting it all together.
Now we want to be able to stop the dragon when it gets hit and also score points!
- So we should combine the two pieces of code and use an IF logic block to check if we got hit.
- IF we get hit, then we change the icon on the micro:bit and pause for a while, before changing back to the default icon.
- ELSE (if we don’t detect and hits) then we allow the servo to move as per normal.
- For the impatient – find the whole code here!
- Also – add in more blocks so when the dragon gets hit it increases a score variable.
You’ve killed the dragon. Now what? Add extra mountains, make it more challenging. Or write your own story, and see what you can do with your magical micro:bit!
Let us know @tinkercademy on twitter, instagram or facebook what other cool stuff you come up with!