O'Reilly logo

Java™ ME Game Programming, Second Edition by Ph.D. Martin J. Wells, Ph.D. John P. Flynt

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

Construction and Definition

In the signature line of the DasherCanvas class, you begin the definition of the class by extending the GameCanvas class and implementing the Runnable interface. Extension of the GameCanvas class provides you with a number of useful services that have been explored in previous chapters and continue to furnish topics for discussion in the current context. The Runnable interface allows you to implement start() and run() methods, and using Timer and Thread objects, you make use of these services to control the speed of the game and to define the challenge the player of the game encounters. In the lines immediately following comment #1, you attend to the declaration of attributes of the Image, Sprite, DasherSprite, Graphics, ...

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