Table of Contents

 
LockTileXY
 

Purpose

Gets the handle of a tile once so that multiple calculations aren't needed

 

Protoype

void CTileMngr::LockTileXY (int i_xpos, int i_ypos, int i_layer)
 

Parameters

xpos the x position of the tile to lock in the map
ypos the y position of the tile to lock in the map
layer the layer the tile resides in
 

Description

This function locks a tile by storing its handle in a map data member. This greatly speeds up multiple operations done on a single tile since it only has to be extracted once from the map array. This lock function works by taking the x and y location passed in and determining what tile lies under it. So in order to lock a tile you do not have to know the exact location of the tile, only an x and y location somewhere on the tile. This is very powerful for locking tiles under game objects. You must also pass the layer the tile is on.

 

Use

CTileMngr tile_mngr;
tile_mngr.LockTileXY(sprite_xpos, sprite_ypos, 2);
 

Prev: LockTileRC
Next: MapLoaded