PoisonIvy Class Reference

#include <poisonivy.hpp>

Inherits WalkingBadguy.

List of all members.

Public Member Functions

 PoisonIvy (const Reader &reader)
 PoisonIvy (const Vector &pos, Direction d)

Protected Member Functions

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


Detailed Description

Definition at line 22 of file poisonivy.hpp.


Constructor & Destructor Documentation

PoisonIvy::PoisonIvy ( const Reader reader  ) 

Definition at line 25 of file poisonivy.cpp.

References WalkingBadguy::walk_speed.

00026   : WalkingBadguy(reader, "images/creatures/poison_ivy/poison_ivy.sprite", "left", "right")
00027 {
00028   walk_speed = 80;
00029 }

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

Definition at line 31 of file poisonivy.cpp.

References WalkingBadguy::walk_speed.

00032   : WalkingBadguy(pos, d, "images/creatures/poison_ivy/poison_ivy.sprite", "left", "right")
00033 {
00034   walk_speed = 80;
00035 }


Member Function Documentation

bool PoisonIvy::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 38 of file poisonivy.cpp.

References Sector::add_object(), ANCHOR_MIDDLE, MovingObject::bbox, Sector::current(), BadGuy::dir, Rectf::get_middle(), graphicsRandom, BadGuy::kill_squished(), LAYER_OBJECTS, LEFT, RandomGenerator::randf(), and MovingSprite::sprite.

00039 {
00040   sprite->set_action(dir == LEFT ? "squished-left" : "squished-right");
00041   // spawn some particles
00042   // TODO: provide convenience function in MovingSprite or MovingObject?
00043   for (int i = 0; i < 3; i++) {
00044     Vector ppos = bbox.get_middle();
00045     float angle = graphicsRandom.randf(-M_PI_2, M_PI_2);
00046     float velocity = graphicsRandom.randf(350, 400);
00047     float vx = sin(angle)*velocity;
00048     float vy = -cos(angle)*velocity;
00049     Vector pspeed = Vector(vx, vy);
00050     Vector paccel = Vector(0, 100);
00051     Sector::current()->add_object(new SpriteParticle("images/objects/particles/poisonivy.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS-1));
00052   }
00053   kill_squished(object);
00054   return true;
00055 }


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