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

ScrollCanvas

The ScrollCanvas class creates a tiled layer and then allows you to use a sequence of index values to display its cells sequentially. In this way, a scrolling background is created. This approach to a scrolling background is a simplified one. There are more advanced techniques that produce a much more refined and smooth motion. The approach used here is intended to provide a suitable starting point for exploring how a background can be animated. Like the ScrollStart class, the ScrollCanvas class is included in the NetBeans and standalone folders for the Appendix. These folders also contain the backtiles.png file, which is the source of the background tiles. Here is the code for the ScrollCanvas class.

/* * Appendix \ ScrollCanvas ...

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