Clipping FTilemaps

Tilemaps in games help save resources by reusing a limited number of tiles, often just to the edge of visibility on screen. My first creation of the FTilemap class didn’t include this important functionality, but I’ve corrected that now.

You can still render the entire FTilemap by making skipZero = TRUE, and in some cases that may actually save overhead. FTmxMap will now check for skipZero layer property, and set the FTilemap appropriately (it is FALSE by default). Be sure to pass a clipNode to determine where the centerpoint is (usually this will be your FCamObject).

// create camObject
FCamObject cam = new FCamObject();

// create map, clip to the screen
FTilemap map = new FTilemap("YourImage");
map.clipNode = cam;
map.clipToScreen = true;
map.LoadCSV("CSVs/MapFile");

Additional Futile classes on Github.

Comments

comments