supertux
granito_big.hpp
1 // SuperTux
2 // Copyright (C) 2023 MatusGuy
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_GRANITO_BIG_HPP
18 #define HEADER_SUPERTUX_BADGUY_GRANITO_BIG_HPP
19 
20 #include "badguy/granito.hpp"
21 
29 class GranitoBig final : public Granito
30 {
31 public:
32  static void register_class(ssq::VM& vm);
33 
34 public:
35  GranitoBig(const ReaderMapping& reader);
36 
37  virtual HitResponse collision_player(Player& player, const CollisionHit& hit) override;
38 
39  virtual void active_update(float dt_sec) override;
40 
41  static std::string class_name() { return "granito_big"; }
42  virtual std::string get_class_name() const override { return class_name(); }
43  virtual std::string get_exposed_class_name() const override { return "GranitoBig"; }
44  static std::string display_name() { return _("Big Granito"); }
45  virtual std::string get_display_name() const override { return display_name(); }
46  virtual GameObjectClasses get_class_types() const override { return Granito::get_class_types().add(typeid(GranitoBig)); }
47 
48  virtual ObjectSettings get_settings() override;
49  virtual GameObjectTypes get_types() const override;
50 
51  void carry(Granito* granito);
52  Granito* get_carrying() const { return m_carrying; }
53 
59  virtual void eject() override;
60 
65  std::string get_carrying_name() const;
66 
67  // The following functions are unimplemented for Big Granito.
68  virtual void wave() override {}
69  virtual void jump() override {}
70  virtual void sit() override {}
71  virtual GranitoBig* get_carrier() const override { return nullptr; }
72 
73 public:
74  Granito* m_carrying;
75 
76 protected:
77  bool try_wave() override;
78  bool try_jump() override;
79 
80 private:
81  GranitoBig(const GranitoBig&) = delete;
82  GranitoBig& operator=(const GranitoBig&) = delete;
83 };
84 
85 #endif
86 
87 /* EOF */
virtual void sit() override
Makes the Granito sit.
Definition: granito_big.hpp:70
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: granito_big.hpp:46
virtual void eject() override
This function tells the Granito being carried to unglue itself from the Big Granito, by jumping and walking off.
Definition: granito_big.cpp:88
A ""GranitoBig"" that was given a name can be controlled by scripts.
Definition: granito_big.hpp:29
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: granito.hpp:54
virtual GameObjectTypes get_types() const override
Get all types of the object, if available.
Definition: granito_big.cpp:70
Definition: object_settings.hpp:39
virtual void active_update(float dt_sec) override
called each frame when the badguy is activated.
Definition: granito_big.cpp:41
virtual void wave() override
Makes the Granito wave.
Definition: granito_big.hpp:68
virtual std::string get_display_name() const override
Returns the display name of the object, translated to the user&#39;s locale.
Definition: granito_big.hpp:45
Interactable friendly NPC.
Definition: granito.hpp:34
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
virtual void jump() override
Makes the Granito jump.
Definition: granito_big.hpp:69
Definition: reader_mapping.hpp:32
virtual HitResponse collision_player(Player &player, const CollisionHit &hit) override
Called when the badguy collided with a player.
Definition: granito_big.cpp:34
This module contains methods controlling the player.
Definition: player.hpp:47
std::string get_carrying_name() const
Gets the name of the Granito being carried by the Big Granito.
Definition: granito_big.cpp:99
This class collects data about a collision.
Definition: collision_hit.hpp:44