top of page

Lady Bug Chase - App Inventor 2 - Advanced Tutorial

 

Games are among the most exciting mobile device apps, both to play and to create. The recent smash hit Angry Birds was downloaded 50 million times in its first  year and is played more than a million hours every day, according to Rovio, its developer. (There is even talk of making it into a feature film!)  Although we can’t guarantee that kind of success, we can help you create your own games with App Inventor, including this one involving a ladybug eating aphids while avoiding a frog.

 

What You’ll Build

 

In this “first-person chewer” game, the user will be represented by a ladybug, whose

movement will be controlled by the device’s tilt. This brings the user into the game in

a different way from MoleMash, in which the user was outside the device, reaching in.

 

The user can:

 

• Control a ladybug by tilting the device.

• View an energy-level bar on the screen, which decreases over time, leading to the ladybug’s starvation.

• Make the ladybug chase and eat aphids to gain energy and prevent starvation.

• Help the ladybug avoid a frog that wants to eat it.

 

What You’ll Learn

 

You should work through the MoleMash app before delving into this tutorial, because it assumes you know about procedure creation, random-number generation, the if-then-else block, and the ImageSprite, Canvas, Sound, and Clock components.

 

In addition to reviewing material from MoleMash and other previous chapters, this chapter introduces:

 

• Using multiple ImageSprite components and detecting collisions between them.

 

• Detecting device tilts with an OrientationSensor component and using it to control an ImageSprite.

 

• Changing the picture displayed for an ImageSprite.

 

• Drawing lines on a Canvas component.

 

• Controlling multiple events with a Clock component.

 

• Using variables to keep track of numbers (the ladybug’s energy level).

 

• Creating and using procedures with parameters.

 

• Using the and block.

bottom of page