Students will be able to know how object detection works by using conditional “IF…THEN” statements.
Dodge obstacles and keep flapping in this remake the sensational mobile game of 2013.
Start a new MakeCode Arcade program in MakeCode Arcade.
Breaking Down the Game
The Objective of the Game
The objective of the game is to guide our character safely through the obstacles while making it visually appealing and scoring the most points by avoiding the most obstacles. In the game, we will learn about physics, collision detection and the basics of making a fast and easy game in Arcade.
Creating the Duck
Let’s start by making our player character, the Duck. Our character needs to be able to jump to avoid the obstacles we set in the future too, so we will control it with any button for convenience. Of course, we will need to add an animation for it to jump and some effects so it’s more fun to look at. We can do all of this with the built-in functions Makecode offers.
Creating the Obstacle
Before we put the game together, we have to add obstacles for our duck to avoid. We don’t want to continually jump over the same block so we will add some randomness to it with the “gap” variable. When Gap is set to 1, we will make a gap that is higher up, for gap 2 it will b in the center and gap 3 on the bottom. The player will also get a point for every 1500milli seconds (1.5 seconds) that passes which is the same amount of time as it takes for obstacles to move. We will call the obstacle a projectile as it will be important to distinguish it from the player and have it move -45 pixels at a time.
To summarize, we have our duck jumping up with any button and the obstacles coming at it. The bird doesn’t move forward, it is more like an optical illusion. Now, we want to end the game if the bird goes off-screen or it hits the obstacles. Luckily the collision is pretty easy with the “Overlap” function but for our “Out of bounds” check we will use an “if statement” to see if the duck sprite is too far and lastly to set it “idle” if it is not moving. If any of these things happen, we will use the “Game Over” game state
Click on the button below to load up the project in Arcade that is already made for you.