4 #include "video/drawing_context.h"
7 #include "special/sprite_manager.h"
9 #include "lisp/writer.h"
10 #include "object_factory.h"
12 Platform::Platform(const lisp::Lisp& reader)
14 sprite = sprite_manager->create("flying_platform");
15 movement = Vector(0, 1);
16 reader.get("x", bbox.p1.x);
17 reader.get("y", bbox.p1.y);
18 bbox.set_size(sprite->get_width(), sprite->get_height());
31 Platform::collision(GameObject& , const CollisionHit& )
34 if(typeid(object) == typeid(Player)) {
35 Player* player = (Player*) &object;
36 //player->movement += movement;
43 Platform::action(float )
45 // just some test code...
47 movement = Vector(0, 1);
52 movement = Vector(0, -1);
57 movement = Vector(1, 0);
62 movement = Vector(-1, 0);
67 movement = Vector(-1, 1);
74 Platform::draw(DrawingContext& context)
76 sprite->draw(context, get_pos(), LAYER_OBJECTS);
79 IMPLEMENT_FACTORY(Platform, "flying_platform");