BadGuy Class Reference

Base class for moving sprites that can hurt the Player. More...

#include <badguy.hpp>

Inherits MovingSprite.

Inherited by AngryStone, Bomb, BouncingSnowball, Dart, DartTrap, Dispenser, Fish, Flame, FlyingSnowBall, GhostTree, Jumpy, KamikazeSnowball, Kugelblitz, Mole, MoleRock, Owl, Plant, Root, SkullyHop, SkyDive, SpiderMite, Stalactite, Toad, Totem, TreeWillOWisp, WalkingBadguy, WillOWisp, Yeti, and Zeekling.

List of all members.

Public Member Functions

 BadGuy (const Vector &pos, const std::string &sprite_name, int layer=LAYER_OBJECTS)
 BadGuy (const Vector &pos, Direction direction, const std::string &sprite_name, int layer=LAYER_OBJECTS)
 BadGuy (const Reader &reader, const std::string &sprite_name, int layer=LAYER_OBJECTS)
virtual void draw (DrawingContext &context)
 Called when the badguy is drawn.
virtual void update (float elapsed_time)
 Called each frame.
virtual HitResponse collision (GameObject &other, const CollisionHit &hit)
 Called when a collision with another object occurred.
virtual void collision_tile (uint32_t tile_attributes)
 Called when a collision with tile with special attributes occurred.
virtual void kill_fall ()
 Set the badguy to kill/falling state, which makes him falling of the screen (his sprite is turned upside-down).
virtual void run_dead_script ()
 Call this, if you use custom kill_fall() or kill_squashed(GameObject& object).
virtual bool can_break ()
 True if this badguy can break bricks or open bonusblocks in his current form.
Vector get_start_position () const
void set_start_position (const Vector &vec)
virtual void ignite ()
 Called when hit by a fire bullet, and is_flammable() returns true.
virtual void extinguish ()
 Called to revert a badguy when is_ignited() returns true.
virtual bool is_flammable () const
 Returns whether to call ignite() when a badguy gets hit by a fire bullet.
bool is_ignited () const
 Returns whether this badguys is currently on fire.
virtual void freeze ()
 Called when hit by an ice bullet, and is_freezable() returns true.
virtual void unfreeze ()
 Called to unfreeze the badguy.
virtual bool is_freezable () const
bool is_frozen () const

Public Attributes

bool countMe
 Count this badguy to the statistics? This value should not be changed during runtime.

Protected Types

enum  State {
  STATE_INIT, STATE_INACTIVE, STATE_ACTIVE, STATE_SQUISHED,
  STATE_FALLING
}

Protected Member Functions

virtual HitResponse collision_player (Player &player, const CollisionHit &hit)
 Called when the badguy collided with a player.
virtual void collision_solid (const CollisionHit &hit)
 Called when the badguy collided with solid ground.
virtual HitResponse collision_badguy (BadGuy &other, const CollisionHit &hit)
 Called when the badguy collided with another badguy.
virtual bool collision_squished (GameObject &object)
 Called when the player hit the badguy from above.
virtual HitResponse collision_bullet (Bullet &bullet, const CollisionHit &hit)
 Called when the badguy collided with a bullet.
virtual void active_update (float elapsed_time)
 called each frame when the badguy is activated.
virtual void inactive_update (float elapsed_time)
 called each frame when the badguy is not activated.
virtual void initialize ()
 called immediately before the first call to initialize
virtual void activate ()
 called when the badguy has been activated.
virtual void deactivate ()
 called when the badguy has been deactivated
void kill_squished (GameObject &object)
void set_state (State state)
State get_state () const
bool check_state_timer ()
Playerget_nearest_player ()
 returns a pointer to the nearest player or 0 if no player is available
bool is_offscreen ()
 initial position of the enemy.
bool might_fall (int height=1)
 Returns true if we might soon fall at least height pixels.
Direction str2dir (std::string dir_str)
 Get Direction from String.
void update_on_ground_flag (const CollisionHit &hit)
 Update on_ground_flag judging by solid collision hit.
bool on_ground ()
 Returns true if we touched ground in the past frame This only works if update_on_ground_flag() gets called in collision_solid.
Vector get_floor_normal ()
 Returns floor normal stored the last time when update_on_ground_flag was called and we touched something solid from above.
bool is_active ()
 Returns true if we were in STATE_ACTIVE at the beginning of the last call to update().
void set_colgroup_active (CollisionGroup group)
 changes colgroup_active.

Protected Attributes

Physic physic
bool is_initialized
 true if initialize() has already been called
Vector start_position
Direction dir
 The direction we currently face in.
Direction start_dir
 The direction we initially faced in.
bool frozen
bool ignited
 true if this badguy is currently on fire
std::string dead_script
 script to execute when badguy is killed

Private Member Functions

void try_activate ()
 BadGuy (const BadGuy &)
BadGuyoperator= (const BadGuy &)

Private Attributes

State state
bool is_active_flag
 true if state was STATE_ACTIVE at the beginning of the last call to update()
Timer state_timer
bool on_ground_flag
 true if we touched something solid from above and update_on_ground_flag was called last frame
Vector floor_normal
 floor normal stored the last time when update_on_ground_flag was called and we touched something solid from above
CollisionGroup colgroup_active
 CollisionGroup the badguy should be in while active.


Detailed Description

Base class for moving sprites that can hurt the Player.

Definition at line 29 of file badguy.hpp.


Member Enumeration Documentation

enum BadGuy::State [protected]

Enumerator:
STATE_INIT 
STATE_INACTIVE 
STATE_ACTIVE 
STATE_SQUISHED 
STATE_FALLING 

Reimplemented in Bomb, DartTrap, and Snail.

Definition at line 100 of file badguy.hpp.

00100              {
00101     STATE_INIT,
00102     STATE_INACTIVE,
00103     STATE_ACTIVE,
00104     STATE_SQUISHED,
00105     STATE_FALLING
00106   };


Constructor & Destructor Documentation

BadGuy::BadGuy ( const Vector pos,
const std::string &  sprite_name,
int  layer = LAYER_OBJECTS 
)

Definition at line 35 of file badguy.cpp.

References AUTO, MovingObject::bbox, dir, LEFT, Rectf::p1, SoundManager::preload(), sound_manager, start_dir, and start_position.

