supertux
flame.hpp
1 // SuperTux
2 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HEADER_SUPERTUX_BADGUY_FLAME_HPP
18 #define HEADER_SUPERTUX_BADGUY_FLAME_HPP
19 
20 #include "badguy/badguy.hpp"
21 
22 class SoundSource;
23 
24 class Flame final : public BadGuy
25 {
26 public:
27  Flame(const ReaderMapping& reader, int type = -1);
28 
29  virtual void activate() override;
30  virtual void deactivate() override;
31 
32  virtual void active_update(float dt_sec) override;
33  virtual void draw(DrawingContext& context) override;
34  virtual void kill_fall() override;
35 
36  virtual void freeze() override;
37  virtual void ignite() override;
38  virtual bool is_freezable() const override;
39  virtual bool is_flammable() const override;
40 
41  virtual ObjectSettings get_settings() override;
42  GameObjectTypes get_types() const override;
43  std::string get_default_sprite_name() const override;
44 
45  static std::string class_name() { return "flame"; }
46  virtual std::string get_class_name() const override { return class_name(); }
47  static std::string display_name() { return _("Flame"); }
48  virtual std::string get_display_name() const override { return display_name(); }
49  virtual GameObjectClasses get_class_types() const override { return BadGuy::get_class_types().add(typeid(Flame)); }
50 
51  virtual void stop_looping_sounds() override;
52  virtual void play_looping_sounds() override;
53 
54  virtual void on_flip(float height) override;
55 
56 public:
57  enum Type {
58  FIRE,
59  GHOST,
60  ICE
61  };
62 
63 protected:
64  virtual std::vector<Direction> get_allowed_directions() const override;
65 
66 private:
67  float angle;
68  float radius;
69  float speed;
70 
71  std::unique_ptr<SoundSource> sound_source;
72  SurfacePtr m_radius_indicator;
73 
74 private:
75  Flame(const Flame&) = delete;
76  Flame& operator=(const Flame&) = delete;
77 };
78 
79 #endif
80 
81 /* EOF */
Base class for moving sprites that can hurt the Player.
Definition: badguy.hpp:38
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: badguy.hpp:71
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: flame.cpp:170
virtual void activate() override
called when the badguy has been activated.
Definition: flame.cpp:150
virtual std::string get_display_name() const override
Returns the display name of the object, translated to the user&#39;s locale.
Definition: flame.hpp:48
virtual void draw(DrawingContext &context) override
Called when the badguy is drawn.
Definition: flame.cpp:136
virtual void ignite() override
Kills the badguy by igniting it.
Definition: flame.cpp:193
virtual void play_looping_sounds() override
continues all looping sounds
Definition: flame.cpp:232
GameObjectTypes get_types() const override
Get all types of the object, if available.
Definition: flame.cpp:81
Definition: object_settings.hpp:39
virtual void freeze() override
Called when hit by an ice bullet, and is_freezable() returns true.
Definition: flame.cpp:175
virtual void active_update(float dt_sec) override
called each frame when the badguy is activated.
Definition: flame.cpp:118
virtual std::vector< Direction > get_allowed_directions() const override
Returns a vector of directions the badguy can be set to.
Definition: flame.cpp:240
virtual void on_flip(float height) override
When level is flipped vertically.
Definition: flame.cpp:246
Definition: flame.hpp:24
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: flame.hpp:49
virtual bool is_flammable() const override
Returns whether to call ignite() when a badguy gets hit by a fire bullet.
Definition: flame.cpp:218
A sound source represents the source of audio output.
Definition: sound_source.hpp:25
virtual void stop_looping_sounds() override
stops all looping sounds
Definition: flame.cpp:224
A helper structure to list all the type_indexes of the classes in the type hierarchy of a given class...
Definition: game_object.hpp:57
Definition: reader_mapping.hpp:32
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42
virtual void deactivate() override
called when the badguy has been deactivated
Definition: flame.cpp:163