supertux
bigsnowball.hpp
1 // Copyright (C) 2024 Daniel Ward <weluvgoatz@gmail.com>
2 //
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program. If not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef HEADER_SUPERTUX_OBJECT_BIGSNOWBALL_HPP
17 #define HEADER_SUPERTUX_OBJECT_BIGSNOWBALL_HPP
18 
19 #include "object/moving_sprite.hpp"
20 
21 #include "supertux/physic.hpp"
22 
23 enum class Direction;
24 
25 class BigSnowball final : public MovingSprite
26 {
27 public:
28  BigSnowball(const ReaderMapping& reader);
29  BigSnowball(const Vector& pos, const Direction& dir, bool bounce = false);
30 
31  virtual ObjectSettings get_settings() override;
32 
33  virtual void update(float dt_sec) override;
34  virtual void collision_solid(const CollisionHit& hit) override;
35  virtual HitResponse collision(GameObject& other, const CollisionHit& hit) override;
36 
37  static std::string class_name() { return "bigsnowball"; }
38  virtual std::string get_class_name() const override { return class_name(); }
39  static std::string display_name() { return _("Big Snowball"); }
40  virtual std::string get_display_name() const override { return display_name(); }
41  virtual GameObjectClasses get_class_types() const override { return MovingSprite::get_class_types().add(typeid(BigSnowball)); }
42 
43 private:
44  void spawn_particles();
45 
46 private:
47  Physic m_physic;
48  Direction m_dir;
49  float m_speed;
50  bool m_break_on_impact;
51  bool m_bounce;
52 
53 private:
54  BigSnowball(const BigSnowball&) = delete;
55  BigSnowball& operator=(const BigSnowball&) = delete;
56 };
57 
58 #endif
59 
60 /* EOF */
virtual void update(float dt_sec) override
This function is called once per frame and allows the object to update it&#39;s state.
Definition: bigsnowball.cpp:90
Physics engine.
Definition: physic.hpp:27
Definition: object_settings.hpp:39
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: bigsnowball.hpp:41
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: moving_sprite.hpp:60
This class is responsible for: Updating and drawing the object.
Definition: game_object.hpp:83
Definition: bigsnowball.hpp:25
virtual HitResponse collision(GameObject &other, const CollisionHit &hit) override
this function is called when the object collided with any other object
Definition: bigsnowball.cpp:129
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 std::string get_display_name() const override
Returns the display name of the object, translated to the user&#39;s locale.
Definition: bigsnowball.hpp:40
Definition: reader_mapping.hpp:32
Abstract base class for ""MovingObject""s, that are represented by a sprite.
Definition: moving_sprite.hpp:33
virtual void collision_solid(const CollisionHit &hit) override
this function is called when the object collided with something solid
Definition: bigsnowball.cpp:178
This class collects data about a collision.
Definition: collision_hit.hpp:44