Fandom

Pico-8 Wiki

Mget

162pages on
this wiki
Add New Page
Comments0 Share
mget( celx, cely )

Gets the sprite number assigned to a cell on the map.

celx
The column (x) coordinate of the cell.
cely
The row (y) coordinate of the cell.

The mget() function returns the sprite number assigned to a cell on the map. If a cell was modified by a call to mset, mget() returns the updated value.

When using the map to store level designs, a common technique is to keep track of the player's effective cell position on the map, then use mget() to look for adjacent level features such as obstructions. This can be combined with sprite flags (read with fget()) to indicate which sprite tiles represent obstructions, so a general purpose test for obstructions only needs to read the flags.

Examples Edit

to_the_right = mget(player.celx + 1, player.cely)

See also Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.