17 #ifndef HEADER_SUPERTUX_BADGUY_DISPENSER_HPP 18 #define HEADER_SUPERTUX_BADGUY_DISPENSER_HPP 20 #include "badguy/badguy.hpp" 33 static void register_class(ssq::VM& vm);
37 DROPPER, CANNON, POINT, GRANITO
58 virtual void freeze()
override;
59 virtual void unfreeze(
bool melt =
true)
override;
60 virtual bool is_freezable()
const override;
62 virtual bool always_active()
const override {
return true; }
63 virtual bool is_portable()
const override;
65 static std::string class_name() {
return "dispenser"; }
66 virtual std::string get_class_name()
const override {
return class_name(); }
67 virtual std::string get_exposed_class_name()
const override {
return "Dispenser"; }
68 static std::string display_name() {
return _(
"Dispenser"); }
73 virtual GameObjectTypes
get_types()
const override;
74 std::string get_default_sprite_name()
const override;
76 virtual void on_flip(
float height)
override;
78 virtual void after_editor_set()
override;
81 if (m_limit_dispensed_badguys) {
87 void add_object(std::unique_ptr<GameObject>
object);
92 void on_type_change(
int old_type)
override;
95 void set_correct_action();
96 void set_correct_colgroup();
100 std::vector<std::unique_ptr<GameObject>> m_objects;
101 unsigned int m_next_object;
102 Timer m_dispense_timer;
108 bool m_limit_dispensed_badguys;
111 int m_max_concurrent_badguys;
114 int m_current_badguys;
Base class for moving sprites that can hurt the Player.
Definition: badguy.hpp:38
virtual std::string get_display_name() const override
Returns the display name of the object, translated to the user's locale.
Definition: dispenser.hpp:69
virtual void unfreeze(bool melt=true) override
Called to unfreeze the badguy.
Definition: dispenser.cpp:331
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: badguy.hpp:71
virtual GameObjectTypes get_types() const override
Get all types of the object, if available.
Definition: dispenser.cpp:434
virtual void active_update(float dt_sec) override
called each frame when the badguy is activated.
Definition: dispenser.cpp:141
virtual void draw(DrawingContext &context) override
Called when the badguy is drawn.
Definition: dispenser.cpp:105
virtual void deactivate() override
Stops the dispenser from dispensing badguys.
Definition: dispenser.cpp:125
virtual HitResponse collision(GameObject &other, const CollisionHit &hit) override
Called when a collision with another object occurred.
Definition: dispenser.cpp:131
virtual bool is_flammable() const override
Returns whether to call ignite() when a badguy gets hit by a fire bullet.
Definition: dispenser.cpp:347
Definition: object_settings.hpp:39
A ""Dispenser"" that was given a name can be controlled by scripts.
Definition: dispenser.hpp:30
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: dispenser.hpp:70
This class is responsible for: Updating and drawing the object.
Definition: game_object.hpp:83
virtual void activate() override
Makes the dispenser start dispensing badguys.
Definition: dispenser.cpp:118
virtual void on_flip(float height) override
When level is flipped vertically.
Definition: dispenser.cpp:459
virtual void kill_fall() override
Set the badguy to kill/falling state, which makes him falling of the screen (his sprite is turned ups...
Definition: dispenser.cpp:177
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 void freeze() override
Called when hit by an ice bullet, and is_freezable() returns true.
Definition: dispenser.cpp:298
virtual void initialize() override
called immediately before the first call to initialize
Definition: dispenser.cpp:112
Simple timer designed to be used in the update functions of objects.
Definition: timer.hpp:24
Definition: reader_mapping.hpp:32
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