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 ...

Get Learning MIT App Inventor: A Hands-On Guide to Building Your Own Android Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.