jjANIMFRAME class
A single frame of a sprite animation.
One entry of the global frame table jjAnimFrames, holding an image, its size and its hotspot, coldspot and gunspot. Each entry exists only once, so changes a script makes to it last and also show in the sprites the game draws with that frame.
Public static functions
-
static auto get_jjAnimFrames(std::
uint32_t index) -> jjANIMFRAME* - Returns the animation frame at a global index.
Constructors, destructors, conversion operators
-
jjANIMFRAME(std::
uint32_t index) explicit - Creates a new instance, the entry at the given index of the frame table.
- ~jjANIMFRAME()
Public functions
- void AddRef()
- Increments the reference count.
- void Release()
- Decrements the reference count.
- auto operator=(const jjANIMFRAME& o) -> jjANIMFRAME&
- Copies another frame into this one.
- auto get_transparent() const -> bool
- Whether the frame is drawn translucent by default.
- auto set_transparent(bool value) -> bool
- Sets whether the frame is drawn translucent by default.
- auto get_is32Bit() const -> bool
- Whether the frame stores 32-bit colors instead of palette indices.
-
auto doesCollide(std::
int32_t xPos, std:: int32_t yPos, std:: int32_t direction, const jjANIMFRAME* frame2, std:: int32_t xPos2, std:: int32_t yPos2, std:: int32_t direction2, bool always) const -> bool - Returns whether this frame would overlap another one.
Public variables
-
std::
int16_t hotSpotX - Horizontal position of the hotspot.
-
std::
int16_t hotSpotY - Vertical position of the hotspot, see
hotSpotX. -
std::
int16_t coldSpotX - Horizontal position of the coldspot.
-
std::
int16_t coldSpotY - Vertical position of the coldspot, see coldSpotX.
-
std::
int16_t gunSpotX - Horizontal position of the gunspot.
-
std::
int16_t gunSpotY - Vertical position of the gunspot, see gunSpotX.
-
std::
uint16_t width - Width of the frame in pixels.
-
std::
uint16_t height - Height of the frame in pixels.
Function documentation
static jjANIMFRAME* Jazz2:: Scripting:: Legacy:: jjANIMFRAME:: get_jjAnimFrames(std:: uint32_t index)
Returns the animation frame at a global index.
Indices are the ones used by jjANIMATION::firstFrame and by the curFrame of objects and players.
jjANIMFRAME& Jazz2:: Scripting:: Legacy:: jjANIMFRAME:: operator=(const jjANIMFRAME& o)
Copies another frame into this one.
Copies the image, the size, the hotspot, coldspot and gunspot and the translucency.
bool Jazz2:: Scripting:: Legacy:: jjANIMFRAME:: get_transparent() const
Whether the frame is drawn translucent by default.
Objects drawn in SPRITE::NORMAL with such a frame appear translucent, e.g. the freezer ammo pickups.
bool Jazz2:: Scripting:: Legacy:: jjANIMFRAME:: doesCollide(std:: int32_t xPos,
std:: int32_t yPos,
std:: int32_t direction,
const jjANIMFRAME* frame2,
std:: int32_t xPos2,
std:: int32_t yPos2,
std:: int32_t direction2,
bool always) const
Returns whether this frame would overlap another one.
Both frames are placed by their hotspots at the given positions and flipped as their directions say (negative flips horizontally, as in jjCANVAS::drawSprite()). With always, a single shared pixel is a collision (as bullets use); otherwise at least eight overlapping pixels are needed.
Variable documentation
std:: int16_t Jazz2:: Scripting:: Legacy:: jjANIMFRAME:: hotSpotX
Horizontal position of the hotspot.
The hotspot is the point of the frame placed at the drawing position, also used for collisions. The value is added to the drawing position to get the top left corner, so it is usually negative.
std:: int16_t Jazz2:: Scripting:: Legacy:: jjANIMFRAME:: coldSpotX
Horizontal position of the coldspot.
The coldspot is where the frame touches the ground, used by walking enemies, crates and players. Measured the same way as hotSpotX.
std:: int16_t Jazz2:: Scripting:: Legacy:: jjANIMFRAME:: gunSpotX
Horizontal position of the gunspot.
The gunspot is where projectiles start; mostly frames of players and shooting enemies define it. Measured the same way as hotSpotX.