17 #ifndef HEADER_SUPERTUX_OBJECT_CRUSHER_HPP 18 #define HEADER_SUPERTUX_OBJECT_CRUSHER_HPP 20 #include "object/moving_sprite.hpp" 21 #include "supertux/physic.hpp" 63 virtual void update(
float dt_sec)
override;
66 virtual void after_editor_set()
override;
67 virtual bool is_sideways()
const {
return m_sideways; }
69 static std::string class_name() {
return "crusher"; }
70 virtual std::string get_class_name()
const override {
return class_name(); }
71 static std::string display_name() {
return _(
"Crusher"); }
76 GameObjectTypes
get_types()
const override;
77 std::string get_default_sprite_name()
const override;
79 virtual void on_flip(
float height)
override;
81 Physic& get_physic() {
return m_physic; }
82 bool is_big()
const {
return m_ic_size == LARGE; }
83 CrusherState get_state()
const {
return m_state; }
86 void spawn_roots(Direction direction);
88 bool found_victim()
const;
90 void set_state(CrusherState state,
bool force =
false);
91 void after_sprite_set();
92 Vector eye_position(
bool right)
const;
94 void on_type_change(
int old_type)
override;
98 CrusherSize m_ic_size;
100 Vector m_start_position;
102 float m_cooldown_timer;
104 Direction m_side_dir;
107 SpritePtr m_righteye;
118 CrusherRoot(Vector position, Crusher::Direction direction,
float delay,
int layer);
122 virtual void update(
float dt_sec)
override;
125 void start_animation();
126 bool delay_gone()
const {
return m_delay_remaining <= 0.f; }
129 Vector m_original_pos;
130 Crusher::Direction m_direction;
131 float m_delay_remaining;
GameObjectTypes get_types() const override
Get all types of the object, if available.
Definition: crusher.cpp:72
Physics engine.
Definition: physic.hpp:27
virtual void on_flip(float height) override
When level is flipped vertically.
Definition: crusher.cpp:660
virtual HitResponse collision(GameObject &other, const CollisionHit &hit) override
this function is called when the object collided with any other object
Definition: crusher.cpp:123
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: crusher.cpp:469
virtual void update(float dt_sec) override
This function is called once per frame and allows the object to update it's state.
Definition: crusher.cpp:245
Definition: crusher.hpp:115
Definition: object_settings.hpp:39
This class is the base class for crushers that tux can stand on.
Definition: crusher.hpp:26
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: crusher.hpp:119
virtual std::string get_display_name() const override
Returns the display name of the object, translated to the user's locale.
Definition: crusher.hpp:72
virtual void collision_solid(const CollisionHit &hit) override
this function is called when the object collided with something solid
Definition: crusher.cpp:166
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
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 GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: crusher.hpp:73
Definition: reader_mapping.hpp:32
Abstract base class for ""MovingObject""s, that are represented by a sprite.
Definition: moving_sprite.hpp:33
This module contains methods controlling the player.
Definition: player.hpp:47
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42
This class collects data about a collision.
Definition: collision_hit.hpp:44