17 #ifndef HEADER_SUPERTUX_SUPERTUX_MOVING_OBJECT_HPP 18 #define HEADER_SUPERTUX_SUPERTUX_MOVING_OBJECT_HPP 20 #include "collision/collision_hit.hpp" 21 #include "collision/collision_object.hpp" 22 #include "collision/collision_listener.hpp" 23 #include "math/rectf.hpp" 24 #include "supertux/game_object.hpp" 43 static void register_class(ssq::VM& vm);
64 virtual void set_pos(
const Vector& pos)
69 virtual void move_to(
const Vector& pos)
73 virtual void move(
const Vector& dist)
78 virtual bool listener_is_valid()
const override {
return is_valid(); }
80 Vector get_pos()
const 85 const Rectf& get_bbox()
const 90 const Vector& get_movement()
const 92 return m_col.get_movement();
95 CollisionGroup get_group()
const 108 void set_parent_dispenser(
Dispenser* dispenser);
109 Dispenser* get_parent_dispenser()
const {
return m_parent_dispenser; }
111 static std::string class_name() {
return "moving-object"; }
112 virtual std::string get_class_name()
const override {
return class_name(); }
113 virtual std::string get_exposed_class_name()
const override {
return "MovingObject"; }
118 virtual void on_flip(
float height)
override;
120 virtual int get_layer()
const = 0;
138 void set_pos(
float x,
float y);
145 void move(
float x,
float y);
159 void set_group(CollisionGroup group)
CollisionGroup m_group
The collision group.
Definition: collision_object.hpp:153
virtual void collision_solid(const CollisionHit &) override
this function is called when the object collided with something solid
Definition: moving_object.hpp:51
Definition: collision_listener.hpp:23
Definition: resize_marker.hpp:24
float get_y() const
Returns the object's Y coordinate.
Definition: moving_object.cpp:91
float get_width() const
Returns the object's hitbox width.
Definition: moving_object.cpp:109
void move_to(const Vector &pos)
moves entire object to a specific position, including all points those the object has...
Definition: collision_object.hpp:109
Definition: object_settings.hpp:39
Definition: collision_system.hpp:36
Rectf m_bbox
The bounding box of the object (as used for collision detection, this isn't necessarily the bounding ...
Definition: collision_object.hpp:150
virtual void on_flip(float height) override
When level is flipped vertically.
Definition: moving_object.cpp:134
Represents one of (potentially) multiple, separate parts of a Level.
Definition: sector.hpp:61
A ""Dispenser"" that was given a name can be controlled by scripts.
Definition: dispenser.hpp:30
void set_pos(const Vector &pos)
places the moving object at a specific position.
Definition: collision_object.hpp:90
float get_height() const
Returns the object's hitbox height.
Definition: moving_object.cpp:115
bool is_valid() const
returns true if the object is not scheduled to be removed yet
Definition: game_object.hpp:188
This class is responsible for: Updating and drawing the object.
Definition: game_object.hpp:83
virtual void collision_tile(uint32_t) override
called when tiles with special attributes have been touched
Definition: moving_object.hpp:60
Base class for all dynamic/moving game objects.
Definition: moving_object.hpp:35
virtual GameObjectClasses get_class_types() const
List notable classes in inheritance hierarchy of class.
Definition: game_object.cpp:113
float get_x() const
Returns the object's X coordinate.
Definition: moving_object.cpp:85
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: moving_object.hpp:49
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: collision_object.hpp:33
virtual bool collides(GameObject &, const CollisionHit &) const override
when 2 objects collided, we will first call the collision functions of both objects that can decide o...
Definition: moving_object.hpp:55
virtual void editor_select() override
The user clicked on the object in the editor and selected it.
Definition: moving_object.cpp:121
Definition: reader_mapping.hpp:32
This class collects data about a collision.
Definition: collision_hit.hpp:44