supertux
mole.hpp
1 // SuperTux - Mole Badguy
2 // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.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_MOLE_HPP
18 #define HEADER_SUPERTUX_BADGUY_MOLE_HPP
19 
20 #include "badguy/badguy.hpp"
21 
22 class Mole final : public BadGuy
23 {
24 public:
25  Mole(const ReaderMapping& );
26 
27  virtual void kill_fall() override;
28  virtual HitResponse collision_badguy(BadGuy& , const CollisionHit& ) override;
29  virtual bool collision_squished(GameObject& object) override;
30 
31  virtual void activate() override;
32  virtual void active_update(float) override;
33 
34  virtual bool is_freezable() const override;
35 
36  virtual void ignite() override;
37 
38  virtual std::string get_class() const override { return "mole"; }
39  virtual std::string get_display_name() const override { return _("Mole"); }
40 
41 private:
42  enum MoleState {
43  PRE_THROWING,
44  THROWING,
45  POST_THROWING,
46  PEEKING,
47  DEAD,
48  BURNING
49  };
50 
51 private:
52  void set_state(MoleState new_state);
53  void throw_rock();
54 
55 private:
56  MoleState state;
57  Timer timer;
58  Timer throw_timer;
59 
60 private:
61  Mole(const Mole&) = delete;
62  Mole& operator=(const Mole&) = delete;
63 };
64 
65 #endif
66 
67 /* EOF */
Base class for moving sprites that can hurt the Player.
Definition: badguy.hpp:31
virtual void active_update(float) override
called each frame when the badguy is activated.
Definition: mole.cpp:90
virtual void ignite() override
Called when hit by a fire bullet, and is_flammable() returns true.
Definition: mole.cpp:180
virtual HitResponse collision_badguy(BadGuy &, const CollisionHit &) override
Called when the badguy collided with another badguy.
Definition: mole.cpp:60
virtual bool collision_squished(GameObject &object) override
Called when the player hit the badguy from above.
Definition: mole.cpp:66
Base class for all the things that make up Levels&#39; Sectors.
Definition: game_object.hpp:46
virtual void activate() override
called when the badguy has been activated.
Definition: mole.cpp:46
Definition: mole.hpp:22
Simple timer designed to be used in the update functions of objects.
Definition: timer.hpp:24
Definition: reader_mapping.hpp:31
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: mole.cpp:52
This class collects data about a collision.
Definition: collision_hit.hpp:44