4 #include "special/sprite.h"
5 #include "special/sprite_manager.h"
6 #include "lisp/writer.h"
7 #include "video/drawing_context.h"
9 #include "object_factory.h"
11 Rock::Rock(const lisp::Lisp& reader)
13 reader.get("x", bbox.p1.x);
14 reader.get("y", bbox.p1.y);
15 bbox.set_size(31.8, 31.8);
16 sprite = sprite_manager->create("rock");
27 Rock::write(lisp::Writer& writer)
29 writer.start_list("rock");
31 writer.write_float("x", bbox.p1.x);
32 writer.write_float("y", bbox.p1.y);
34 writer.end_list("rock");
38 Rock::draw(DrawingContext& context)
41 sprite->draw(context, get_pos(), LAYER_OBJECTS);
45 Rock::action(float elapsed_time)
49 flags &= ~FLAG_NO_COLLDET;
50 movement = physic.get_movement(elapsed_time);
52 physic.set_velocity(0, 0);
54 flags |= FLAG_NO_COLLDET;
61 Rock::collision(GameObject& , const CollisionHit& )
66 physic.set_velocity(0, 0);
71 Rock::grab(MovingObject& , const Vector& pos)
73 movement = pos - get_pos();
77 IMPLEMENT_FACTORY(Rock, "rock")