12.4. TiledLayer

A TiledLayer is a Layer that is composed of a grid of cells that can be filled with a set of tile images. This technique is commonly used in 2D gaming platforms to create very large scrolling backgrounds without the need for an extremely large Image. The use of animated tiles allows numerous cells of a TiledLayer to be animated quickly and easily.

12.4.1. Tiles

As with a Sprite's frames, the tiles used to fill the TiledLayer's cells are provided in a single Image object which may be mutable or immutable. The Image is broken up into a series of equal-sized tiles whose dimensions are specified along with the Image.

Each tile is assigned a unique index number, as shown in Figure 12.7. The tile located in the upper-left corner of ...

Get Programming Wireless Devices with the Java™ 2 Platform, Micro Edition, Second Edition 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.