-
Notifications
You must be signed in to change notification settings - Fork 1
Tilemaps
RGE hardware handles up to 255 tilemaps of up to 256x256 tiles.
Tilemaps are a grid of cells and each cell contains a Tile.
Tilemaps can be way bigger of the screen and can be scrolled to any position.\
Each tilemap can be placed on a different layer (from 0 to 12), tilemaps with lower numbers will appear in front of tilemaps and sprites with higher numbers.
A tile is a rectangular image. And its sizes (width and height) can be a number between 8 and 64 pixels and multiple of 8 (e.g. 8, 16, 24, 32, 40, are valid sizes)
Tiles can use the full colors, including alpha. (256 actual colors.)
Defines a sprite.
Sprite(<number>, <width>, <height>, <memory address> [, <filterOnOff>])
This will define the sprite with the specified number with the given width and height, using the memory at the specified location (ram or rom.)
If filterOnOff evaluates to 0 no filter will be used, if it evaluated to anything than 0 then a bilinear filter will be used.
Sprite(<number>, <width>, <height>, <memory address> [, <filterOnOff>])
This will define the sprite, using the memory at the specified location (ram or rom.)
The first two bytes of the memory should contain the width and height for the sprite, then the actual color data will start just after.
If filterOnOff evaluates to 0 no filter will be used, if it evaluated to anything than 0 then a bilinear filter will be used.
The sprite number can be between 0 and 15 (included.)
The size (vertical or horizontal) has to be between 8 and 32 pixels.
The memory is one byte per pixel, from top left to bottom right, one line at time.
The byte value is the color value (see Colors for more info) and the alpha is used in this case.
Sets the sprite rotation and flipping.
The rotation is only at multiples of 90 degrees:
SRot(<number>, <rotation>, <flip>)
The parameter rotation is an integer number with values between 0 and 3 included.
- 0 = up
- 1 = right
- 2 = down
- 3 = left
flip is considered a boolean expression, if it is not zero, the sprite is flipped.
| Rotation | Sprite | Flipped |
|---|---|---|
| 0 | ||
| 1 | ||
| 2 | ||
| 3 |
Original sprite is: ![]()
If the rotation number is below or above the range 0 - 3 the modulo of 4 will be used.
STint(<number>, <color>)
Filter the colors of the sprite. Warning, it is like Unity colors applied to sprites, it is not "colorizing" it is "filtering by color".
If you have a sprite that is all white and you Tint it with blue, the result will be blue.
If the sprite is red and you filter with blue, the result is black.
Only the colors component of the tint are preserved in the sprite original colors.
Scale the sprite up to 8 times in the two directions.
SScale(<number>, <scalex>, <scaley>)\
The values for the scale can be between 1 and 8.
Defines the priority of the spite. Lower numbers mean the sprite will be in front of tiles and other sprites with higher number.
SPri(<number>, <order>)\
The values for the order can be from -1 (in front of everything) up to 12 that is beyond everything. Check the section [link]
When you define a sprite with the sprite command, a texture will be allocated from the sprite and filled with the memory you specified.
Because they are not real hardware sprites, if you change the memory behind the sprite will not change.
To update the sprite definition, you need to destroy the previous allocated texture.
Destroy(<memory address>)
Will free again the sprite texture to be re-processed by a new Sprite command.
Warning This does nothing if the memory is from Rom. Only Ram memory can be changed and the sprite may need to be re-created.