5 static const float JUMPSPEED=600;
7 Jumpy::Jumpy(const lisp::Lisp& reader)
9 reader.get("x", start_position.x);
10 reader.get("y", start_position.y);
11 bbox.set_size(31.8, 31.8);
12 sprite = sprite_manager->create("jumpy");
16 Jumpy::write(lisp::Writer& writer)
18 writer.start_list("jumpy");
20 writer.write_float("x", start_position.x);
21 writer.write_float("y", start_position.y);
23 writer.end_list("jumpy");
27 Jumpy::collision_solid(GameObject& , const CollisionHit& chit)
33 Jumpy::collision_badguy(BadGuy& , const CollisionHit& chit)
39 Jumpy::hit(const CollisionHit& chit)
42 if(chit.normal.y < -.5) {
43 physic.set_velocity_y(JUMPSPEED);
44 } else if(chit.normal.y < .5) { // bumped on roof
45 physic.set_velocity_y(0);
52 Jumpy::active_action(float elapsed_time)
54 BadGuy::active_action(elapsed_time);
56 dir = Sector::current()->player->get_pos().x > get_pos().x
58 //FIXME: add middle and up here
59 sprite->set_action(dir == LEFT ? "left-down" : "right-down");
62 IMPLEMENT_FACTORY(Jumpy, "jumpy")