1 | // SuperTux - Boss "Yeti" |
2 | // Copyright (C) 2005 Matthias Braun <matze@braunis.de> |
3 | // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de> |
4 | // |
5 | // This program is free software: you can redistribute it and/or modify |
6 | // it under the terms of the GNU General Public License as published by |
7 | // the Free Software Foundation, either version 3 of the License, or |
8 | // (at your option) any later version. |
9 | // |
10 | // This program is distributed in the hope that it will be useful, |
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | // GNU General Public License for more details. |
14 | // |
15 | // You should have received a copy of the GNU General Public License |
16 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | |
18 | #ifndef HEADER_SUPERTUX_BADGUY_YETI_HPP |
19 | #define |
20 | |
21 | #include "badguy/badguy.hpp" |
22 | |
23 | class Yeti final : public BadGuy |
24 | { |
25 | public: |
26 | Yeti(const ReaderMapping& mapping); |
27 | |
28 | virtual void draw(DrawingContext& context) override; |
29 | virtual void initialize() override; |
30 | virtual void active_update(float dt_sec) override; |
31 | virtual void collision_solid(const CollisionHit& hit) override; |
32 | virtual bool collision_squished(GameObject& object) override; |
33 | virtual void kill_fall() override; |
34 | |
35 | virtual bool is_flammable() const override; |
36 | virtual std::string get_class() const override { return "yeti" ; } |
37 | virtual std::string get_display_name() const override { return _("Yeti" ); } |
38 | |
39 | virtual ObjectSettings get_settings() override; |
40 | |
41 | void kill_squished(GameObject& object); |
42 | |
43 | private: |
44 | void run(); |
45 | void jump_up(); |
46 | void be_angry(); |
47 | void drop_stalactite(); |
48 | void jump_down(); |
49 | |
50 | void draw_hit_points(DrawingContext& context); |
51 | |
52 | void take_hit(Player& player); |
53 | |
54 | void add_snow_explosions(); |
55 | |
56 | private: |
57 | enum YetiState { |
58 | JUMP_DOWN, |
59 | RUN, |
60 | JUMP_UP, |
61 | BE_ANGRY, |
62 | SQUISHED, |
63 | FALLING |
64 | }; |
65 | |
66 | private: |
67 | YetiState state; |
68 | Timer state_timer; |
69 | Timer safe_timer; |
70 | int stomp_count; |
71 | int hit_points; |
72 | SurfacePtr hud_head; |
73 | |
74 | float left_stand_x; |
75 | float right_stand_x; |
76 | float left_jump_x; |
77 | float right_jump_x; |
78 | |
79 | void recalculate_pos(); |
80 | |
81 | bool fixed_pos; |
82 | std::string hud_icon; |
83 | |
84 | class SnowExplosionParticle: public BadGuy |
85 | { |
86 | public: |
87 | SnowExplosionParticle(const Vector& pos, const Vector& velocity); |
88 | }; |
89 | |
90 | private: |
91 | Yeti(const Yeti&) = delete; |
92 | Yeti& operator=(const Yeti&) = delete; |
93 | }; |
94 | |
95 | #endif |
96 | |
97 | /* EOF */ |
98 | |