00035                                                                          :
00036   MovingSprite(pos, sprite_name, layer, COLGROUP_DISABLED), 
00037   physic(),
00038   countMe(true), 
00039   is_initialized(false),
00040   start_position(),
00041   dir(LEFT), 
00042   start_dir(AUTO), 
00043   frozen(false), 
00044   ignited(false),
00045   dead_script(),
00046   state(STATE_INIT), 
00047   is_active_flag(),
00048   state_timer(),
00049   on_ground_flag(false),
00050   floor_normal(),
00051   colgroup_active(COLGROUP_MOVING)
00052 {
00053   start_position = bbox.p1;
00054 
00055   sound_manager->preload("sounds/squish.wav");
00056   sound_manager->preload("sounds/fall.wav");
00057 
00058   dir = (start_dir == AUTO) ? LEFT : start_dir;
00059 }

BadGuy::BadGuy ( const Vector pos,
Direction  direction,
const std::string &  sprite_name,
int  layer = LAYER_OBJECTS 
)

Definition at line 61 of file badguy.cpp.

References AUTO, MovingObject::bbox, dir, LEFT, Rectf::p1, SoundManager::preload(), sound_manager, start_dir, and start_position.

00061                                                                                               :
00062   MovingSprite(pos, sprite_name, layer, COLGROUP_DISABLED), 
00063   physic(),
00064   countMe(true), 
00065   is_initialized(false), 
00066   start_position(),
00067   dir(direction), 
00068   start_dir(direction), 
00069   frozen(false), 
00070   ignited(false),
00071   dead_script(),
00072   state(STATE_INIT), 
00073   is_active_flag(),
00074   state_timer(),
00075   on_ground_flag(false), 
00076   floor_normal(),
00077   colgroup_active(COLGROUP_MOVING)
00078 {
00079   start_position = bbox.p1;
00080 
00081   sound_manager->preload("sounds/squish.wav");
00082   sound_manager->preload("sounds/fall.wav");
00083 
00084   dir = (start_dir == AUTO) ? LEFT : start_dir;
00085 }

BadGuy::BadGuy ( const Reader reader,
const std::string &  sprite_name,
int  layer = LAYER_OBJECTS 
)

Definition at line 87 of file badguy.cpp.

References AUTO, MovingObject::bbox, dead_script, dir, lisp::Lisp::get(), LEFT, Rectf::p1, SoundManager::preload(), sound_manager, start_dir, start_position, and str2dir().

00087                                                                             :
00088   MovingSprite(reader, sprite_name, layer, COLGROUP_DISABLED), 
00089   physic(),
00090   countMe(true), 
00091   is_initialized(false), 
00092   start_position(),
00093   dir(LEFT), 
00094   start_dir(AUTO),
00095   frozen(false), 
00096   ignited(false), 
00097   dead_script(),
00098   state(STATE_INIT), 
00099   is_active_flag(),
00100   state_timer(),
00101   on_ground_flag(false), 
00102   floor_normal(),
00103   colgroup_active(COLGROUP_MOVING)
00104 {
00105   start_position = bbox.p1;
00106 
00107   std::string dir_str = "auto";
00108   reader.get("direction", dir_str);
00109   start_dir = str2dir( dir_str );
00110   dir = start_dir;
00111 
00112   reader.get("dead-script", dead_script);
00113 
00114   sound_manager->preload("sounds/squish.wav");
00115   sound_manager->preload("sounds/fall.wav");
00116 
00117   dir = (start_dir == AUTO) ? LEFT : start_dir;
00118 }

BadGuy::BadGuy ( const BadGuy  )  [private]


Member Function Documentation

void BadGuy::draw ( DrawingContext context  )  [virtual]

Called when the badguy is drawn.

The default implementation simply draws the badguy sprite on screen

Reimplemented from MovingSprite.

Reimplemented in Fish, GhostTree, Root, Stalactite, TreeWillOWisp, WillOWisp, and Yeti.

Definition at line 121 of file badguy.cpp.

References DrawingContext::get_drawing_effect(), MovingObject::get_pos(), MovingSprite::layer, DrawingContext::set_drawing_effect(), MovingSprite::sprite, state, STATE_FALLING, STATE_INACTIVE, STATE_INIT, and VERTICAL_FLIP.

Referenced by Yeti::draw(), Root::draw(), and GhostTree::draw().

00122 {
00123   if(!sprite.get())
00124     return;
00125   if(state == STATE_INIT || state == STATE_INACTIVE)
00126     return;
00127   if(state == STATE_FALLING) {
00128     DrawingEffect old_effect = context.get_drawing_effect();
00129     context.set_drawing_effect((DrawingEffect) (old_effect | VERTICAL_FLIP));
00130     sprite->draw(context, get_pos(), layer);
00131     context.set_drawing_effect(old_effect);
00132   } else {
00133     sprite->draw(context, get_pos(), layer);
00134   }
00135 }

void BadGuy::update ( float  elapsed_time  )  [virtual]

Called each frame.

The default implementation checks badguy state and calls active_update and inactive_update

Reimplemented from MovingSprite.

Reimplemented in YetiStalactite.

Definition at line 138 of file badguy.cpp.

References active_update(), MovingObject::bbox, Timer::check(), Sector::current(), deactivate(), Physic::get_movement(), inactive_update(), is_active_flag, is_offscreen(), MovingObject::movement, on_ground_flag, physic, GameObject::remove_me(), set_state(), state, STATE_ACTIVE, STATE_FALLING, STATE_INACTIVE, STATE_INIT, STATE_SQUISHED, state_timer, and try_activate().

Referenced by YetiStalactite::update().

00139 {
00140   if(!Sector::current()->inside(bbox)) {
00141     is_active_flag = false;
00142     remove_me();
00143     return;
00144   }
00145   if ((state != STATE_INACTIVE) && is_offscreen()) {
00146     if (state == STATE_ACTIVE) deactivate();
00147     set_state(STATE_INACTIVE);
00148   }
00149 
00150   switch(state) {
00151     case STATE_ACTIVE:
00152       is_active_flag = true;
00153       active_update(elapsed_time);
00154       break;
00155     case STATE_INIT:
00156     case STATE_INACTIVE:
00157       is_active_flag = false;
00158       inactive_update(elapsed_time);
00159       try_activate();
00160       break;
00161     case STATE_SQUISHED:
00162       is_active_flag = false;
00163       if(state_timer.check()) {
00164         remove_me();
00165         break;
00166       }
00167       movement = physic.get_movement(elapsed_time);
00168       break;
00169     case STATE_FALLING:
00170       is_active_flag = false;
00171       movement = physic.get_movement(elapsed_time);
00172       break;
00173   }
00174 
00175   on_ground_flag = false;
00176 }

HitResponse BadGuy::collision ( GameObject other,
const CollisionHit hit 
) [virtual]

