src/badguy/willowisp.hpp

Go to the documentation of this file.
00001 //  SuperTux - "Will-O-Wisp" Badguy
00002 //  Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.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_BADGUY_WILLOWISP_HPP
00018 #define HEADER_SUPERTUX_BADGUY_WILLOWISP_HPP
00019 
00020 #include "badguy/badguy.hpp"
00021 
00022 class Path;
00023 class PathWalker;
00024 class SoundSource;
00025 
00026 #include "scripting/willowisp.hpp"
00027 #include "supertux/script_interface.hpp"
00028 
00029 class WillOWisp : public BadGuy, 
00030                   public scripting::WillOWisp,
00031                   public ScriptInterface
00032 {
00033 public:
00034   WillOWisp(const Reader& reader);
00035 
00036   void activate();
00037   void deactivate();
00038 
00039   void active_update(float elapsed_time);
00040   virtual bool is_flammable() const { return false; }
00041   virtual bool is_freezable() const { return false; }
00042   virtual void kill_fall() { vanish(); }
00043 
00047   void vanish();
00048 
00049   virtual void draw(DrawingContext& context);
00050 
00051   virtual void goto_node(int node_no);
00052   virtual void set_state(const std::string& state);
00053   virtual void start_moving();
00054   virtual void stop_moving();
00055 
00056   virtual void expose(HSQUIRRELVM vm, SQInteger table_idx);
00057   virtual void unexpose(HSQUIRRELVM vm, SQInteger table_idx);
00058 
00059 protected:
00060   virtual bool collides(GameObject& other, const CollisionHit& hit);
00061   HitResponse collision_player(Player& player, const CollisionHit& hit);
00062 
00063 private:
00064   enum MyState {
00065     STATE_STOPPED, STATE_IDLE, STATE_TRACKING, STATE_VANISHING, STATE_WARPING,
00066     STATE_PATHMOVING, STATE_PATHMOVING_TRACK
00067   };
00068 
00069 private:
00070   MyState mystate;
00071 
00072   std::string target_sector;
00073   std::string target_spawnpoint;
00074   std::string hit_script;
00075 
00076   std::auto_ptr<SoundSource> sound_source;
00077 
00078   std::auto_ptr<Path>        path;
00079   std::auto_ptr<PathWalker>  walker;
00080 
00081   float flyspeed;
00082   float track_range;
00083   float vanish_range;
00084 };
00085 
00086 #endif
00087 
00088 /* EOF */

Generated on Mon Jun 9 03:38:18 2014 for SuperTux by  doxygen 1.5.1