jjMASKMAP class JJ2+

Editable collision mask of a tile

A 32×32 array of pixels, true for a solid pixel and false for an empty one. It can be read from a tile and saved into a tile to change where objects collide with it.

Constructors

jjMASKMAP(bool filled = false) C++
Creates a mask with every pixel solid or every pixel empty
jjMASKMAP(uint16 tileID)
Creates a mask from the collision mask of a tile

Functions

bool save(uint16 tileID, bool hFlip = false) const partially supported
Replaces the collision mask of a tile

Operators

bool& opIndex(uint x, uint y) []
Returns the pixel at the given position, true if it's solid
const bool& opIndex(uint x, uint y) const []
Returns the pixel at the given position, true if it's solid

Constructor documentation

jjMASKMAP::jjMASKMAP(uint16 tileID)

Creates a mask from the collision mask of a tile

Flips and animated tiles are handled as by the same constructor of jjPIXELMAP.

Function documentation

bool jjMASKMAP::save(uint16 tileID, bool hFlip = false) const

Replaces the collision mask of a tile

Operator documentation

bool& jjMASKMAP::opIndex(uint x, uint y) []

Returns the pixel at the given position, true if it's solid

Pixels are stored row by row, so an x past 31 continues on the following rows. A position past the end of the mask reads as false, and what's written there is lost.

const bool& jjMASKMAP::opIndex(uint x, uint y) const []

Returns the pixel at the given position, true if it's solid

Pixels are stored row by row, so an x past 31 continues on the following rows. A position past the end of the mask reads as false, and what's written there is lost.