Called when a collision with another object occurred.

The default implementation calls collision_player, collision_solid, collision_badguy and collision_squished

Implements MovingObject.

Reimplemented in Dispenser, GhostTree, Haywire, MrBomb, and MrIceBlock.

Definition at line 236 of file badguy.cpp.

References ABORT_MOVE, MovingObject::bbox, COLGROUP_MOVING, collision_badguy(), collision_bullet(), collision_player(), collision_squished(), FORCE_MOVE, MovingObject::get_bbox(), MovingObject::get_group(), is_active(), Rectf::p1, Rectf::p2, and Vector::y.

Referenced by MrIceBlock::collision(), MrBomb::collision(), and Haywire::collision().

00237 {
00238   if (!is_active()) return ABORT_MOVE;
00239 
00240   BadGuy* badguy = dynamic_cast<BadGuy*> (&other);
00241   if(badguy && badguy->is_active() && badguy->get_group() == COLGROUP_MOVING) {
00242 
00243     /* Badguys don't let badguys squish other badguys. It's bad. */
00244 #if 0
00245     // hit from above?
00246     if (badguy->get_bbox().p2.y < (bbox.p1.y + 16)) {
00247       if(collision_squished(*badguy)) {
00248         return ABORT_MOVE;
00249       }
00250     }
00251 #endif
00252 
00253     return collision_badguy(*badguy, hit);
00254   }
00255 
00256   Player* player = dynamic_cast<Player*> (&other);
00257   if(player) {
00258 
00259     // hit from above?
00260     if (player->get_bbox().p2.y < (bbox.p1.y + 16)) {
00261       if(collision_squished(*player)) {
00262         return FORCE_MOVE;
00263       }
00264     }
00265 
00266     return collision_player(*player, hit);
00267   }
00268 
00269   Bullet* bullet = dynamic_cast<Bullet*> (&other);
00270   if(bullet)
00271     return collision_bullet(*bullet, hit);
00272 
00273   return FORCE_MOVE;
00274 }

void BadGuy::collision_tile ( uint32_t  tile_attributes  )  [virtual]

Called when a collision with tile with special attributes occurred.

Reimplemented from MovingObject.

Reimplemented in Fish.

Definition at line 220 of file badguy.cpp.

References Tile::FIRE, freeze(), Tile::HURTS, Tile::ICE, ignite(), is_flammable(), is_freezable(), and kill_fall().

00221 {
00222   if(tile_attributes & Tile::HURTS) {
00223     if (tile_attributes & Tile::FIRE) {
00224       if (is_flammable()) ignite();
00225     }
00226     else if (tile_attributes & Tile::ICE) {
00227       if (is_freezable()) freeze();
00228     }
00229     else {
00230       kill_fall();
00231     }
00232   }
00233 }

void BadGuy::kill_fall (  )  [virtual]

Set the badguy to kill/falling state, which makes him falling of the screen (his sprite is turned upside-down).

Reimplemented in AngryStone, Bomb, Flame, GhostTree, Haywire, Kugelblitz, Mole, MrBomb, Root, ShortFuse, Stalactite, Totem, TreeWillOWisp, WillOWisp, and Yeti.

Definition at line 375 of file badguy.cpp.

References Physic::enable_gravity(), MovingObject::get_pos(), physic, SoundManager::play(), run_dead_script(), Physic::set_acceleration_y(), set_state(), Physic::set_velocity_y(), sound_manager, and STATE_FALLING.

Referenced by IceCrusher::collision(), HurtingPlatform::collision(), Explosion::collision(), Block::collision(), MoleRock::collision_badguy(), Kugelblitz::collision_badguy(), Dart::collision_badguy(), AngryStone::collision_badguy(), collision_player(), Snail::collision_squished(), Owl::collision_squished(), MrIceBlock::collision_squished(), collision_tile(), ignite(), Totem::kill_fall(), and WalkingBadguy::turn_around().

00376 {
00377   sound_manager->play("sounds/fall.wav", get_pos());
00378   physic.set_velocity_y(0);
00379   physic.set_acceleration_y(0);
00380   physic.enable_gravity(true);
00381   set_state(STATE_FALLING);
00382 
00383   // start dead-script
00384   run_dead_script();
00385 }

void BadGuy::run_dead_script (  )  [virtual]

Call this, if you use custom kill_fall() or kill_squashed(GameObject& object).

Definition at line 388 of file badguy.cpp.

References Statistics::badguys, countMe, Sector::current(), dead_script, Sector::get_level(), Sector::run_script(), and Level::stats.

Referenced by Mole::collision_squished(), Bomb::explode(), KamikazeSnowball::kill_collision(), ShortFuse::kill_fall(), MrBomb::kill_fall(), Mole::kill_fall(), Haywire::kill_fall(), kill_fall(), kill_squished(), Stalactite::squish(), and Yeti::take_hit().

00389 {
00390   if (countMe)
00391     Sector::current()->get_level()->stats.badguys++;
00392 
00393   countMe = false;
00394    
00395   // start dead-script
00396   if(dead_script != "") {
00397     std::istringstream stream(dead_script);
00398     Sector::current()->run_script(stream, "dead-script");
00399   }
00400 }

virtual bool BadGuy::can_break (  )  [inline, virtual]

True if this badguy can break bricks or open bonusblocks in his current form.

Reimplemented in MrIceBlock, and Snail.

Definition at line 62 of file badguy.hpp.

Referenced by Brick::collision(), and BonusBlock::collision().

00063   {
00064     return false;
00065   }

Vector BadGuy::get_start_position (  )  const [inline]

Definition at line 67 of file badguy.hpp.

References start_position.

Referenced by FlipLevelTransformer::transform_badguy().

00068   {
00069     return start_position;
00070   }

void BadGuy::set_start_position ( const Vector vec  )  [inline]

Definition at line 72 of file badguy.hpp.

References start_position.

Referenced by FlipLevelTransformer::transform_badguy().

00073   {
00074     start_position = vec;
00075   }

void BadGuy::ignite (  )  [virtual]

Called when hit by a fire bullet, and is_flammable() returns true.

Definition at line 555 of file badguy.cpp.

References kill_fall().

Referenced by collision_bullet(), and collision_tile().

00556 {
00557   kill_fall();
00558 }

void BadGuy::extinguish (  )  [virtual]

Called to revert a badguy when is_ignited() returns true.

Definition at line 561 of file badguy.cpp.

Referenced by collision_bullet().

00562 {
00563 }

bool BadGuy::is_flammable (  )  const [virtual]

