MakeCode Games 102

Why did the chicken cross the road? To get her eggs! Help the chicken get her eggs back while dodging traffic in this Frogger inspired game.

The Code

Startup

On startup, we will set all the different types of values like the 8 different car positions, the egg, and the chicken. We will also make the animation for the chicken to add some life to it.

Buttons

Pressed

When one of the directional buttons is pressed, this will start the hopping animation and move the chicken in the direction pressed. We will give the player feedback by making a sound when we do so.

Released

After the player takes the finger off the button, we want to chicken to stop. Here, we will also check if it is out of the limit and make it face down if it is too high up and face up when it is too far down.

Collision

In the game, the player has 3 lives. This first function will subtract a life and tell the player they lost a life. The second function is giving points to the player when they go over one of the eggs.

Adding Car Movement

Lastly, we don’t want the cars to be just sitting there but we want them to move across the screen! Here we set the cars movement speed and where they end up. For certain cars, we want it to take a while before they show up again like the RaceCar because it would be annoying for it to continuously zip across the screen as it just went off.

Going Beyond

Clicking on the button below will take you to the project we just went through. Try changing around the car speeds to make it easier or harder for someone to play!

Start Clucking!