supertux
|
Public Types | |
enum | { SOLID = 0x0001, UNISOLID = 0x0002, BRICK = 0x0004, GOAL = 0x0008, SLOPE = 0x0010, FULLBOX = 0x0020, COIN = 0x0040, FIRST_INTERESTING_FLAG = 0x0100, ICE = 0x0100, WATER = 0x0200, HURTS = 0x0400, FIRE = 0x0800, WALLJUMP = 0x1000 } |
bitset for tile attributes More... | |
enum | { WORLDMAP_NORTH = 0x0001, WORLDMAP_SOUTH = 0x0002, WORLDMAP_EAST = 0x0004, WORLDMAP_WEST = 0x0008, WORLDMAP_DIR_MASK = 0x000f, WORLDMAP_STOP = 0x0010, WORLDMAP_CNSE = WORLDMAP_NORTH | WORLDMAP_SOUTH | WORLDMAP_EAST, WORLDMAP_CNSW = WORLDMAP_NORTH | WORLDMAP_SOUTH | WORLDMAP_WEST, WORLDMAP_CNEW = WORLDMAP_NORTH | WORLDMAP_EAST | WORLDMAP_WEST, WORLDMAP_CSEW = WORLDMAP_SOUTH | WORLDMAP_EAST | WORLDMAP_WEST, WORLDMAP_CNSEW = WORLDMAP_NORTH | WORLDMAP_SOUTH | WORLDMAP_EAST | WORLDMAP_WEST } |
worldmap flags | |
enum | { UNI_DIR_NORTH = 0, UNI_DIR_SOUTH = 1, UNI_DIR_WEST = 2, UNI_DIR_EAST = 3, UNI_DIR_MASK = 3 } |
Public Member Functions | |
Tile (const std::vector< SurfacePtr > &images, const std::vector< SurfacePtr > &editor_images, uint32_t attributes, uint32_t data, float fps, bool deprecated=false, const std::string &obj_name="", const std::string &obj_data="") | |
void | draw (Canvas &canvas, const Vector &pos, int z_pos, const Color &color=Color(1, 1, 1)) const |
Draw a tile on the screen. | |
void | draw_debug (Canvas &canvas, const Vector &pos, int z_pos, const Color &color=Color(1.0f, 0.f, 1.0f, 0.5f)) const |
SurfacePtr | get_current_surface () const |
SurfacePtr | get_current_editor_surface () const |
uint32_t | get_attributes () const |
int | get_data () const |
bool | is_slope () const |
Checks the SLOPE attribute. More... | |
bool | is_solid (const Rectf &tile_bbox, const Rectf &position, const Vector &movement) const |
Determine the solidity of a tile. More... | |
bool | is_solid () const |
This version only checks the SOLID flag to determine the solidity of a tile. More... | |
bool | is_collisionful (const Rectf &tile_bbox, const Rectf &position, const Vector &movement) const |
Determines whether the tile's attributes are important to calculate the collisions. More... | |
bool | is_unisolid () const |
Checks the UNISOLID attribute. More... | |
bool | is_deprecated () const |
const std::string & | get_object_name () const |
const std::string & | get_object_data () const |
bool | HasAttribute (int Attrib) |
void | SetAttribute (int Attrib, bool Value) |
bool | HasWMAttribute (int Attrib) |
void | SetWMAttribute (int Attrib, bool Value) |
void | Write (LispWriter writer) |
void | Parse (Lisp.Parser parser) |
Public Attributes | |
int | ID |
bool | Hidden |
int | NextTile |
int | Attributes |
int | Data |
float | AnimFps |
string | OneWayString |
ArrayList | Images = new ArrayList() |
ArrayList | EditorImages = new ArrayList() |
Static Public Attributes | |
static bool | draw_editor_images = false |
anonymous enum |
bitset for tile attributes
Enumerator | |
---|---|
SOLID | solid tile that is indestructible by Tux |
UNISOLID | uni-directional solid tile |
BRICK | a brick that can be destroyed by jumping under it |
GOAL | the level should be finished when touching a goaltile. if data is 0 then the endsequence should be triggered, if data is 1 then we can finish the level instantly. |
SLOPE | slope tile |
FULLBOX | Bonusbox, content is stored in data. |
COIN | Tile is a coin. |
ICE | an ice brick that makes tux sliding more than usual |
WATER | a water tile in which tux starts to swim |
HURTS | a tile that hurts Tux if he touches it |
FIRE | for lava: WATER, HURTS, FIRE |
WALLJUMP | a walljumping trigger tile |
bool Tile::is_collisionful | ( | const Rectf & | tile_bbox, |
const Rectf & | position, | ||
const Vector & | movement | ||
) | const |
Determines whether the tile's attributes are important to calculate the collisions.
The tile may be unisolid and therefore the collision with that tile don't matter.
|
inline |
Checks the SLOPE attribute.
Returns "true" if set, "false" otherwise.
bool Tile::is_solid | ( | const Rectf & | tile_bbox, |
const Rectf & | position, | ||
const Vector & | movement | ||
) | const |
Determine the solidity of a tile.
This version behaves correctly for unisolid tiles by taking position and movement of the object in question into account. Because creating the arguments for this function can be expensive, you should handle trivial cases using the "is_solid()" and "is_unisolid()" methods first.
|
inline |
This version only checks the SOLID flag to determine the solidity of a tile.
This means it will always return "true" for unisolid tiles. To determine the current solidity of unisolid tiles, use the "is_solid" method that takes position and movement into account (see above).
|
inline |
Checks the UNISOLID attribute.
Returns "true" if set, "false" otherwise.