+
+void
+Jumpy::active_update(float elapsed_time)
+{
+ BadGuy::active_update(elapsed_time);
+
+ if(frozen)
+ return;
+
+ Player* player = this->get_nearest_player();
+ if (player)
+ {
+ dir = (player->get_pos().x > get_pos().x) ? RIGHT : LEFT;
+ }
+
+ if (!groundhit_pos_set)
+ {
+ sprite->set_action(dir == LEFT ? "left-middle" : "right-middle");
+ return;
+ }
+
+ if ( get_pos().y < (pos_groundhit.y - JUMPY_MID_TOLERANCE ) )
+ sprite->set_action(dir == LEFT ? "left-up" : "right-up");
+ else if ( get_pos().y >= (pos_groundhit.y - JUMPY_MID_TOLERANCE) &&
+ get_pos().y < (pos_groundhit.y - JUMPY_LOW_TOLERANCE) )
+ sprite->set_action(dir == LEFT ? "left-middle" : "right-middle");
+ else
+ sprite->set_action(dir == LEFT ? "left-down" : "right-down");
+}
+
+void
+Jumpy::freeze()
+{
+ BadGuy::freeze();
+ physic.set_velocity_y(std::max(0.0f, physic.get_velocity_y()));
+ sprite->set_action(dir == LEFT ? "left-iced" : "right-iced");
+}
+
+bool
+Jumpy::is_freezable() const
+{
+ return true;
+}
+
+IMPLEMENT_FACTORY(Jumpy, "jumpy");
+
+/* EOF */