Difference between revisions of "TileMap:shift"
From GiderosMobile
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | + | '''Available since:''' Gideros 2011.6<br/> | |
− | ''' | + | '''Class:''' [[TileMap]]<br/> |
− | ''' | + | |
− | === | + | === Description === |
− | + | Shifts the tile map to change tile graphic. The arguments are in tiles, not in pixels. By shifting the tile map one by one as needed, you can create dynamic tile maps. | |
− | |||
<source lang="lua"> | <source lang="lua"> | ||
− | + | TileMap:shift(dx,dy) | |
+ | </source> | ||
+ | |||
+ | === Parameters === | ||
+ | '''dx''': (number) the x amount of shift in tiles<br/> | ||
+ | '''dy''': (number) the y amount of shift in tiles<br/> | ||
+ | |||
+ | === Examples === | ||
+ | <source lang="lua"> | ||
+ | tilemap:shift(-1, 0) -- shifts the tile map to the left | ||
+ | tilemap:shift(1, 0) -- shifts the tile map to the right | ||
+ | tilemap:shift(0, -1) -- shifts the tile map up | ||
+ | tilemap:shift(0, 1) -- shifts the tile map down | ||
</source> | </source> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{{TileMap}} | {{TileMap}} |
Revision as of 01:58, 19 March 2023
Available since: Gideros 2011.6
Class: TileMap
Description
Shifts the tile map to change tile graphic. The arguments are in tiles, not in pixels. By shifting the tile map one by one as needed, you can create dynamic tile maps.
TileMap:shift(dx,dy)
Parameters
dx: (number) the x amount of shift in tiles
dy: (number) the y amount of shift in tiles
Examples
tilemap:shift(-1, 0) -- shifts the tile map to the left
tilemap:shift(1, 0) -- shifts the tile map to the right
tilemap:shift(0, -1) -- shifts the tile map up
tilemap:shift(0, 1) -- shifts the tile map down