TileDisplay.setCellTransform

From MiniScript Wiki
Revision as of 15:24, 22 February 2025 by JoeStrout (talk | contribs) (Created page with "The <c>TileDisplay.setCellTransform</c> method in Mini Micro (version 1.2.2 and later) introduced the ability to transform (flip and/or rotate) individual tiles in a TileD...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The TileDisplay.setCellTransform method in Mini Micro (version 1.2.2 and later) introduced the ability to transform (flip and/or rotate) individual tiles in a TileDisplay. Give this method an integer from 0-7. Values 0-3 rotate the tile in 90° increments. Values 4-7 first flip the tile horizontally, and then rotate it in 90° increments.

CellTransform.png

See also: TileDisplay.cellTransfrom

Arguments

Parameter Name Type Default Value Meaning
x number 0 column (or list of columns) of cell to change
y number 0 row (or list of rows) of cell to change
transform number null transform (0-7) to apply to the given cell

Example

This example configures display 4 to be a TileDisplay, loads a tile set, and then sets the cell at column 5, row 5 to be tile index 70 (a green key in this tile set). It then cycles through all 8 transforms, one per half second.

clear
display(4).mode = displayMode.tile
td = display(4)
td.tileSet = file.loadImage("/sys/pics/SimplePlatformTiles.png")
td.tileSetTileSize = 64
td.cellSize = 64
td.clear

td.setCell 5, 5, 70  // green key

while true
	td.setCellTransform 5, 5, (td.cellTransform(5,5)+1) % 8
	text.row = 12; text.column = 25
	print td.cellTransform(5,5)
	wait 0.5
end while
SetCellTransform.gif