#include <poisonivy.hpp>
Inherits WalkingBadguy.
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. |
Definition at line 22 of file poisonivy.hpp.
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 }
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 }
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 }