X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftrigger%2Fdoor.hpp;h=9186129c7c019447b834bb9832004a5a8d229743;hb=7b6e4c78fe9366f3beff03acdd8310d979d8b2a5;hp=ed0fdc9b19e94dc0901719de581f9e801bcac90a;hpb=5b7f9214cb929399f1a855ef5807018a9447d510;p=supertux.git diff --git a/src/trigger/door.hpp b/src/trigger/door.hpp index ed0fdc9b1..9186129c7 100644 --- a/src/trigger/door.hpp +++ b/src/trigger/door.hpp @@ -1,7 +1,7 @@ // $Id$ // -// SuperTux - A Jump'n Run -// Copyright (C) 2004 Matthias Braun // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -16,6 +16,7 @@ // 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. + #ifndef SUPERTUX_DOOR_H #define SUPERTUX_DOOR_H @@ -26,6 +27,7 @@ #include "trigger_base.hpp" #include "serializable.hpp" #include "timer.hpp" +#include "object/player.hpp" class Door : public TriggerBase, public Serializable { @@ -39,11 +41,21 @@ public: virtual void update(float elapsed_time); virtual void draw(DrawingContext& context); virtual void event(Player& player, EventType type); - + virtual HitResponse collision(GameObject& other, const CollisionHit& hit); + private: - std::string target_sector; - std::string target_spawnpoint; - Sprite* sprite; + enum DoorState { + CLOSED, + OPENING, + OPEN, + CLOSING + }; + + DoorState state; /**< current state of the door */ + std::string target_sector; /**< target sector to teleport to */ + std::string target_spawnpoint; /**< target spawnpoint to teleport to */ + Sprite* sprite; /**< "door" sprite to render */ + Timer stay_open_timer; /**< time until door will close again */ }; #endif