X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject%2Fplatform.hpp;h=06456a7b5d35c2e8fd638b4b2553b5add32e7005;hb=fea3446f05e1e7673607b835c269d3e8d1929ab3;hp=cc383dfc14086f7cb0b4be9a15eac9fd2b106458;hpb=e42359c9e76c97b2529876a88ec56e9e8e5a3662;p=supertux.git diff --git a/src/object/platform.hpp b/src/object/platform.hpp index cc383dfc1..06456a7b5 100644 --- a/src/object/platform.hpp +++ b/src/object/platform.hpp @@ -1,7 +1,7 @@ // $Id$ // // SuperTux -// Copyright (C) 2005 Marek Moeckel +// Copyright (C) 2006 Matthias Braun // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -12,43 +12,74 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + #ifndef __PLATFORM_H__ #define __PLATFORM_H__ #include -#include "moving_object.hpp" -#include "sprite/sprite.hpp" +#include +#include "object/moving_sprite.hpp" #include "object/path.hpp" #include "object/path_walker.hpp" +#include "script_interface.hpp" /** * This class is the base class for platforms that tux can stand on */ -class Platform : public MovingObject +class Platform : public MovingSprite, public ScriptInterface { public: Platform(const lisp::Lisp& reader); - ~Platform(); + Platform(const Platform& platform); + virtual Platform* clone() const { return new Platform(*this); } virtual HitResponse collision(GameObject& other, const CollisionHit& hit); virtual void update(float elapsed_time); - virtual void draw(DrawingContext& context); + const Vector& get_speed() const { return speed; } + /** + * @name Scriptable Methods + * @{ + */ + + /** Move platform until at given node, then stop */ + void goto_node(int node_no); + + /** Start moving platform */ + void start_moving(); + + /** Stop platform at next node */ + void stop_moving(); + + /** + * @} + */ + + virtual void expose(HSQUIRRELVM vm, SQInteger table_idx); + virtual void unexpose(HSQUIRRELVM vm, SQInteger table_idx); + + Path& get_path() { + return *path.get(); + } + private: - std::auto_ptr sprite; std::auto_ptr path; std::auto_ptr walker; + Vector speed; + + bool automatic; /**< true if Platform will automatically pick a destination based on collisions and current Player position */ + bool player_contact; /**< true if a Player touched the Platform during the last round of collision detections */ + bool last_player_contact; /**< true if a Player touched the Platform during the round before the last round of collision detections */ + }; #endif -