Two Turtle Doves

A game in Meowbit of the theme "Two Turtle Doves", involving enemies, food and powerups.


YOU WILL NEED

  • Meowbit

Looking for parts to make this?


STEP 1

Go into the Block Editor at https://arcade.makecode.com and follow the code in the picture. The code shows what will happen when you first turn on the Meowbit. The screen will display the title “Two Turtle Doves”, and ask the player for the number of lives, maxing out at 5 lives.



STEP 2

The game screen will then be set up. Set up a background colour. Next, create two new variables “dove” and “turtle”. Choose the sprite (you can draw your own!) for the dove and turtle, setting dove to “Player” (to be controlled by the player), and turtle to “Food” (to be “eaten” by the dove). The dove will be controlled via buttons on the Meowbit, and its movements will be limited to the screen.



STEP 3

Now it’s time to add some enemies. Under the advanced tab, create a new function that we can call to add an enemy to the scene. We can name this enemy “damageTurtle”. Select (or draw) a new sprite for it and set the kind to “Enemy”. The enemy will be generated at a random pixel location. You can change the numbers to vary the range of places where a new enemy can spawn. The enemy will follow the dove and stay within the boundaries of the Meowbit screen.



STEP 4

Next we can start coding the interactions between the dove and the other sprites. For the turtle (“Food”), when the dove overlaps with (touches) it, the score will increase by 1 and the timer will reset to 10s. Another turtle will then spawn at a random location on the screen. However, once the score reaches 10, things get more challenging; enemies will start getting called in.



STEP 5

However, we will also be adding powerups. A random number will be generated from 0 to 4, and if that number is 0, a powerup will be generated (this means a 1-in-5 chance). The following code moves the powerup from its default region (all the way in the corner where you cannot reach it) to within the screen at a random location, as well as adds a continuous bobbing animation.



STEP 6

After that, add the interaction between the dove and the enemy. Whenever an enemy hits the dove, a new one will spawn at a random location and the number of lives will decrease by 1.



STEP 7

Next, add the interaction between the dove and the powerup. The powerup will move back to its default corner location, and the number of lives will increase by 1.



STEP 8

Finally, it’s time to play the game! Connect your Meowbit via USB cable and upload the code.


Made this activity? Good Job! Now spread the word. Share a photo of your creation on social media with #letsgethacking #TwoTurtleDoves