4 #include "special/sprite.h"
5 #include "special/sprite_manager.h"
6 #include "lisp/writer.h"
7 #include "video/drawing_context.h"
10 Rock::Rock(const lisp::Lisp& reader)
12 reader.get("x", bbox.p1.x);
13 reader.get("y", bbox.p1.y);
14 bbox.set_size(31.8, 31.8);
15 sprite = sprite_manager->create("rock");
26 Rock::write(lisp::Writer& writer)
28 writer.start_list("rock");
30 writer.write_float("x", bbox.p1.x);
31 writer.write_float("y", bbox.p1.y);
33 writer.end_list("rock");
37 Rock::draw(DrawingContext& context)
40 sprite->draw(context, get_pos(), LAYER_OBJECTS);
44 Rock::action(float elapsed_time)
48 flags &= ~FLAG_NO_COLLDET;
49 movement = physic.get_movement(elapsed_time);
51 physic.set_velocity(0, 0);
53 flags |= FLAG_NO_COLLDET;
60 Rock::collision(GameObject& , const CollisionHit& )
65 physic.set_velocity(0, 0);
70 Rock::grab(MovingObject& , const Vector& pos)
72 movement = pos - get_pos();