jjANIMFRAME class JJ2+

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.

Functions

bool doesCollide(int xPos, int yPos, int direction, const jjANIMFRAME@ frame2, int xPos2, int yPos2, int direction2, bool always = false) const
Returns whether this frame would overlap another one

Operators

jjANIMFRAME& opAssign(const jjANIMFRAME&in o) =
Copies another frame into this one

Properties

int16 coldSpotX
Horizontal position of the coldspot
int16 coldSpotY C++
Vertical position of the coldspot, see coldSpotX
int16 gunSpotX
Horizontal position of the gunspot
int16 gunSpotY C++
Vertical position of the gunspot, see gunSpotX
const uint16 height C++
Height of the frame in pixels
int16 hotSpotX
Horizontal position of the hotspot
int16 hotSpotY C++
Vertical position of the hotspot, see hotSpotX
bool is32Bit read-only C++
Whether the frame stores 32-bit colors instead of palette indices
bool transparent
Whether the frame is drawn translucent by default
const uint16 width C++
Width of the frame in pixels

Function documentation

bool jjANIMFRAME::doesCollide(int xPos, int yPos, int direction, const jjANIMFRAME@ frame2, int xPos2, int yPos2, int direction2, bool always = false) 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.

Operator documentation

jjANIMFRAME& jjANIMFRAME::opAssign(const jjANIMFRAME&in o) =

Copies another frame into this one

Copies the image, the size, the hotspot, coldspot and gunspot and the translucency.

Property documentation

int16 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.

int16 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.

int16 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.

bool jjANIMFRAME::transparent

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.