00001 // SuperTux -- Explosion object 00002 // Copyright (C) 2007 Christoph Sommer <christoph.sommer@2007.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_EXPLOSION_HPP 00018 #define HEADER_SUPERTUX_OBJECT_EXPLOSION_HPP 00019 00020 #include "object/moving_sprite.hpp" 00021 00025 class Explosion : public MovingSprite 00026 { 00027 public: 00031 Explosion(const Vector& pos); 00032 Explosion(const Reader& reader); 00033 00034 void update(float elapsed_time); 00035 HitResponse collision(GameObject& other, const CollisionHit& hit); 00036 00037 bool hurts (void) const 00038 { 00039 return this->hurt; 00040 } 00041 00042 void hurts (bool val) 00043 { 00044 this->hurt = val; 00045 } 00046 00047 bool pushes (void) const 00048 { 00049 return this->push; 00050 } 00051 00052 void pushes (bool val) 00053 { 00054 this->push = val; 00055 } 00056 00057 protected: 00061 void explode(); 00062 00063 private: 00064 enum State { 00065 STATE_WAITING, 00066 STATE_EXPLODING 00067 }; 00068 bool hurt; 00069 bool push; 00070 State state; 00071 00072 }; 00073 00074 #endif 00075 00076 /* EOF */