17 #ifndef HEADER_SUPERTUX_OBJECT_MOVING_SPRITE_HPP 18 #define HEADER_SUPERTUX_OBJECT_MOVING_SPRITE_HPP 20 #include "math/anchor_point.hpp" 21 #include "sprite/sprite.hpp" 22 #include "sprite/sprite_ptr.hpp" 23 #include "supertux/moving_object.hpp" 24 #include "video/drawing_context.hpp" 33 const std::string& sprite_name,
34 int layer = LAYER_OBJECTS,
35 CollisionGroup collision_group = COLGROUP_MOVING);
38 int layer = LAYER_OBJECTS,
39 CollisionGroup collision_group = COLGROUP_MOVING);
41 const std::string& sprite_name,
42 int layer = LAYER_OBJECTS,
43 CollisionGroup collision_group = COLGROUP_MOVING);
45 int layer = LAYER_OBJECTS,
46 CollisionGroup collision_group = COLGROUP_MOVING);
49 virtual void update(
float dt_sec)
override;
50 virtual std::string get_class()
const override {
return "moving-sprite"; }
54 virtual void after_editor_set()
override;
56 std::string get_sprite_name()
const;
57 void change_sprite(
const std::string& new_sprite_name);
58 void spawn_explosion_sprites(
int count,
const std::string& sprite_path);
63 void set_action(
const std::string& action,
int loops);
73 void set_action(
const std::string& action,
int loops, AnchorPoint anchorPoint);
76 std::string m_sprite_name;
Simple two dimensional vector.
Definition: vector.hpp:24
void set_action(const std::string &action, int loops)
set new action for sprite and resize bounding box.
Definition: moving_sprite.cpp:118
int m_layer
Sprite's z-position.
Definition: moving_sprite.hpp:81
Definition: object_settings.hpp:35
virtual void update(float dt_sec) override
This function is called once per frame and allows the object to update it's state.
Definition: moving_sprite.cpp:107
std::string m_default_sprite_name
The default sprite for this MovingObject.
Definition: moving_sprite.hpp:79
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: moving_sprite.cpp:101
Base class for all dynamic/moving game objects.
Definition: moving_object.hpp:31
void set_action_centered(const std::string &action, int loops)
set new action for sprite and re-center bounding box.
Definition: moving_sprite.cpp:125
Definition: reader_mapping.hpp:31
Abstract base class for MovingObjects that are represented by a Sprite.
Definition: moving_sprite.hpp:29
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42