supertux
haywire.hpp
1 // SuperTux
2 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
3 // Copyright (C) 2010 Florian Forster <supertux at octo.it>
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_HAYWIRE_HPP
19 #define HEADER_SUPERTUX_BADGUY_HAYWIRE_HPP
20 
21 #include "badguy/walking_badguy.hpp"
22 
23 class SoundSource;
24 
25 class Haywire final : public WalkingBadguy
26 {
27 public:
28  Haywire(const ReaderMapping& reader);
29 
30  virtual void kill_fall() override;
31  virtual void ignite() override;
32 
33  virtual void active_update(float dt_sec) override;
34 
35  virtual bool is_freezable() const override;
36  virtual void freeze() override;
37 
38  virtual void stop_looping_sounds() override;
39  virtual void play_looping_sounds() override;
40 
41  virtual std::string get_class() const override { return "haywire"; }
42  virtual std::string get_display_name() const override { return _("Haywire"); }
43 
44 protected:
45  virtual bool collision_squished(GameObject& object) override;
46 
47 private:
48  void start_exploding();
49  void stop_exploding();
50 
51 private:
52  bool is_exploding;
53  float time_until_explosion;
54  bool is_stunned;
55  float time_stunned;
56 
57  std::unique_ptr<SoundSource> ticking;
58  std::unique_ptr<SoundSource> grunting;
59 
60 private:
61  Haywire(const Haywire&) = delete;
62  Haywire& operator=(const Haywire&) = delete;
63 };
64 
65 #endif
66 
67 /* EOF */
virtual void active_update(float dt_sec) override
called each frame when the badguy is activated.
Definition: haywire.cpp:101
virtual void kill_fall() override
Set the badguy to kill/falling state, which makes him falling of the screen (his sprite is turned ups...
Definition: haywire.cpp:144
Base class for Badguys that walk on the floor.
Definition: walking_badguy.hpp:25
virtual void play_looping_sounds() override
continues all looping sounds
Definition: haywire.cpp:226
virtual void freeze() override
Called when hit by an ice bullet, and is_freezable() returns true.
Definition: haywire.cpp:171
virtual bool collision_squished(GameObject &object) override
Called when the player hit the badguy from above.
Definition: haywire.cpp:66
virtual void stop_looping_sounds() override
stops all looping sounds
Definition: haywire.cpp:216
Definition: haywire.hpp:25
Base class for all the things that make up Levels&#39; Sectors.
Definition: game_object.hpp:46
A sound source represents the source of audio output.
Definition: sound_source.hpp:25
virtual void ignite() override
Called when hit by a fire bullet, and is_flammable() returns true.
Definition: haywire.cpp:165
Definition: reader_mapping.hpp:31