Difference between revisions of "TileMap:shift"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
Line 5: Line 5:
 
=== Description ===
 
=== 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.
 
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">
+
<syntaxhighlight lang="lua">
 
TileMap:shift(dx,dy)
 
TileMap:shift(dx,dy)
 
</source>
 
</source>
Line 14: Line 14:
  
 
=== Examples ===
 
=== Examples ===
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
tilemap:shift(-1, 0) -- shifts the tile map to the left
 
tilemap:shift(-1, 0) -- shifts the tile map to the left
 
tilemap:shift(1, 0) -- shifts the tile map to the right
 
tilemap:shift(1, 0) -- shifts the tile map to the right

Revision as of 14:31, 13 July 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. <syntaxhighlight lang="lua"> TileMap:shift(dx,dy) </source>

Parameters

dx: (number) the x amount of shift in tiles
dy: (number) the y amount of shift in tiles

Examples

<syntaxhighlight 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>