# Falling Duck

Dodge obstacles and keep flapping in this remake the sensational mobile game of 2013.

## 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.

Tip: Add your flavor by changing the “start screen” and “set background-color” blocks. Generally, these blocks don’t matter in the grand scheme of things and are just aesthetics.

### 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

## Going Beyond

Now that you understand the basics, get used to the logic by changing the speed of the game or using other obstacle sprites. You can also view the JavaScript side to get an understanding of the advanced side. Bring out your inner artist by making your sprite a donut that avoids candy canes!

## Related Projects

### Chicken Run

Help the chicken find her eggs. Inspired by frogger game

### Particle Effects

Showing off the built in particle effect