jjTILE class
#include <Jazz2/Scripting/Legacy/Layers.h>
A tile of the level, static or animated.
There's one instance for every tile ID, jjTiles[id], which a script reads the frames and the speed of an animated tile through, and changes them through jjAnimatedTiles[id]. A static tile is its only frame.
Public static functions
-
static auto get_jjTiles(std::
uint16_t tileID) -> jjTILE* - Returns the tiles of the level by tile ID, read-only.
-
static auto get_jjAnimatedTiles(std::
uint16_t tileID) -> jjTILE* - Returns the animated tiles of the level by their index.
Constructors, destructors, conversion operators
-
jjTILE(std::
uint16_t tileID) explicit - Creates a new instance for a tile ID, with
TILE::ANIMATEDfor an animated tile and without flips.
Public functions
- void AddRef()
- Increments the reference count.
- void Release()
- Decrements the reference count.
- auto getFrames() const -> CScriptArray*
- Returns the tile IDs of the frames in the order the animation plays them.
-
auto setFrames(const CScriptArray& frames,
bool pingPong,
std::
uint16_t wait, std:: uint16_t randomWait, std:: uint16_t pingPongWait) -> bool - Replaces the frames of an animated tile.
-
auto get_fps() const -> std::
uint8_t - Returns the animation speed in frames per second.
-
auto set_fps(std::
uint8_t value) -> std:: uint8_t - Sets the animation speed in frames per second.
-
auto get_tileID() const -> std::
uint16_t - Returns the tile ID of the tile.
Function documentation
static jjTILE* Jazz2:: Scripting:: Legacy:: jjTILE:: get_jjTiles(std:: uint16_t tileID)
Returns the tiles of the level by tile ID, read-only.
Covers static tiles as well as animated ones, which are indexed with TILE::ANIMATED set. Flip bits of the ID are ignored. Returns null if the level has no such tile. To change an animated tile, use jjAnimatedTiles.
static jjTILE* Jazz2:: Scripting:: Legacy:: jjTILE:: get_jjAnimatedTiles(std:: uint16_t tileID)
Returns the animated tiles of the level by their index.
jjAnimatedTiles[i] is the same object as jjTiles[i | TILE::ANIMATED], but it can be changed. Returns null if the level has no such animated tile.
CScriptArray* Jazz2:: Scripting:: Legacy:: 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 Jazz2:: Scripting:: Legacy:: jjTILE:: setFrames(const CScriptArray& frames,
bool pingPong,
std:: uint16_t wait,
std:: uint16_t randomWait,
std:: uint16_t pingPongWait)
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.
std:: uint8_t Jazz2:: Scripting:: Legacy:: jjTILE:: get_fps() const
Returns the animation speed in frames per second.
Always 0 for a static tile, which can't be changed.
std:: uint16_t Jazz2:: Scripting:: Legacy:: jjTILE:: get_tileID() const
Returns the tile ID of the tile.
Includes TILE::ANIMATED for an animated tile, so jjTiles[tile.tileID] is always the same tile.