Returns whether to call ignite() when a badguy gets hit by a fire bullet.

Reimplemented in GhostTree, Root, TreeWillOWisp, and WillOWisp.

Definition at line 566 of file badguy.cpp.

Referenced by collision_bullet(), and collision_tile().

00567 {
00568   return true;
00569 }

bool BadGuy::is_ignited (  )  const

Returns whether this badguys is currently on fire.

Definition at line 572 of file badguy.cpp.

References ignited.

Referenced by collision_bullet().

00573 {
00574   return ignited;
00575 }

void BadGuy::freeze (  )  [virtual]

Called when hit by an ice bullet, and is_freezable() returns true.

Reimplemented in Dispenser, Fish, Haywire, Jumpy, MrBomb, Spiky, SSpiky, and WalkingBadguy.

Definition at line 529 of file badguy.cpp.

References COLGROUP_MOVING_STATIC, frozen, and MovingObject::set_group().

Referenced by collision_bullet(), collision_tile(), WalkingBadguy::freeze(), Jumpy::freeze(), Fish::freeze(), and Dispenser::freeze().

00530 {
00531   set_group(COLGROUP_MOVING_STATIC);
00532   frozen = true;
00533 }

void BadGuy::unfreeze (  )  [virtual]

Called to unfreeze the badguy.

Reimplemented in Dispenser, Fish, and WalkingBadguy.

Definition at line 536 of file badguy.cpp.

References colgroup_active, frozen, and MovingObject::set_group().

Referenced by collision_bullet(), collision_player(), WalkingBadguy::unfreeze(), Fish::unfreeze(), and Dispenser::unfreeze().

00537 {
00538   set_group(colgroup_active);
00539   frozen = false;
00540 }

bool BadGuy::is_freezable (  )  const [virtual]

Reimplemented in Dispenser, Fish, GhostTree, Haywire, Jumpy, MrBomb, Root, Spiky, SSpiky, TreeWillOWisp, and WillOWisp.

Definition at line 543 of file badguy.cpp.

Referenced by collision_bullet(), and collision_tile().

00544 {
00545   return false;
00546 }

bool BadGuy::is_frozen (  )  const

Definition at line 549 of file badguy.cpp.

References frozen.

Referenced by collision_bullet().

00550 {
00551   return frozen;
00552 }

HitResponse BadGuy::collision_player ( Player player,
const CollisionHit hit 
) [protected, virtual]

Called when the badguy collided with a player.

Reimplemented in Bomb, Dart, DartTrap, Haywire, KamikazeSnowball, Kugelblitz, MoleRock, MrBomb, MrIceBlock, ShortFuse, SkyDive, Snail, Stalactite, TreeWillOWisp, and WillOWisp.

Definition at line 285 of file badguy.cpp.

References ABORT_MOVE, FORCE_MOVE, frozen, Player::is_invincible(), Player::kill(), kill_fall(), and unfreeze().

Referenced by collision(), TreeWillOWisp::collision_player(), Snail::collision_player(), MrIceBlock::collision_player(), MrBomb::collision_player(), MoleRock::collision_player(), KamikazeSnowball::collision_player(), Haywire::collision_player(), and Dart::collision_player().

00286 {
00287   if(player.is_invincible()) {
00288     kill_fall();
00289     return ABORT_MOVE;
00290   }
00291 
00292   if(frozen)
00293     unfreeze();
00294   player.kill(false);
00295   return FORCE_MOVE;
00296 }

void BadGuy::collision_solid ( const CollisionHit hit  )  [protected, virtual]

Called when the badguy collided with solid ground.

Reimplemented from MovingObject.

Reimplemented in AngryStone, Bomb, BouncingSnowball, CaptainSnowball, Dart, Fish, FlyingSnowBall, Jumpy, KamikazeSnowball, Kugelblitz, MoleRock, MrIceBlock, Owl, Plant, SkullyHop, SkyDive, Snail, SpiderMite, SSpiky, Stalactite, Stumpy, Toad, Totem, WalkingBadguy, Yeti, and Zeekling.

Definition at line 277 of file badguy.cpp.

References physic, Physic::set_velocity_x(), Physic::set_velocity_y(), and update_on_ground_flag().

Referenced by Toad::collision_solid(), SSpiky::collision_solid(), and SkullyHop::collision_solid().

00278 {
00279   physic.set_velocity_x(0);
00280   physic.set_velocity_y(0);
00281   update_on_ground_flag(hit);
00282 }

HitResponse BadGuy::collision_badguy ( BadGuy other,
const CollisionHit hit 
) [protected, virtual]

Called when the badguy collided with another badguy.

Reimplemented in AngryStone, Bomb, BouncingSnowball, Dart, Fish, Jumpy, Kugelblitz, Mole, MoleRock, MrIceBlock, Plant, SkullyHop, SkyDive, Snail, SSpiky, Stalactite, Stumpy, Toad, Totem, and WalkingBadguy.

Definition at line 299 of file badguy.cpp.

References FORCE_MOVE.

Referenced by collision(), Stalactite::collision_badguy(), and SSpiky::collision_badguy().

00300 {
00301   return FORCE_MOVE;
00302 }

bool BadGuy::collision_squished ( GameObject object  )  [protected, virtual]

Called when the player hit the badguy from above.

You should return true if the badguy was squished, false if squishing wasn't possible

Reimplemented in BouncingSnowball, CaptainSnowball, Crystallo, Dispenser, FlyingSnowBall, Haywire, Igel, KamikazeSnowball, Mole, MrBomb, MrIceBlock, MrTree, Owl, PoisonIvy, ShortFuse, SkullyHop, SkyDive, SmartBall, Snail, SnowBall, Snowman, SpiderMite, Stumpy, Toad, Totem, WalkingLeaf, Yeti, and Zeekling.

Definition at line 305 of file badguy.cpp.

Referenced by collision(), and Kugelblitz::collision_player().

00306 {
00307   return false;
00308 }

HitResponse BadGuy::collision_bullet ( Bullet bullet,
const CollisionHit hit 
) [protected, virtual]

Called when the badguy collided with a bullet.

Reimplemented in Igel.

Definition at line 311 of file badguy.cpp.

References ABORT_MOVE, extinguish(), FIRE_BONUS, FORCE_MOVE, freeze(), Bullet::get_type(), ICE_BONUS, ignite(), is_flammable(), is_freezable(), is_frozen(), is_ignited(), GameObject::remove_me(), Bullet::ricochet(), and unfreeze().

