jjTILE class JJ2+
Static or animated tile of the level
Mainly used to read and change the frames and the speed of animated tiles. There's exactly one instance for each tile ID, so it can't be constructed, only reached through jjTiles, which gives read-only access to static and animated tiles, or jjAnimatedTiles, which allows changing animated tiles.
Functions
Properties
Function documentation
array<uint16>@ jjTILE:: getFrames() const
Returns the tile IDs of the frames in the order the animation plays them
Frames shown longer because of the wait or the ping-pong setting appear repeatedly, so the array can be longer than the list of frames of the animated tile. A frame can itself be an animated tile. For a static tile, the array contains only its own ID.
bool jjTILE:: setFrames(const array<uint16>&in frames,
bool pingPong = false,
uint16 wait = 0,
uint16 randomWait = 0,
uint16 pingPongWait = 0)
Replaces the frames of an animated tile
| Parameters | |
|---|---|
| frames | Tile IDs of the new frames, only the first 255 are used |
| pingPong | Whether the animation plays back and forth |
| wait | Frames to wait between two cycles of the animation |
| randomWait | Random amount added to wait |
| pingPongWait | Frames to wait before the animation plays backwards |
| Returns | false if this isn't an animated tile or frames is empty |
The speed stays as it was. The number of animated tiles of a level can't be increased.
Property documentation
uint16 jjTILE:: tileID read-only
The tile ID of the tile
Includes TILE::ANIMATED for an animated tile, so jjTiles[tile.tileID] is always the same tile.