src/object/icecrusher.hpp

Go to the documentation of this file.
00001 //  IceCrusher - A block to stand on, which can drop down to crush the player
00002 //  Copyright (C) 2008 Christoph Sommer <christoph.sommer@2008.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_OBJECT_ICECRUSHER_HPP
00018 #define HEADER_SUPERTUX_OBJECT_ICECRUSHER_HPP
00019 
00020 #include "object/moving_sprite.hpp"
00021 #include "supertux/physic.hpp"
00022 
00023 class Player;
00024 
00028 class IceCrusher : public MovingSprite
00029 {
00030 public:
00031   IceCrusher(const Reader& reader);
00032   IceCrusher(const IceCrusher& icecrusher);
00033 
00034   virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
00035   virtual void collision_solid(const CollisionHit& hit);
00036   virtual void update(float elapsed_time);
00037 
00038 #if 0
00039   const Vector& get_speed() const
00040   {
00041     return speed;
00042   }
00043 #endif
00044 
00045 protected:
00046   enum IceCrusherState {
00047     IDLE,
00048     CRUSHING,
00049     RECOVERING
00050   };
00051   IceCrusherState state;
00052   Vector start_position;
00053   Physic physic;
00054   float cooldown_timer;
00055 
00056   Player* get_nearest_player();
00057   bool found_victim();
00058   void set_state(IceCrusherState state, bool force = false);
00059 
00060 private:
00061   enum IceCrusherSize {
00062     NORMAL,
00063     LARGE
00064   };
00065   IceCrusherSize ic_size;
00066 };
00067 
00068 #endif
00069 
00070 /* EOF */

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