supertux
Public Member Functions | Public Attributes | Friends | List of all members
CollisionObject Class Reference

Public Member Functions

 CollisionObject (CollisionGroup group, CollisionListener &parent)
 
void collision_solid (const CollisionHit &hit)
 this function is called when the object collided with something solid
 
bool collides (CollisionObject &other, const CollisionHit &hit) const
 when 2 objects collided, we will first call the pre_collision_check functions of both objects that can decide on how to react to the collision. More...
 
HitResponse collision (CollisionObject &other, const CollisionHit &hit)
 this function is called when the object collided with any other object
 
void collision_tile (uint32_t tile_attributes)
 called when tiles with special attributes have been touched
 
const Rectfget_bbox () const
 returns the bounding box of the Object
 
const Vectorget_movement () const
 
void set_pos (const Vector &pos)
 places the moving object at a specific position. More...
 
Vector get_pos () const
 
void move_to (const Vector &pos)
 moves entire object to a specific position, including all points those the object has, exactly like the object has spawned in that given pos instead. More...
 
void set_width (float w)
 sets the moving object's bbox to a specific width. More...
 
void set_size (float w, float h)
 sets the moving object's bbox to a specific size. More...
 
CollisionGroup get_group () const
 
bool is_valid () const
 
CollisionListenerget_listener ()
 

Public Attributes

Rectf m_bbox
 The bounding box of the object (as used for collision detection, this isn't necessarily the bounding box for graphics)
 
Vector m_movement
 The movement that will happen till next frame.
 
CollisionGroup m_group
 The collision group.
 

Friends

class CollisionSystem
 

Member Function Documentation

§ collides()

bool CollisionObject::collides ( CollisionObject other,
const CollisionHit hit 
) const

when 2 objects collided, we will first call the pre_collision_check functions of both objects that can decide on how to react to the collision.

§ move_to()

void CollisionObject::move_to ( const Vector pos)
inline

moves entire object to a specific position, including all points those the object has, exactly like the object has spawned in that given pos instead.

§ set_pos()

void CollisionObject::set_pos ( const Vector pos)
inline

places the moving object at a specific position.

Be careful when using this function. There are no collision detection checks performed here so bad things could happen.

§ set_size()

void CollisionObject::set_size ( float  w,
float  h 
)
inline

sets the moving object's bbox to a specific size.

Be careful when using this function. There are no collision detection checks performed here so bad things could happen.

§ set_width()

void CollisionObject::set_width ( float  w)
inline

sets the moving object's bbox to a specific width.

Be careful when using this function. There are no collision detection checks performed here so bad things could happen.


The documentation for this class was generated from the following files: