Skip to content

TileImage

sirrandalot edited this page Aug 19, 2018 · 1 revision

A TileImage is a rectangular set of tiles which can be drawn to the screen. The tile values, foreground and background colours can be set. If one of the colours is set to -1, it will behave the same way as drawing a tile after setting the foreground or background colour to -1, that is, it will use the most recently used colour on that tile on the screen. If the tile value is set to -1, no tile will be drawn at that position. This allows for a primitive sort of transparency.


Attributes:

final int imageWidth

  • The width of the TileImage.

final int imageHeight

  • The height of the TileImage.

Constructors:

TileImage(int width, int height)

  • Takes an image width and height (in number of tiles).

TileImage(int width, int height, int[] vals, int[][] cols)

  • Takes an image width and height (in number of tiles), an array of tile values, and an array of colours in the form of {background, foreground}.

Methods:

void setTile(int x, int y, int val, int background, int foreground)

  • Sets the value and colours of a tile at a given position.

void setTileValue(int x, int y, int val)

  • Sets the value of a tile at a given position.

void setTileColour(int x, int y, int background, int foreground)

  • Sets the colours of a tile at a given position.

int getTileValue(int x, int y, int val)

  • Returns the tile value at a specified position.

int[] getTileColours(int x, int y, int val)

  • Returns the colours of a tile at a specified position in the form of {background, foreground}.
Clone this wiki locally