4 // Copyright (C) 2005 Matthias Braun <matze@braunis.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 #include "platform.hpp"
24 #include "video/drawing_context.hpp"
25 #include "resources.hpp"
27 #include "sprite/sprite_manager.hpp"
28 #include "lisp/lisp.hpp"
29 #include "lisp/writer.hpp"
30 #include "object_factory.hpp"
32 Platform::Platform(const lisp::Lisp& reader)
34 sprite = sprite_manager->create("flying_platform");
35 movement = Vector(0, 1);
36 reader.get("x", bbox.p1.x);
37 reader.get("y", bbox.p1.y);
38 bbox.set_size(sprite->get_width(), sprite->get_height());
51 Platform::collision(GameObject& , const CollisionHit& )
54 if(typeid(object) == typeid(Player)) {
55 Player* player = (Player*) &object;
56 //player->movement += movement;
63 Platform::update(float )
65 // just some test code...
67 movement = Vector(0, 1);
72 movement = Vector(0, -1);
77 movement = Vector(1, 0);
82 movement = Vector(-1, 0);
87 movement = Vector(-1, 1);
94 Platform::draw(DrawingContext& context)
96 sprite->draw(context, get_pos(), LAYER_OBJECTS);
99 IMPLEMENT_FACTORY(Platform, "flying_platform");