YetiStalactite Class Reference

#include <yeti_stalactite.hpp>

Inherits Stalactite.

List of all members.

Public Member Functions

 YetiStalactite (const Reader &lisp)
virtual ~YetiStalactite ()
void active_update (float elapsed_time)
 called each frame when the badguy is activated.
void start_shaking ()
bool is_hanging ()
void update (float elapsed_time)
 Called each frame.


Detailed Description

Definition at line 22 of file yeti_stalactite.hpp.


Constructor & Destructor Documentation

YetiStalactite::YetiStalactite ( const Reader lisp  ) 

Definition at line 24 of file yeti_stalactite.cpp.

00025   : Stalactite(lisp)
00026 {
00027 }

YetiStalactite::~YetiStalactite (  )  [virtual]

Definition at line 29 of file yeti_stalactite.cpp.

00030 {
00031 }


Member Function Documentation

void YetiStalactite::active_update ( float  elapsed_time  )  [virtual]

called each frame when the badguy is activated.

Reimplemented from Stalactite.

Definition at line 50 of file yeti_stalactite.cpp.

References Stalactite::active_update(), Stalactite::STALACTITE_HANGING, and Stalactite::state.

00051 {
00052   if(state == STALACTITE_HANGING)
00053     return;
00054 
00055   Stalactite::active_update(elapsed_time);
00056 }

void YetiStalactite::start_shaking (  ) 

Definition at line 34 of file yeti_stalactite.cpp.

References MovingObject::get_pos(), BadGuy::physic, Physic::set_velocity_y(), Stalactite::STALACTITE_SHAKING, Timer::start(), Stalactite::state, Stalactite::timer, and YT_SHAKE_TIME.

00035 {
00036   timer.start(YT_SHAKE_TIME);
00037   state = STALACTITE_SHAKING;
00038   if(((int)get_pos().x / 32) % 2 == 0) {
00039     physic.set_velocity_y(100);
00040   }
00041 }

bool YetiStalactite::is_hanging (  ) 

Definition at line 44 of file yeti_stalactite.cpp.

References Stalactite::STALACTITE_HANGING, and Stalactite::state.

00045 {
00046   return state == STALACTITE_HANGING;
00047 }

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

Called each frame.

The default implementation checks badguy state and calls active_update and inactive_update

Reimplemented from BadGuy.

Definition at line 59 of file yeti_stalactite.cpp.

References BadGuy::check_state_timer(), COLGROUP_TOUCHABLE, BadGuy::get_state(), BadGuy::set_colgroup_active(), MovingObject::set_pos(), BadGuy::set_state(), MovingSprite::sprite, Stalactite::STALACTITE_HANGING, BadGuy::start_position, Stalactite::state, BadGuy::STATE_ACTIVE, BadGuy::STATE_SQUISHED, and BadGuy::update().

00060 {
00061   // Respawn instead of removing once squished
00062   if(get_state() == STATE_SQUISHED && check_state_timer()) {
00063     set_state(STATE_ACTIVE);
00064     state = STALACTITE_HANGING;
00065     // Hopefully we shouldn't come into contact with anything...
00066     sprite->set_action("normal");
00067     set_pos(start_position);
00068     set_colgroup_active(COLGROUP_TOUCHABLE);
00069   }
00070 
00071   // Call back to badguy to do normal stuff
00072   BadGuy::update(elapsed_time);
00073 }


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