Referenced by Dispenser::collision(), collision(), and Igel::collision_bullet().

00312 {
00313   if (is_frozen()) {
00314     if(bullet.get_type() == FIRE_BONUS) {
00315       // fire bullet thaws frozen badguys
00316       unfreeze();
00317       bullet.remove_me();
00318       return ABORT_MOVE;
00319     } else {
00320       // other bullets ricochet
00321       bullet.ricochet(*this, hit);
00322       return FORCE_MOVE;
00323     }
00324   }
00325   else if (is_ignited()) {
00326     if(bullet.get_type() == ICE_BONUS) {
00327       // ice bullets extinguish ignited badguys
00328       extinguish();
00329       bullet.remove_me();
00330       return ABORT_MOVE;
00331     } else {
00332       // other bullets are absorbed by ignited badguys
00333       bullet.remove_me();
00334       return FORCE_MOVE;
00335     }
00336   }
00337   else if(bullet.get_type() == FIRE_BONUS && is_flammable()) {
00338     // fire bullets ignite flammable badguys
00339     ignite();
00340     bullet.remove_me();
00341     return ABORT_MOVE;
00342   }
00343   else if(bullet.get_type() == ICE_BONUS && is_freezable()) {
00344     // ice bullets freeze freezable badguys
00345     freeze();
00346     bullet.remove_me();
00347     return ABORT_MOVE;
00348   }
00349   else {
00350     // in all other cases, bullets ricochet
00351     bullet.ricochet(*this, hit);
00352     return FORCE_MOVE;
00353   }
00354 }

void BadGuy::active_update ( float  elapsed_time  )  [protected, virtual]

called each frame when the badguy is activated.

Reimplemented in AngryStone, Bomb, CaptainSnowball, Crystallo, Dart, DartTrap, Dispenser, Fish, Flame, FlyingSnowBall, GhostTree, Haywire, Igel, Jumpy, Kugelblitz, Mole, MoleRock, MrBomb, MrIceBlock, Owl, Plant, Root, SkullyHop, SkyDive, Snail, SpiderMite, SSpiky, Stalactite, Stumpy, Toad, Totem, TreeWillOWisp, WalkingBadguy, WillOWisp, Yeti, YetiStalactite, and Zeekling.

Definition at line 209 of file badguy.cpp.

References Physic::get_movement(), MovingObject::movement, and physic.

Referenced by Zeekling::active_update(), WalkingBadguy::active_update(), Totem::active_update(), Toad::active_update(), Stumpy::active_update(), SSpiky::active_update(), Snail::active_update(), SkullyHop::active_update(), Root::active_update(), Plant::active_update(), Owl::active_update(), MrIceBlock::active_update(), MoleRock::active_update(), Mole::active_update(), Kugelblitz::active_update(), Jumpy::active_update(), Igel::active_update(), Fish::active_update(), Dart::active_update(), Crystallo::active_update(), AngryStone::active_update(), and update().

00210 {
00211   movement = physic.get_movement(elapsed_time);
00212 }

void BadGuy::inactive_update ( float  elapsed_time  )  [protected, virtual]

called each frame when the badguy is not activated.

Definition at line 215 of file badguy.cpp.

Referenced by update().

00216 {
00217 }

void BadGuy::initialize (  )  [protected, virtual]

called immediately before the first call to initialize

Reimplemented in BouncingSnowball, Dart, DartTrap, FlyingSnowBall, KamikazeSnowball, Kugelblitz, MoleRock, MrIceBlock, Owl, Plant, SkullyHop, Snail, SpiderMite, SSpiky, Stumpy, Toad, Totem, WalkingBadguy, Yeti, and Zeekling.

Definition at line 194 of file badguy.cpp.

Referenced by try_activate().

00195 {
00196 }

void BadGuy::activate (  )  [protected, virtual]

called when the badguy has been activated.

