Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

Player Class Reference

Interactively controlled characters. More...

#include <players_common.h>

Inheritance diagram for Player:

Inheritance graph
Collaboration diagram for Player:

Collaboration graph
List of all members.

Public Member Functions

 Player (Sint16 xpos=0, Sint16 ypos=0, const ParameterMap &param=ParameterMap())
Frame getIcon () const
 Returns the icon of this Player.
Uint8 getItemNum ()
 Returns the current icon number.
ItemgetItem (Uint8 num)
bool pickupItem (Item *newitem)
ItemmoveItem ()
void removeItem ()
 Detaches and removes an Item from the item pool.
void switchItem (bool right=true)
ObjectdropItem ()
 Detaches an item and adds it back to the ObjectsPool.
virtual void updateAnimState ()
 Updates the current animation.
virtual void idle (Uint16)
virtual void fall (Uint16)
virtual Uint16 hit (Uint16 direction, Weapon &weap)
 Weapon hits.
virtual void clearStates (bool reset=false)
virtual void setEvent (Event *ev)
virtual void in_right ()
 Called when using the move right key (right arrow).
virtual void in_right (Uint16)
virtual void in_left ()
 Called when using the move left key (left arrow).
virtual void in_left (Uint16)
virtual void in_up ()
 Called when using the move up key (up arrow).
virtual void in_up (Uint16)
virtual void in_down ()
 Called when using the move down key (down arrow).
virtual void in_down (Uint16)
virtual void in_sp1 ()
 Called when using the special 1 key (space).
virtual void in_sp2 ()
 Called when using the special 2 key (left shift).
virtual void in_act ()
 Called when using the activation key (enter).
virtual void in_use ()
 Called when using the use key (insert).

Static Public Attributes

ParameterMap default_parameters

Protected Member Functions

virtual void crash (Uint16 dir=DIR_DOWN)
 Called when crashing into a dense object (default: ground).
virtual void die ()
 Called when this player dies.
virtual Hit move (Uint16 dt, bool check=false)
virtual void addTouch (std::set< Object * > &)
 Adds the specified set to the touch set.
virtual void addEnter (std::set< Object * > &)
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.
void removeItem (Uint8 num)
ItemmoveItem (Uint8 num)
ObjectdropItem (Uint8 num)

Protected Attributes

Itemitems [MAX_ITEMS]
Uint8 currentitem
Mix_Chunk * au_hit
Mix_Chunk * au_land
Mix_Chunk * au_act
Mix_Chunk * au_useerror
Mix_Chunk * au_newitem
Mix_Chunk * au_die
Mix_Chunk * au_elec
Mix_Chunk * au_drown
Mix_Chunk * au_fire
Mix_Chunk * au_heal
EmptyAnimationPtr anim_left
EmptyAnimationPtr anim_right
EmptyAnimationPtr anim_rock_left
EmptyAnimationPtr anim_rock_right
EmptyAnimationPtr anim_walk_left
EmptyAnimationPtr anim_walk_right
EmptyAnimationPtr anim_push_left
EmptyAnimationPtr anim_push_right
EmptyAnimationPtr anim_fall_left
EmptyAnimationPtr anim_fall_right
EmptyAnimationPtr anim_fall_fast_left
EmptyAnimationPtr anim_fall_fast_right
EmptyAnimationPtr anim_crash_left
EmptyAnimationPtr anim_crash_right
EmptyAnimationPtr anim_rope_left
EmptyAnimationPtr anim_rope_right
EmptyAnimationPtr anim_teleport_left
EmptyAnimationPtr anim_teleport_right
EmptyAnimationPtr anim_die_crash_left
EmptyAnimationPtr anim_die_crash_right
EmptyAnimationPtr anim_die_burn_left
EmptyAnimationPtr anim_die_burn_right
EmptyAnimationPtr anim_die_bones_left
EmptyAnimationPtr anim_die_bones_right
EmptyAnimationPtr anim_die_elec_left
EmptyAnimationPtr anim_die_elec_right
EmptyAnimationPtr anim_die_spike_left
EmptyAnimationPtr anim_die_spike_right
EmptyAnimationPtr anim_die_water_left
EmptyAnimationPtr anim_die_water_right
EmptyAnimationPtr anim_fall_middle
EmptyAnimationPtr anim_climb
EmptyAnimationPtr anim_bar

Detailed Description

Interactively controlled characters.

Member Function Documentation

Frame Player::getIcon  )  const

Returns the icon of this Player.

Single icon frame of this player (used for the player bar)

Uint8 Player::getItemNum  )  [inline]

Returns the current icon number.

Current icon number

bool Player::pickupItem Item newitem  ) 

Inserts a detached Item (usually from the ObjectsPool) and tries to add it to the item pool of this player.

True if the item could be added

Item* Player::moveItem  )  [inline]

Detaches an item from the item pool

Detached Item

void Player::switchItem bool  right = true  ) 

Selects a new current item from the item pool

right If true take the next item to the right, otherwise the next to the left

virtual void Player::updateAnimState  )  [virtual]

Updates the current animation.

Checks the state and changes the animation correpspondingly

Reimplemented from Character.

Reimplemented in Olaf.

virtual void Player::idle Uint16   )  [virtual]

What should the object do all the time? This is run first of all.

This should be called downwards by all derived classes

Reimplemented from Character.

Reimplemented in Erik, and Scorch.

virtual void Player::fall Uint16   )  [virtual]

Calculates the speed of the character

clean up this mess with fall/move

Reimplemented from Character.

Reimplemented in Fang, Olaf, and Scorch.

virtual Uint16 Player::hit Uint16  direction,
Weapon weap

Weapon hits.

Called when hit by a weapon. Depending on the direction and weapon used, certain effects/events are run.

direction Direction from which the weapon deals damage
weap Weapon used in the attack/hit
New health of the character

Reimplemented from Character.

Reimplemented in Erik, and Olaf.

virtual void Player::clearStates bool  reset = false  )  [virtual]

Removes all interactively initiated events and states

reset If true reset the states of this player

Reimplemented in Fang, and Scorch.

virtual void Player::setEvent Event ev  )  [virtual]

Schedules a new event and cancels any currently running event

ev New event

Reimplemented from Object.

virtual void Player::in_act  )  [virtual]

Called when using the activation key (enter).

This should be the same for all players.

virtual void Player::addEnter std::set< Object * > &   )  [protected, virtual]

Runs Character::addEnter() and tries to pickup any Items it finds

dynamic_casts are not nice solutions

Reimplemented from Character.

virtual void Player::crash Uint16  dir = DIR_DOWN  )  [protected, virtual]

Called when crashing into a dense object (default: ground).

dir Direction of the crash
crash is called _after_ addEnter/etc, so if one of those sets an event, it will be canceled by crash!

Reimplemented from Character.

Reimplemented in Erik.

virtual Hit Player::move Uint16  dt,
bool  check = false
[protected, virtual]

Updates the position of the character depending on it's velocity, checks for crashes

clean up this mess with move and fall

Reimplemented from Character.

The documentation for this class was generated from the following file:
Generated on Sun Feb 5 13:02:38 2006 for Lost Penguins by doxygen 1.3.8