Using Starling Tiles for large game levels

Hello, my name is Nick and I’m going to show you how to use the Citrus Engine’s tile system allowing you to create large game backgrounds.

Sometimes you will want to create levels that are larger than the maximum texture size allowed when using Starling, and converting that 5000 pixel wide background into tiles can be greatly simplified! The TileSystem is setup as the view property of a CitrusSprite. When you create the TileSystem you can use one of 2 methods of loading your graphics in.

  • From a strictly code approach, the TileSystem brings in a 2D array of tile images you have sliced in photoshop. It will arrange and place the tiles for you. This option also allows ATF files for better performance and a smaller GPU memory footprint.
  • In your level layout swf you can place a MovieClip on stage for the TileSystem to convert for you! The TileSystem will take your MovieClip (well, sprite since it can’t have a timeline) with vector or bitmap graphics, convert it to a BitmapData and slices it into tiles of a size you specify. This is a great way to get all of your artwork in one place!

So let’s go over both! Continue reading