2 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef HEADER_SUPERTUX_OBJECT_PLATFORM_HPP
18 #define HEADER_SUPERTUX_OBJECT_PLATFORM_HPP
20 #include "object/moving_sprite.hpp"
21 #include "object/path_walker.hpp"
22 #include "supertux/script_interface.hpp"
25 * This class is the base class for platforms that tux can stand on
27 class Platform : public MovingSprite,
28 public ScriptInterface
31 Platform(const Reader& reader);
32 Platform(const Platform& platform);
34 virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
35 virtual void update(float elapsed_time);
37 const Vector& get_speed() const
43 * @name Scriptable Methods
47 /** Move platform until at given node, then stop */
48 void goto_node(int node_no);
50 /** Start moving platform */
53 /** Stop platform at next node */
60 virtual void expose(HSQUIRRELVM vm, SQInteger table_idx);
61 virtual void unexpose(HSQUIRRELVM vm, SQInteger table_idx);
68 std::auto_ptr<Path> path;
69 std::auto_ptr<PathWalker> walker;
73 bool automatic; /**< true if Platform will automatically pick a destination based on collisions and current Player position */
74 bool player_contact; /**< true if a Player touched the Platform during the last round of collision detections */
75 bool last_player_contact; /**< true if a Player touched the Platform during the round before the last round of collision detections */