Created June 14th, 2014. Built on the Raspberry Pi.
We had a lot of fun building this one. Devon wanted a helicopter game, and I was interested in creating the animation effect of the rotor blades. He then started talking about firefighters and such and I figured we could combine the two and make a firefighter helicopter! Brilliant!
I’ll be showing the final code here, but most of the fun in building these games is starting with something simple and then adding bug fixes and features as you go. When I just started with Scratch, seeing a command stack this long would have freaked me out:
As I’ve built more games, I’ve realized how helpful it is to have a variable like “flying” or “playing” to control the whole loop. I’ve also tried to remove “magic” values by storing them in variables so they can easily be adjusted later.
I put those variables in the stage code like so:
This game has the helicopter always moving and the arrow just changes the direction and the costume. The changing costumes also creates the animation effect of the rotors. Devon and I discussed various ideas and he liked having to refuel so we created a refueling station.
The ways you can lose the game is to run out of fuel or to crash into the ground. You gain points by putting out fires with your water. It’s fun to use the “touching X” sensor to figure out if you’re touching a specific color or sprite. The background design of the stage can be helpful for creating specific colors and features you want your characters to respond to.
Next we’ll look at the fire:
For this I created a list of x and y coordinates for the places I want the fire to show up. We then pick a random number and use that entry in the list to display the fire.
And the water:
We start with location of the helicopter, drop the pen and let it flow! If it hits the ground or hits the fire, we hide it.
That’s basically it! Want to try it out? Here’s the Scratch file: Helicopter Game
Things we could improve: I noticed there’s little incentive to fly higher. It’s easier to put out the fires when you’re low to the ground. I was thinking we could make the water run out and require the helicopter to go up into the clouds to collect more water. Might be a fun addition.
What do you think?