00001 // SuperTux - Unstable Tile 00002 // Copyright (C) 2006 Matthias Braun <matze@braunis.de> 00003 // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de> 00004 // Copyright (C) 2010 Florian Forster <supertux at octo.it> 00005 // 00006 // This program is free software: you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation, either version 3 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // This program is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 00019 #ifndef HEADER_SUPERTUX_OBJECT_UNSTABLE_TILE_HPP 00020 #define HEADER_SUPERTUX_OBJECT_UNSTABLE_TILE_HPP 00021 00022 #include "object/moving_sprite.hpp" 00023 #include "supertux/physic.hpp" 00024 #include "supertux/timer.hpp" 00025 00029 class UnstableTile : public MovingSprite 00030 { 00031 public: 00032 UnstableTile(const Reader& lisp); 00033 00034 HitResponse collision(GameObject& other, const CollisionHit& hit); 00035 void update(float elapsed_time); 00036 00037 private: 00038 enum State { 00039 STATE_NORMAL, 00040 STATE_SHAKE, 00041 STATE_DISSOLVE, 00042 STATE_SLOWFALL, 00043 STATE_FALL 00044 }; 00045 00046 void startCrumbling(); 00047 00048 private: 00049 void shake (void); 00050 void dissolve (void); 00051 void fall_down (void); 00052 void slow_fall (void); 00053 00054 Physic physic; 00055 State state; 00056 float slowfall_timer; 00057 }; 00058 00059 #endif 00060 00061 /* EOF */