#include "spidermite.hpp"
-static const float FLYTIME = 1.2;
-static const float FLYSPEED = -100.0;
+static const float FLYTIME = 1.2f;
+static const float FLYSPEED = -100.0f;
SpiderMite::SpiderMite(const lisp::Lisp& reader)
- : BadGuy(reader, "images/creatures/spidermite/spidermite.sprite")
+ : BadGuy(reader, "images/creatures/spidermite/spidermite.sprite")
{
- physic.gravity_enabled = false;
+ physic.enable_gravity(false);
}
SpiderMite::SpiderMite(const Vector& pos)
- : BadGuy(pos, "images/creatures/spidermite/spidermite.sprite")
+ : BadGuy(pos, "images/creatures/spidermite/spidermite.sprite")
{
- physic.gravity_enabled = false;
+ physic.enable_gravity(false);
}
void
}
void
-SpiderMite::activate()
+SpiderMite::initialize()
{
sprite->set_action(dir == LEFT ? "left" : "right");
mode = FLY_UP;
- physic.vy = FLYSPEED;
+ physic.set_velocity_y(FLYSPEED);
timer.start(FLYTIME/2);
}
SpiderMite::collision_solid(const CollisionHit& hit)
{
if(hit.top || hit.bottom) { // hit floor or roof?
- physic.vy = 0;
+ physic.set_velocity_y(0);
}
}
if(timer.check()) {
if(mode == FLY_UP) {
mode = FLY_DOWN;
- physic.vy = -FLYSPEED;
+ physic.set_velocity_y(-FLYSPEED);
} else if(mode == FLY_DOWN) {
mode = FLY_UP;
- physic.vy = FLYSPEED;
+ physic.set_velocity_y(FLYSPEED);
}
timer.start(FLYTIME);
}