MakeCode Games 103

Fly through the jungles, dodge missiles, and fly your team back to the base in Helicopter Ride! Learn the basics of hit detection and character movement and just how much it matters when you’re the one controlling how fast it goes!

The Code

Setup

In the Setup function, we set the animation for the flying helicopter, the POWs, the life total and the score. We will get a point for each POW we pick up and take back to the start of the game.

The Controller

For this game, the controller is pretty easy. Since all we need to do is move around with the controller that is already set up in the “On Start” function, we just want to make sure it is facing the right way when we turn left and right.

Collision

There will be a few things that collide in this game. When we overlap with a POW, we want to add it to the POWinhelicopter variable so when the player gets back to the beginning, we know how many they picked up. We will also check for collision with the missles that are firing and take away a life every time they collide.

Reset

Every time the player loses a life or when the game starts, we want to reset the POW positions and the helicopter. These functions take care of that by setting their animations and positions back to where they started/ the ResetGame function also takes care of everything to do with the helicopter

Running the Game

Time to put it all together! In this forever function, it will take care of the missiles firing in the air and where all the enemies are positioned. Here would be the easiest place to make the game harder by adding more enemies or by making the missiles shoot faster.

Click on the button below to get started with the program we just went through.

Start Playing!