src/badguy/ghosttree.hpp

Go to the documentation of this file.
00001 //  SuperTux - Boss "GhostTree"
00002 //  Copyright (C) 2007 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_BADGUY_GHOSTTREE_HPP
00018 #define HEADER_SUPERTUX_BADGUY_GHOSTTREE_HPP
00019 
00020 #include "badguy/badguy.hpp"
00021 
00022 class TreeWillOWisp;
00023 class Lantern;
00024 
00025 class GhostTree : public BadGuy
00026 {
00027 public:
00028   GhostTree(const Reader& lisp);
00029   ~GhostTree();
00030 
00031   virtual bool is_flammable() const { return false; }
00032   virtual bool is_freezable() const { return false; }
00033   virtual void kill_fall() { }
00034 
00035   void activate();
00036   void active_update(float elapsed_time);
00037   void willowisp_died(TreeWillOWisp* willowisp);
00038   virtual void draw(DrawingContext& context);
00039 
00040   virtual bool collides(GameObject& other, const CollisionHit& hit);
00041   virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
00042 
00043   void die();
00044 
00045 private:
00046   enum MyState {
00047     STATE_IDLE, STATE_SUCKING, STATE_SWALLOWING, STATE_DYING
00048   };
00049   MyState mystate;
00050   Timer willowisp_timer;
00051   float willo_spawn_y;
00052   float willo_radius;
00053   float willo_speed;
00054   int   willo_color;
00055 
00056   SpritePtr glow_sprite;
00057   Timer colorchange_timer;
00058   Timer suck_timer;
00059   Timer root_timer;
00060   int   treecolor;
00061   Color suck_lantern_color;
00062 
00063   Lantern* suck_lantern; 
00065   std::vector<TreeWillOWisp*> willowisps;
00066 
00067   bool is_color_deadly(Color color) const;
00068   void spawn_lantern();
00069 
00070 private:
00071   GhostTree(const GhostTree&);
00072   GhostTree& operator=(const GhostTree&);
00073 };
00074 
00075 #endif
00076 
00077 /* EOF */

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