00001 // SuperTux 00002 // Copyright (C) 2006 Matthias Braun <matze@braunis.de> 00003 // 00004 // This program is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 00017 #ifndef HEADER_SUPERTUX_OBJECT_PLATFORM_HPP 00018 #define HEADER_SUPERTUX_OBJECT_PLATFORM_HPP 00019 00020 #include "object/moving_sprite.hpp" 00021 #include "object/path_walker.hpp" 00022 #include "supertux/script_interface.hpp" 00023 00027 class Platform : public MovingSprite, 00028 public ScriptInterface 00029 { 00030 public: 00031 Platform(const Reader& reader); 00032 Platform(const Platform& platform); 00033 00034 virtual HitResponse collision(GameObject& other, const CollisionHit& hit); 00035 virtual void update(float elapsed_time); 00036 00037 const Vector& get_speed() const 00038 { 00039 return speed; 00040 } 00041 00048 void goto_node(int node_no); 00049 00051 void start_moving(); 00052 00054 void stop_moving(); 00055 00060 virtual void expose(HSQUIRRELVM vm, SQInteger table_idx); 00061 virtual void unexpose(HSQUIRRELVM vm, SQInteger table_idx); 00062 00063 Path& get_path() { 00064 return *path.get(); 00065 } 00066 00067 private: 00068 std::auto_ptr<Path> path; 00069 std::auto_ptr<PathWalker> walker; 00070 00071 Vector speed; 00072 00073 bool automatic; 00074 bool player_contact; 00075 bool last_player_contact; 00077 }; 00078 00079 #endif 00080 00081 /* EOF */