O'Reilly logo

Learning MIT App Inventor: A Hands-On Guide to Building Your Own Android Apps by Mark Sherman, Derek Walter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exercise: Fore

A golf course is a challenge because of its obstacles, so it makes a good model for an app when we want to practice working with edges, collisions, palettes, and sprites.

Create a new project and name it Fore. We are then going to become golf course architects and design the first hole.

1. We need the following elements: a canvas, two balls, and a clock.

2. The canvas should fill the screen: Set the width to Fill Parent and the height to 400 pixels. Then make the background green.

3. Make the ball white and give it a radius of 8 (or whatever you find makes the best size for flicking across the screen—see Figure 7.8).

Image

Figure 7.8 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required