17 #ifndef HEADER_SUPERTUX_OBJECT_BONUS_BLOCK_HPP 18 #define HEADER_SUPERTUX_OBJECT_BONUS_BLOCK_HPP 20 #include "object/block.hpp" 22 #include "supertux/direction.hpp" 23 #include "supertux/player_status.hpp" 56 virtual void hit(
Player& player)
override;
60 static std::string class_name() {
return "bonusblock"; }
61 virtual std::string get_class_name()
const override {
return class_name(); }
62 static std::string display_name() {
return _(
"Bonus Block"); }
67 GameObjectTypes
get_types()
const override;
68 std::string get_default_sprite_name()
const override;
70 Content get_contents()
const {
return m_contents; }
71 int get_hit_counter()
const {
return m_hit_counter; }
73 void try_open(
Player* player);
76 void add_object(std::unique_ptr<GameObject>
object);
77 void set_object(std::unique_ptr<GameObject>
object);
79 void on_type_change(
int old_type)
override;
81 int get_default_hit_counter()
const;
82 std::string get_default_coin_sprite()
const;
84 void try_drop(
Player* player);
86 void preload_contents(
int d);
87 void raise_growup_bonus(
Player* player,
const BonusType& bonus,
const Direction& dir,
88 const std::string& growup_sprite =
"",
const std::string& flower_sprite =
"");
89 void drop_growup_bonus(
Player* player,
int type,
const Direction& dir,
bool& countdown,
90 const std::string& growup_sprite =
"");
92 BonusBlock::Content get_content_by_data(
int tile_data)
const;
93 BonusBlock::Content get_content_from_string(
const std::string& contentstring)
const;
109 std::vector<std::unique_ptr<GameObject>> m_objects;
113 std::string m_script;
114 SurfacePtr m_lightsprite;
115 std::string m_coin_sprite;
virtual std::string get_display_name() const override
Returns the display name of the object, translated to the user's locale.
Definition: bonus_block.hpp:63
Definition: object_settings.hpp:39
GameObjectTypes get_types() const override
Get all types of the object, if available.
Definition: bonus_block.cpp:169
Definition: bonus_block.hpp:27
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: bonus_block.cpp:682
This class is responsible for: Updating and drawing the object.
Definition: game_object.hpp:83
virtual HitResponse collision(GameObject &other, const CollisionHit &hit) override
this function is called when the object collided with any other object
Definition: bonus_block.cpp:293
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: bonus_block.hpp:64
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: block.hpp:33
Definition: reader_mapping.hpp:32
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