Mget
Jump to navigation
Jump to search
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
to_the_right = mget(player.celx + 1, player.cely)
Notes
This function works only when the tiles are drawn by map()
function.