# Rally Rush: src/damage_area.hpp Source File

Loading...
Searching...
No Matches
damage_area.hpp
Go to the documentation of this file.
#ifndef DAMAGE_AREA_HPP
#define DAMAGE_AREA_HPP
#include "enemy_car.hpp"
#include "godot_cpp/classes/animation_player.hpp"
#include <godot_cpp/classes/area3d.hpp>
#include <godot_cpp/templates/vector.hpp>
namespace godot {
class DamageArea : public Area3D {
GDCLASS(DamageArea, Area3D);
static void _bind_methods();
public:
virtual void _enter_tree() override;
virtual void _process(double delta_time) override;
protected:
void body_entered(Node3D *node);
void set_target_classes(Array array);
Array get_target_classes() const;
private:
Vector<StringName> target_classes{};
AnimationPlayer *anim{nullptr};
};
}
#endif // !DAMAGE_AREA_HPP
godot::DamageArea
Collision area that damages nodes of the given types when entered.
Definition damage_area.hpp:11
godot::DamageArea::get_target_classes
Array get_target_classes() const
Node classes to deal damage to.
Definition damage_area.cpp:37
godot::DamageArea::target_classes
Vector< StringName > target_classes
Definition damage_area.hpp:28
godot::DamageArea::anim
AnimationPlayer * anim
Definition damage_area.hpp:29
godot::DamageArea::body_entered
void body_entered(Node3D *node)
If the node is of a class referenced in target_classes, deal damage.
Definition damage_area.cpp:22
godot::DamageArea::_enter_tree
virtual void _enter_tree() override
Register body_entered observer. Get animation player if applicable. Get parent if applicable.
Definition damage_area.cpp:11
godot::DamageArea::GDCLASS
GDCLASS(DamageArea, Area3D)
godot::DamageArea::_bind_methods
static void _bind_methods()
Bind editor properties.
Definition damage_area.cpp:6
godot::DamageArea::set_target_classes
void set_target_classes(Array array)
Node classes to deal damage to.
Definition damage_area.cpp:28
godot::DamageArea::_process
virtual void _process(double delta_time) override
Animate until end, destroy if animation has ended.
Definition damage_area.cpp:17
enemy_car.hpp
godot
Definition beacon_powerup.cpp:6