(As a side effect the dir variable might have been changed so that it faces towards the player.

Reimplemented in Dart, DartTrap, Dispenser, Flame, FlyingSnowBall, GhostTree, Mole, TreeWillOWisp, and WillOWisp.

Definition at line 199 of file badguy.cpp.

Referenced by Kugelblitz::try_activate(), and try_activate().

00200 {
00201 }

void BadGuy::deactivate (  )  [protected, virtual]

called when the badguy has been deactivated

Reimplemented in Dart, Dispenser, Flame, MoleRock, Root, Stalactite, and WillOWisp.

Definition at line 204 of file badguy.cpp.

Referenced by update().

00205 {
00206 }

void BadGuy::kill_squished ( GameObject object  )  [protected]

Reimplemented in Yeti.

Definition at line 357 of file badguy.cpp.

References Player::bounce(), COLGROUP_MOVING_ONLY_STATIC, Physic::enable_gravity(), MovingObject::get_pos(), physic, SoundManager::play(), run_dead_script(), MovingObject::set_group(), set_state(), Physic::set_velocity_x(), Physic::set_velocity_y(), sound_manager, and STATE_SQUISHED.

Referenced by Zeekling::collision_squished(), WalkingLeaf::collision_squished(), Totem::collision_squished(), Toad::collision_squished(), Stumpy::collision_squished(), SpiderMite::collision_squished(), SnowBall::collision_squished(), SmartBall::collision_squished(), SkullyHop::collision_squished(), PoisonIvy::collision_squished(), MrBomb::collision_squished(), KamikazeSnowball::collision_squished(), FlyingSnowBall::collision_squished(), Crystallo::collision_squished(), CaptainSnowball::collision_squished(), and BouncingSnowball::collision_squished().

00358 {
00359   sound_manager->play("sounds/squish.wav", get_pos());
00360   physic.enable_gravity(true);
00361   physic.set_velocity_x(0);
00362   physic.set_velocity_y(0);
00363   set_state(STATE_SQUISHED);
00364   set_group(COLGROUP_MOVING_ONLY_STATIC);
00365   Player* player = dynamic_cast<Player*>(&object);
00366   if (player) {
00367     player->bounce(*this);
00368   }
00369 
00370   // start dead-script
00371   run_dead_script();
00372 }

void BadGuy::set_state ( State  state  )  [protected]

Definition at line 403 of file badguy.cpp.

References colgroup_active, COLGROUP_DISABLED, GameObject::remove_me(), MovingObject::set_group(), SQUISH_TIME, Timer::start(), STATE_ACTIVE, STATE_FALLING, STATE_INACTIVE, STATE_SQUISHED, and state_timer.

Referenced by Snowman::collision_squished(), KamikazeSnowball::kill_collision(), kill_fall(), kill_squished(), Stalactite::squish(), Kugelblitz::try_activate(), try_activate(), YetiStalactite::update(), and update().

00404 {
00405   if(this->state == state)
00406     return;
00407 
00408   State laststate = this->state;
00409   this->state = state;
00410   switch(state) {
00411     case STATE_SQUISHED:
00412       state_timer.start(SQUISH_TIME);
00413       break;
00414     case STATE_ACTIVE:
00415       set_group(colgroup_active);
00416       //bbox.set_pos(start_position);
00417       break;
00418     case STATE_INACTIVE:
00419       // was the badguy dead anyway?
00420       if(laststate == STATE_SQUISHED || laststate == STATE_FALLING) {
00421         remove_me();
00422       }
00423       set_group(COLGROUP_DISABLED);
00424       break;
00425     case STATE_FALLING:
00426       set_group(COLGROUP_DISABLED);
00427       break;
00428     default:
00429       break;
00430   }
00431 }

State BadGuy::get_state (  )  const [inline, protected]

Definition at line 146 of file badguy.hpp.

References state.

Referenced by MrIceBlock::collision_player(), Toad::collision_solid(), SkullyHop::collision_solid(), BouncingSnowball::collision_solid(), Stalactite::draw(), Fish::draw(), Jumpy::hit(), and YetiStalactite::update().

00147   { return state; }

bool BadGuy::check_state_timer (  )  [inline, protected]

Definition at line 149 of file badguy.hpp.

References Timer::check(), and state_timer.

Referenced by YetiStalactite::update().

00149                            {
00150     return state_timer.check();
00151   }

Player * BadGuy::get_nearest_player (  )  [protected]

returns a pointer to the nearest player or 0 if no player is available

Definition at line 496 of file badguy.cpp.

References Sector::current(), and Sector::get_nearest_player().

Referenced by Dispenser::activate(), WillOWisp::active_update(), Stalactite::active_update(), SSpiky::active_update(), SpiderMite::active_update(), Plant::active_update(), Jumpy::active_update(), Haywire::active_update(), GhostTree::active_update(), FlyingSnowBall::active_update(), Dispenser::active_update(), AngryStone::active_update(), Yeti::drop_stalactite(), is_offscreen(), Dispenser::launch_badguy(), Toad::set_state(), Zeekling::should_we_dive(), Kugelblitz::try_activate(), and try_activate().

00497 {
00498   return Sector::current()->get_nearest_player (this->get_bbox ());
00499 }

bool BadGuy::is_offscreen (  )  [protected]

initial position of the enemy.

Also the position where enemy respawns when after being deactivated.

Definition at line 434 of file badguy.cpp.

References MovingObject::get_bbox(), Rectf::get_middle(), get_nearest_player(), Vector::x, X_OFFSCREEN_DISTANCE, Vector::y, and Y_OFFSCREEN_DISTANCE.

Referenced by Dispenser::launch_badguy(), try_activate(), and update().

00435 {
00436   Player* player = get_nearest_player();
00437   if (!player) return false;
00438   Vector dist = player->get_bbox().get_middle() - get_bbox().get_middle();
00439   // In SuperTux 0.1.x, Badguys were activated when Tux<->Badguy center distance was approx. <= ~668px
00440   // This doesn't work for wide-screen monitors which give us a virt. res. of approx. 1066px x 600px
00441   if ((fabsf(dist.x) <= X_OFFSCREEN_DISTANCE) && (fabsf(dist.y) <= Y_OFFSCREEN_DISTANCE)) {
00442     return false;
00443   }
00444   return true;
00445 }

bool BadGuy::might_fall ( int  height = 1  )  [protected]

Returns true if we might soon fall at least height pixels.

Minimum value for height is 1 pixel

Definition at line 476 of file badguy.cpp.

References MovingObject::bbox, Sector::current(), dir, Sector::is_free_of_statics(), LEFT, Rectf::p1, Rectf::p2, Vector::x, and Vector::y.

Referenced by WalkingBadguy::active_update(), Totem::active_update(), and CaptainSnowball::active_update().

00477 {
00478   // make sure we check for at least a 1-pixel fall
00479   assert(height > 0);
00480 
00481   float x1;
00482   float x2;
00483   float y1 = bbox.p2.y + 1;
00484   float y2 = bbox.p2.y + 1 + height;
00485   if (dir == LEFT) {
00486     x1 = bbox.p1.x - 1;
00487     x2 = bbox.p1.x;
00488   } else {
00489     x1 = bbox.p2.x;
00490     x2 = bbox.p2.x + 1;
00491   }
00492   return Sector::current()->is_free_of_statics(Rectf(x1, y1, x2, y2));
00493 }

Direction BadGuy::str2dir ( std::string  dir_str  )  [protected]

Get Direction from String.

Definition at line 179 of file badguy.cpp.

References AUTO, LEFT, log_warning, and RIGHT.

Referenced by BadGuy().

00180 {
00181   if( dir_str == "auto" )
00182     return AUTO;
00183   if( dir_str == "left" )
00184     return LEFT;
00185   if( dir_str == "right" )
00186     return RIGHT;
00187 
00188   //default to "auto"
00189   log_warning << "Badguy::str2dir: unknown direction \"" << dir_str << "\"" << std::endl;;
00190   return AUTO;
00191 }

void BadGuy::update_on_ground_flag ( const CollisionHit hit  )  [protected]

Update on_ground_flag judging by solid collision hit.

This gets called from the base implementation of collision_solid, so call this when overriding collision_solid's default behaviour.

Definition at line 502 of file badguy.cpp.

References CollisionHit::bottom, floor_normal, on_ground_flag, and CollisionHit::slope_normal.

Referenced by WalkingBadguy::collision_solid(), Totem::collision_solid(), Stumpy::collision_solid(), Snail::collision_solid(), MrIceBlock::collision_solid(), Bomb::collision_solid(), and collision_solid().

00503 {
00504   if (hit.bottom) {
00505     on_ground_flag = true;
00506     floor_normal = hit.slope_normal;
00507   }
00508 }

bool BadGuy::on_ground (  )  [protected]

Returns true if we touched ground in the past frame This only works if update_on_ground_flag() gets called in collision_solid.

Definition at line 511 of file badguy.cpp.

References on_ground_flag.

Referenced by WalkingBadguy::active_update(), Totem::active_update(), CaptainSnowball::active_update(), and Snail::collision_squished().

00512 {
00513   return on_ground_flag;
00514 }

Vector BadGuy::get_floor_normal (  )  [protected]

Returns floor normal stored the last time when update_on_ground_flag was called and we touched something solid from above.

Definition at line 523 of file badguy.cpp.

References floor_normal.

00524 {
00525   return floor_normal;
00526 }

bool BadGuy::is_active (  )  [protected]

Returns true if we were in STATE_ACTIVE at the beginning of the last call to update().

Definition at line 517 of file badguy.cpp.

References is_active_flag.

Referenced by collision(), and CaptainSnowball::collision_solid().

00518 {
00519   return is_active_flag;
00520 }

void BadGuy::set_colgroup_active ( CollisionGroup  group  )  [protected]

changes colgroup_active.

Also calls set_group when badguy is in STATE_ACTIVE

Definition at line 578 of file badguy.cpp.

References colgroup_active, MovingObject::set_group(), state, and STATE_ACTIVE.

Referenced by Stalactite::active_update(), Dispenser::collision_squished(), DartTrap::DartTrap(), Dispenser::Dispenser(), Flame::Flame(), GhostTree::GhostTree(), SkyDive::grab(), MrIceBlock::grab(), MrBomb::grab(), Bomb::grab(), Fish::jump(), Root::Root(), Mole::set_state(), Stalactite::Stalactite(), Fish::start_waiting(), Yeti::take_hit(), TreeWillOWisp::TreeWillOWisp(), SkyDive::ungrab(), MrIceBlock::ungrab(), MrBomb::ungrab(), Bomb::ungrab(), YetiStalactite::update(), WillOWisp::vanish(), and TreeWillOWisp::vanish().

00579 {
00580   this->colgroup_active = group;
00581   if (state == STATE_ACTIVE) set_group(group); 
00582 }

void BadGuy::try_activate (  )  [private]

Reimplemented in Kugelblitz.

Definition at line 448 of file badguy.cpp.

References activate(), AUTO, dir, MovingObject::get_bbox(), get_nearest_player(), initialize(), is_initialized, is_offscreen(), LEFT, Rectf::p1, Rectf::p2, RIGHT, set_state(), start_dir, STATE_ACTIVE, and Vector::x.

Referenced by update().

00449 {
00450   // Don't activate if player is dying
00451   Player* player = get_nearest_player();
00452   if (!player) return;
00453 
00454   if (!is_offscreen()) {
00455     set_state(STATE_ACTIVE);
00456     if (!is_initialized) {
00457 
00458       // if starting direction was set to AUTO, this is our chance to re-orient the badguy
00459       if (start_dir == AUTO) {
00460         Player* player = get_nearest_player();
00461         if (player && (player->get_bbox().p1.x > get_bbox().p2.x)) {
00462           dir = RIGHT;
00463         } else {
00464           dir = LEFT;
00465         }
00466       }
00467 
00468       initialize();
00469       is_initialized = true;
00470     }
00471     activate();
00472   }
00473 }

BadGuy& BadGuy::operator= ( const BadGuy  )  [private]


Member Data Documentation

Physic BadGuy::physic [protected]

Definition at line 194 of file badguy.hpp.

Referenced by Zeekling::active_update(), Yeti::active_update(), WalkingBadguy::active_update(), Totem::active_update(), Toad::active_update(), Stalactite::active_update(), SpiderMite::active_update(), Snail::active_update(), SkyDive::active_update(), Plant::active_update(), Kugelblitz::active_update(), FlyingSnowBall::active_update(), Fish::active_update(), CaptainSnowball::active_update(), Bomb::active_update(), active_update(), AngryStone::active_update(), WalkingBadguy::add_velocity(), AngryStone::AngryStone(), Yeti::be_angry(), Snail::be_flat(), Snail::be_kicked(), CaptainSnowball::CaptainSnowball(), Stumpy::collision_badguy(), Plant::collision_badguy(), Yeti::collision_solid(), WalkingBadguy::collision_solid(), Totem::collision_solid(), Toad::collision_solid(), Stumpy::collision_solid(), Stalactite::collision_solid(), SpiderMite::collision_solid(), Snail::collision_solid(), SkyDive::collision_solid(), SkullyHop::collision_solid(), Plant::collision_solid(), Owl::collision_solid(), MrIceBlock::collision_solid(), KamikazeSnowball::collision_solid(), FlyingSnowBall::collision_solid(), CaptainSnowball::collision_solid(), BouncingSnowball::collision_solid(), Bomb::collision_solid(), collision_solid(), AngryStone::collision_solid(), Snowman::collision_squished(), Haywire::collision_squished(), FlyingSnowBall::collision_squished(), Fish::collision_tile(), Dart::Dart(), Fish::Fish(), FlyingSnowBall::FlyingSnowBall(), WalkingBadguy::freeze(), Jumpy::freeze(), Fish::freeze(), WalkingBadguy::get_velocity_y(), SkyDive::grab(), Kugelblitz::hit(), Jumpy::hit(), Fish::hit(), Zeekling::initialize(), WalkingBadguy::initialize(), Totem::initialize(), Stumpy::initialize(), SSpiky::initialize(), SpiderMite::initialize(), Plant::initialize(), Owl::initialize(), MoleRock::initialize(), Kugelblitz::initialize(), KamikazeSnowball::initialize(), Dart::initialize(), BouncingSnowball::initialize(), Fish::jump(), Yeti::jump_down(), Totem::jump_off(), Yeti::jump_up(), KamikazeSnowball::kill_collision(), kill_fall(), kill_squished(), Kugelblitz::Kugelblitz(), Mole::Mole(), MoleRock::MoleRock(), Zeekling::onBumpHorizontal(), Zeekling::onBumpVertical(), Root::Root(), Yeti::run(), Toad::set_state(), SkullyHop::set_state(), MrIceBlock::set_state(), WalkingBadguy::set_velocity_y(), SpiderMite::SpiderMite(), Stalactite::squish(), YetiStalactite::start_shaking(), Fish::start_waiting(), Totem::synchronize_with(), Yeti::take_hit(), WalkingBadguy::turn_around(), SkyDive::ungrab(), update(), and Zeekling::Zeekling().

bool BadGuy::countMe

Count this badguy to the statistics? This value should not be changed during runtime.

Definition at line 199 of file badguy.hpp.

Referenced by Bomb::Bomb(), MrTree::collision_squished(), Dart::Dart(), DartTrap::DartTrap(), Dispenser::Dispenser(), Flame::Flame(), Kugelblitz::Kugelblitz(), MoleRock::MoleRock(), run_dead_script(), Stalactite::Stalactite(), WillOWisp::WillOWisp(), and Yeti::Yeti().

bool BadGuy::is_initialized [protected]

true if initialize() has already been called

Definition at line 203 of file badguy.hpp.

Referenced by Kugelblitz::try_activate(), and try_activate().

Vector BadGuy::start_position [protected]

Definition at line 205 of file badguy.hpp.

Referenced by Zeekling::active_update(), TreeWillOWisp::active_update(), Root::active_update(), FlyingSnowBall::active_update(), Flame::active_update(), Crystallo::active_update(), BadGuy(), Root::draw(), Flame::Flame(), get_start_position(), Kugelblitz::Kugelblitz(), set_start_position(), and YetiStalactite::update().

Direction BadGuy::dir [protected]

The direction we currently face in.

Definition at line 208 of file badguy.hpp.

Referenced by Dispenser::activate(), Zeekling::active_update(), Yeti::active_update(), WillOWisp::active_update(), WalkingBadguy::active_update(), TreeWillOWisp::active_update(), Totem::active_update(), SSpiky::active_update(), SpiderMite::active_update(), Snail::active_update(), Plant::active_update(), Owl::active_update(), Jumpy::active_update(), GhostTree::active_update(), FlyingSnowBall::active_update(), Dispenser::active_update(), Crystallo::active_update(), CaptainSnowball::active_update(), BadGuy(), Yeti::be_angry(), Snail::be_flat(), Snail::be_kicked(), Igel::can_see(), WalkingBadguy::collision_badguy(), Totem::collision_badguy(), Plant::collision_badguy(), Igel::collision_bullet(), Snail::collision_player(), MrIceBlock::collision_player(), Yeti::collision_solid(), WalkingBadguy::collision_solid(), Totem::collision_solid(), Snail::collision_solid(), SkullyHop::collision_solid(), Plant::collision_solid(), Owl::collision_solid(), MrIceBlock::collision_solid(), CaptainSnowball::collision_solid(), BouncingSnowball::collision_solid(), Zeekling::collision_squished(), WalkingLeaf::collision_squished(), Totem::collision_squished(), Toad::collision_squished(), Stumpy::collision_squished(), SpiderMite::collision_squished(), Snowman::collision_squished(), SnowBall::collision_squished(), Snail::collision_squished(), SmartBall::collision_squished(), SkullyHop::collision_squished(), PoisonIvy::collision_squished(), Owl::collision_squished(), MrTree::collision_squished(), MrIceBlock::collision_squished(), MrBomb::collision_squished(), KamikazeSnowball::collision_squished(), Haywire::collision_squished(), FlyingSnowBall::collision_squished(), Dispenser::collision_squished(), Crystallo::collision_squished(), CaptainSnowball::collision_squished(), Dispenser::Dispenser(), DartTrap::fire(), SSpiky::freeze(), Spiky::freeze(), MrBomb::freeze(), Jumpy::freeze(), Haywire::freeze(), Zeekling::initialize(), Yeti::initialize(), WalkingBadguy::initialize(), Totem::initialize(), Toad::initialize(), Stumpy::initialize(), SSpiky::initialize(), SpiderMite::initialize(), SkullyHop::initialize(), Plant::initialize(), Owl::initialize(), KamikazeSnowball::initialize(), FlyingSnowBall::initialize(), DartTrap::initialize(), Dart::initialize(), BouncingSnowball::initialize(), Owl::is_above_player(), Yeti::jump_down(), Yeti::jump_up(), KamikazeSnowball::KamikazeSnowball(), KamikazeSnowball::kill_collision(), Dispenser::launch_badguy(), DartTrap::load(), CaptainSnowball::might_climb(), might_fall(), Zeekling::onBumpHorizontal(), Zeekling::onBumpVertical(), Owl::Owl(), Yeti::run(), Toad::set_state(), SkullyHop::set_state(), MrIceBlock::set_state(), Totem::synchronize_with(), Kugelblitz::try_activate(), try_activate(), and WalkingBadguy::turn_around().

Direction BadGuy::start_dir [protected]

The direction we initially faced in.

Definition at line 211 of file badguy.hpp.

Referenced by BadGuy(), DartTrap::DartTrap(), Dispenser::Dispenser(), Dispenser::launch_badguy(), Kugelblitz::try_activate(), and try_activate().

bool BadGuy::frozen [protected]

Definition at line 213 of file badguy.hpp.

Referenced by WalkingBadguy::active_update(), Jumpy::active_update(), Fish::active_update(), Dispenser::collision(), collision_player(), Fish::collision_tile(), freeze(), MrBomb::grab(), Jumpy::hit(), WalkingBadguy::initialize(), is_frozen(), MrBomb::is_portable(), WalkingBadguy::turn_around(), and unfreeze().

bool BadGuy::ignited [protected]

true if this badguy is currently on fire

Definition at line 214 of file badguy.hpp.

Referenced by is_ignited().

std::string BadGuy::dead_script [protected]

script to execute when badguy is killed

Definition at line 216 of file badguy.hpp.

Referenced by BadGuy(), and run_dead_script().

State BadGuy::state [private]

Reimplemented in AngryStone, Bomb, DartTrap, Kugelblitz, Mole, Plant, SkullyHop, Snail, SSpiky, Stalactite, Toad, Yeti, and Zeekling.

Definition at line 219 of file badguy.hpp.

Referenced by draw(), get_state(), set_colgroup_active(), and update().

bool BadGuy::is_active_flag [private]

true if state was STATE_ACTIVE at the beginning of the last call to update()

Definition at line 223 of file badguy.hpp.

Referenced by is_active(), and update().

Timer BadGuy::state_timer [private]

Reimplemented in Yeti.

Definition at line 225 of file badguy.hpp.

Referenced by check_state_timer(), set_state(), and update().

bool BadGuy::on_ground_flag [private]

true if we touched something solid from above and update_on_ground_flag was called last frame

Definition at line 229 of file badguy.hpp.

Referenced by on_ground(), update(), and update_on_ground_flag().

Vector BadGuy::floor_normal [private]

floor normal stored the last time when update_on_ground_flag was called and we touched something solid from above

Definition at line 233 of file badguy.hpp.

Referenced by get_floor_normal(), and update_on_ground_flag().

CollisionGroup BadGuy::colgroup_active [private]

CollisionGroup the badguy should be in while active.

Definition at line 236 of file badguy.hpp.

Referenced by set_colgroup_active(), set_state(), and unfreeze().


The documentation for this class was generated from the following files:
Generated on Mon Jun 9 03:38:28 2014 for SuperTux by  doxygen 1.5.1