static const float WALKSPEED = 80;
SSpiky::SSpiky(const lisp::Lisp& reader)
- : WalkingBadguy(reader, "images/creatures/spiky/sleepingspiky.sprite", "left", "right"), state(SSPIKY_SLEEPING)
+ : WalkingBadguy(reader, "images/creatures/spiky/sleepingspiky.sprite", "left", "right"), state(SSPIKY_SLEEPING)
{
walk_speed = WALKSPEED;
max_drop_height = -1;
}
void
-SSpiky::activate()
+SSpiky::initialize()
{
state = SSPIKY_SLEEPING;
physic.set_velocity_x(0);
return WalkingBadguy::collision_badguy(badguy, hit);
}
-void
+void
SSpiky::active_update(float elapsed_time) {
if(state == SSPIKY_WALKING) {
state = SSPIKY_WAKING;
}
}
-
+
BadGuy::active_update(elapsed_time);
}
if(sprite->animation_done()) {
// start walking
state = SSPIKY_WALKING;
- WalkingBadguy::activate();
+ WalkingBadguy::initialize();
}
BadGuy::active_update(elapsed_time);
}
}
+void
+SSpiky::freeze()
+{
+ WalkingBadguy::freeze();
+ sprite->set_action(dir == LEFT ? "iced-left" : "iced-right");
+ state = SSPIKY_WALKING; // if we get hit while sleeping, wake up :)
+}
+
+bool
+SSpiky::is_freezable() const
+{
+ return true;
+}
+
IMPLEMENT_FACTORY(SSpiky, "sspiky")