Chapter 6: AlphaDroid: An Alphabet Tracing Game

In This Chapter

• Animating a character by changing images rapidly

• Changing the direction and speed of a moving sprite

• Using the NOT block to test the opposite of a test statement

The Canvas component is a versatile component that allows the user to interact with your application through touch and drag. Although the way you use the Canvas component events in this project is fairly straightforward, you can use the input from the canvas for everything from control input for games to hotspot touch buttons.

The Canvas and sprites make up most of the interface elements for most game designs. Use the AlphaDroid application in this chapter to become familiar with canvas and sprite programming. Another core component of many games is animation. In this chapter, you learn a sprite animation technique that comes in handy for event animation such as explosions, collisions, and so on.

You need to download the Chapter 6 project files from the companion Web site. See this book’s Introduction for more information on how to download the files.

Creating AlphaDroid 1.0

The AlphaDroid application starts with a canvas to accommodate the user interaction events such as touch and drag. The canvas is also used to display a series of images of the alphabet. The method you employ uses long lists of image filenames. The algorithm keeps tabs on the index number of the filename being used to display the current alphabet character. Pay close attention to ...

Get App Inventor for Android: Build Your Own Apps — No Experience Required! now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.