Crystallo Class Reference

#include <crystallo.hpp>

Inherits WalkingBadguy.

List of all members.

Public Member Functions

 Crystallo (const Reader &reader)
 Crystallo (const Vector &pos, Direction d)
void active_update (float elapsed_time)
 called each frame when the badguy is activated.

Protected Member Functions

bool collision_squished (GameObject &object)
 Called when the player hit the badguy from above.

Private Attributes

float radius


Detailed Description

Definition at line 25 of file crystallo.hpp.


Constructor & Destructor Documentation

Crystallo::Crystallo ( const Reader reader  ) 

Definition at line 24 of file crystallo.cpp.

References lisp::Lisp::get(), WalkingBadguy::max_drop_height, radius, and WalkingBadguy::walk_speed.

00024                                          :
00025   WalkingBadguy(reader, "images/creatures/crystallo/crystallo.sprite", "left", "right"),
00026   radius()
00027 {
00028   walk_speed = 80;
00029   max_drop_height = 16;
00030   radius = 100;
00031   reader.get("radius", radius);
00032 }

Crystallo::Crystallo ( const Vector pos,
Direction  d 
)

Definition at line 34 of file crystallo.cpp.

References WalkingBadguy::max_drop_height, radius, and WalkingBadguy::walk_speed.

00034                                                    :
00035   WalkingBadguy(pos, d, "images/creatures/crystallo/crystallo.sprite", "left", "right"),
00036   radius()
00037 {
00038   walk_speed = 80;
00039   max_drop_height = 16;
00040   radius = 100;
00041 }


Member Function Documentation

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

called each frame when the badguy is activated.

Reimplemented from WalkingBadguy.

Definition at line 44 of file crystallo.cpp.

References BadGuy::active_update(), BadGuy::dir, MovingObject::get_pos(), LEFT, radius, RIGHT, BadGuy::start_position, WalkingBadguy::turn_around(), and Vector::x.

00045 {
00046   if(get_pos().x > (start_position.x + radius)){
00047     if(dir != LEFT){
00048       turn_around();
00049     }
00050   }
00051   if( get_pos().x < (start_position.x - radius)){
00052     if(dir != RIGHT){
00053       turn_around();
00054     }
00055   }
00056   BadGuy::active_update(elapsed_time);
00057 }

bool Crystallo::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 from BadGuy.

Definition at line 60 of file crystallo.cpp.

References ANCHOR_BOTTOM, BadGuy::dir, BadGuy::kill_squished(), LEFT, and MovingSprite::set_action().

00061 {
00062   this->set_action(dir == LEFT ? "shattered-left" : "shattered-right", /* loops = */ -1, ANCHOR_BOTTOM);
00063   kill_squished(object);
00064   return true;
00065 }


Member Data Documentation

float Crystallo::radius [private]

Definition at line 37 of file crystallo.hpp.

Referenced by active_update(), and Crystallo().


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