feature/Prototype_R_LEVEL #47

Merged
cromer merged 18 commits from feature/Prototype_R_LEVEL into develop 2022-09-01 22:36:04 -04:00
2 changed files with 5 additions and 4 deletions
Showing only changes of commit ba46d6c65b - Show all commits

View File

@ -60,6 +60,7 @@ void alai::player::Player::_ready()
{
auto event = get_node<alai::Event>("/root/Event");
event->connect("level_loaded", this, "_on_level_loaded");
event->connect("player_touched", this, "_on_player_touched");
animated_sprite = get_node<godot::AnimatedSprite>("AnimatedSprite");
if (!animated_sprite)
@ -156,11 +157,11 @@ void alai::player::Player::_physics_process(float delta)
}
else if (collider->is_in_group("enemy") && (collider->is_in_group("rideable") && godot::Vector2::DOWN.dot(collision->get_normal()) > 0))
{
_on_player_touched();
_on_player_touched(3);
}
else if (collider->is_in_group("enemy") && !collider->is_in_group("rideable"))
{
_on_player_touched();
_on_player_touched(3);
}
}
@ -301,7 +302,7 @@ godot::Vector2 alai::player::Player::get_velocity()
return this->velocity;
}
void alai::player::Player::_on_player_touched()
void alai::player::Player::_on_player_touched(uint8_t damage)
{
auto event = get_node<alai::Event>("/root/Event");
event->emit_signal("player_died");

View File

@ -283,7 +283,7 @@ namespace alai
* @brief This function is called when an enemy touches the player.
*
*/
void _on_player_touched();
void _on_player_touched(uint8_t damage);
/**
* @brief Called when the monitor is loaded to connect the player to it for tracking.