O'Reilly logo

Android How to Program by Paul Deitel, Abbey Deitel, Harvey Deitel

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

7. Cannon Game App

Objectives

In this chapter you’ll:

• Create a simple game app that’s easy to code and fun to play.

• Create a custom SurfaceView subclass and use it to display the game’s graphics from a separate thread of execution.

• Draw graphics using Paints and a Canvas.

• Play sounds in respone to various game events.

• Manually perform frame-by-frame animations using a game loop that accounts for varying frame rates across devices.

• Override Activity’s onTouchEvent to process touch events when the user touches the screen or drags a finger on the screen.

• Use a GestureDetector to recognize more sophisticated user touch motions, such as double taps.

• Perform simple collision detection.

• Add sound to your app using a SoundPool and the ...

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