00001 // Zeekling - flyer that swoops down when she spots the player 00002 // Copyright (C) 2005 Matthias Braun <matze@braunis.de> 00003 // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de> 00004 // 00005 // This program is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 00018 #ifndef HEADER_SUPERTUX_BADGUY_ZEEKLING_HPP 00019 #define HEADER_SUPERTUX_BADGUY_ZEEKLING_HPP 00020 00021 #include "badguy/badguy.hpp" 00022 00023 class Zeekling : public BadGuy 00024 { 00025 public: 00026 Zeekling(const Reader& reader); 00027 Zeekling(const Vector& pos, Direction d); 00028 00029 void initialize(); 00030 void collision_solid(const CollisionHit& hit); 00031 void active_update(float elapsed_time); 00032 00033 private: 00034 bool collision_squished(GameObject& object); 00035 bool should_we_dive(); 00036 void onBumpHorizontal(); 00037 void onBumpVertical(); 00038 00039 private: 00040 enum ZeeklingState { 00041 FLYING, 00042 DIVING, 00043 CLIMBING 00044 }; 00045 00046 private: 00047 float speed; 00048 Timer diveRecoverTimer; 00049 ZeeklingState state; 00050 const MovingObject* last_player; 00051 Vector last_player_pos; 00052 Vector last_self_pos; 00054 private: 00055 Zeekling(const Zeekling&); 00056 Zeekling& operator=(const Zeekling&); 00057 }; 00058 00059 #endif 00060 00061 /* EOF */