17 #ifndef HEADER_SUPERTUX_OBJECT_SCRIPTED_OBJECT_HPP 18 #define HEADER_SUPERTUX_OBJECT_SCRIPTED_OBJECT_HPP 20 #include "object/moving_sprite.hpp" 21 #include "supertux/physic.hpp" 32 static void register_class(ssq::VM& vm);
37 virtual void update(
float dt_sec)
override;
43 static std::string class_name() {
return "scriptedobject"; }
44 virtual std::string get_class_name()
const override {
return class_name(); }
45 virtual std::string get_exposed_class_name()
const override {
return "ScriptedObject"; }
46 static std::string display_name() {
return _(
"Scripted Object"); }
52 virtual void on_flip(
float height)
override;
54 #ifdef DOXYGEN_SCRIPTING 60 float get_pos_x()
const;
66 float get_pos_y()
const;
134 std::string hit_script;
void set_visible(bool visible)
Definition: scripted_object.cpp:102
virtual void update(float dt_sec) override
This function is called once per frame and allows the object to update it's state.
Definition: scripted_object.cpp:143
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: scripted_object.hpp:48
virtual void collision_solid(const CollisionHit &hit) override
this function is called when the object collided with something solid
Definition: scripted_object.cpp:164
virtual HitResponse collision(GameObject &other, const CollisionHit &hit) override
this function is called when the object collided with any other object
Definition: scripted_object.cpp:182
float get_velocity_y() const
Returns the Y coordinate of the object's velocity.
Definition: scripted_object.cpp:96
bool is_visible() const
Definition: scripted_object.cpp:108
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: scripted_object.cpp:156
Physics engine.
Definition: physic.hpp:27
bool is_solid() const
Returns ""true"" if the object is solid.
Definition: scripted_object.cpp:125
virtual std::string get_display_name() const override
Returns the display name of the object, translated to the user's locale.
Definition: scripted_object.hpp:47
void enable_gravity(bool enabled)
Enables or disables gravity, according to the value of ""enabled"".
Definition: scripted_object.cpp:137
void set_solid(bool solid)
Changes the solidity, according to the value of ""solid"".
Definition: scripted_object.cpp:114
Definition: object_settings.hpp:39
A ""ScriptedObject"" that was given a name can be controlled by scripts.
Definition: scripted_object.hpp:29
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
float get_velocity_x() const
Returns the X coordinate of the object's velocity.
Definition: scripted_object.cpp:90
bool gravity_enabled() const
Returns ""true"" if the object's gravity is enabled.
Definition: scripted_object.cpp:131
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: reader_mapping.hpp:32
Abstract base class for ""MovingObject""s, that are represented by a sprite.
Definition: moving_sprite.hpp:33
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42
virtual void on_flip(float height) override
When level is flipped vertically.
Definition: scripted_object.cpp:193
void set_velocity(float x, float y)
Makes the object move in a certain ""x"" and ""y"" direction (with a certain speed).
Definition: scripted_object.cpp:83
This class collects data about a collision.
Definition: collision_hit.hpp:44