Defined in Module impact.map, inherits from ig.Class
// Create a map var data = [ [1,2,6], [0,3,5], [2,8,1], ]; var map = new ig.Map( 16, data ); // 40, 20 are the pixel coordinates for the tile to set // So this essentially does data[2][1] = 8; map.setTile( 40, 20, 8 ); // Gets the same tile we just set, even though the // pixel coordinates are not the exact same var tile = map.getTile( 46, 18 ); tile; // => 8
ig.Map
is the base class for ig.BackgroundMap and ig.CollisionMap. It only provides basic access to the tiles in the map data.
You usually won't need to create instances of an ig.Map
.
tilesize
Width and height of a single tile in pixelsdata
A 2D Array (Array of Arrays) used as the data for this mapThe 2D data array for this map, as set through the constructor.
The width and height of a single tile in pixels, as set through the constructor.
New in 1.23
The width and height of the map in pixels.
The width and height of the map in tiles.
Get the tile at the pixel coordinates x
, y
. Returns 0
if the coordinates lie outside of this map.
Set the tile at the pixel coordinates x
, y
to the given tile
. Does nothing if the coordinates lie outside of this map.