#include <characters_common.h>
Inheritance diagram for Character:
Public Member Functions | |
Character (Sint16 xpos=0, Sint16 ypos=0, const ParameterMap ¶m=ParameterMap()) | |
Uint8 | getHealth () |
Sint16 | getSpeed () const |
Sint16 | setSpeed (Sint16 newspeed) |
Sint16 | addSpeed (Sint16 dspeed) |
Sint16 | addHSpeed (Sint16 dspeed) |
void | setGravity (Sint16 setgravity) |
void | addGravity (Sint16 addgravity) |
Uint16 | addMaxSpeed (Sint16 dmax) |
Uint16 | setMaxSpeed (Uint16 maxs) |
Hit | checkMove (SDL_Rect &dest, bool tele=false, bool check=false) |
Collision detection. | |
const std::set< Object * > & | getEnter () const |
const std::set< Object * > & | getTouch () const |
virtual void | removedObject (Object *) |
Remove the specified object from all internal accountings. | |
virtual void | updateAnimState () |
Updates the current animation. | |
virtual void | resetAnimState () |
Sets the animation back to the default one. | |
virtual void | idle (Uint16) |
virtual void | fall (Uint16) |
virtual void | die () |
virtual Uint16 | hit (Uint16 direction, Weapon &weap) |
Weapon hits. | |
Static Public Attributes | |
ParameterMap | default_parameters |
Protected Member Functions | |
Hit | checkHit (const SDL_Rect &dest, Object *destobj, bool tele=false) const |
Checks the type of the impact into the destination object. | |
void | updateRegions (std::set< Object * > &newtouch, std::set< Object * > &newenter) |
Updates the regions. | |
virtual void | crash (Uint16 dir=DIR_DOWN) |
virtual Hit | move (Uint16 dt, bool check=false) |
Uint8 | setHealth (Uint8) |
Uint8 | addHealth (Sint8) |
virtual void | addTouch (std::set< Object * > &) |
Adds the specified set to the touch set. | |
virtual void | addEnter (std::set< Object * > &) |
Adds the specified set to the enter set. | |
virtual void | removeTouch (std::set< Object * > &) |
Removes the specified sets from the touch set. | |
virtual void | removeEnter (std::set< Object * > &) |
Removes the specified sets from the enter set. | |
Protected Attributes | |
Uint8 | health |
Uint8 | maxhealth |
Uint16 | maxspeedx |
Uint16 | maxspeedy |
Sint16 | hspeed |
Sint16 | speed |
Sint16 | gravity |
Sint16 | Dgrav |
std::set< Object * > | enter |
std::set< Object * > | touch |
Uint16 | dense_types |
Uint16 | enemy_types |
Weapon | weapon |
A character can get hit, can move and fall, can die, etc...
|
Collision detection. Checks and correspondingly updates a movement and the regions the character is in. It therefore performs a collision check for all objects in the objectspool and the map boundary on the left, right and downside. If check is false it updates the regions accordingly. The destination parameter is changed to be before any dense obstacles in the way.
|
|
Remove the specified object from all internal accountings. Clean up the internal accountings of the specified object. Usually called when an object leaves the map (dies). Reimplemented in Monster.
|
|
Updates the current animation. Checks the state and changes the animation correpspondingly Reimplemented in Monster, Olaf, and Player.
|
|
What should the object do all the time? This is run first of all.
Reimplemented from Object.
Reimplemented in Monster, Erik, Plant, Scorch, TriggeredBomb, Zombie, and Player.
|
|
Calculates the speed of the character
Reimplemented in Monster, Fang, Olaf, Scorch, and Player.
|
|
Weapon hits. Called when hit by a weapon. Depending on the direction and weapon used, certain effects/events are run.
Reimplemented in Monster, Erik, Olaf, Plant, and Player.
|
|
Checks the type of the impact into the destination object. Helper function (run by checkMove()) that checks the type of the collision into one specific object.
|
|
Updates the regions. A helper function (run by checkMove()) that updates the touch and enter regions of the character. It adds the new regions and removes the old ones.
|
|
Sets the health of the character to a minimum of 0
|
|
Adds the specified amount of life to the health of the character to a minimum of 0
|
|
Updates the position of the character depending on it's velocity, checks for crashes
Reimplemented in Monster, and Player.
|