Back to index

Use these functions to draw tiled scrollable images on the screens.



Background:LoadPalette( palettefile )

Loads a palette in a file into a variable (in this case, Background).

palettefile is the file name of the palette you want to load. (Example: "map.pal")





Background:LoadTiles( rawfile, colormode )

Loads the tiles from a .raw image file into a variable (in this case, Background).

rawfile is the file name of the .raw image file you want to load. (Example: "map.raw")
colormode is an integer that can either be 16 or 256. Either 16 colors or 256 colors.





Background:LoadMap( mapfile, width, height )

Loads a map into a background variable (in this case, Background).

mapfile is the file name of the map file you want to load. (Example: "map.map")
width, height are the width and height of the map in tiles (NOT pixels). Tiles are always 8 pixels in width and height. So if you want to use pixels you would do "Background:LoadMap( "map.map", ( pixel_width / 8 ), ( pixel_height / 8 ) )".





Background:SetMapTile( x, y, tilenumber )

Sets a certain tile on the map to a different tile.

x, y are the coordinates of the tile to change. (Divide by 8 if you are measuring with pixels.)
tilenumber is the number of the new tile.





Background:ScrollXY( x, y )

Scrolls a map to a new position instantly.

x, y are the coordinates for the new position.





Background:GetTile( x, y )

Returns a tile on the screen.

x, y are the coordinates for the tile you want to get.


Back to index