diff --git a/src/pellet_projectile.cpp b/src/pellet_projectile.cpp index 7c3829c..6552394 100644 --- a/src/pellet_projectile.cpp +++ b/src/pellet_projectile.cpp @@ -19,11 +19,10 @@ void PelletProjectile::_physics_process(double delta_time) { GDGAMEONLY(); float const speed = this->data->get_projectile_speed()->sample(distance_traveled / this->data->get_range()); this->distance_traveled += speed; Vector3 const next_position{this->get_global_position() + this->get_global_transform().basis.get_column(2) * speed}; - if(this->check_hit(next_position) || this->distance_traveled > this->data->get_range()) { + if(this->check_hit(next_position) || this->distance_traveled > this->data->get_range()) this->return_to_pool(); - } else { + else this->set_global_position(next_position); - } } bool PelletProjectile::check_hit(Vector3 next_position) { @@ -36,7 +35,7 @@ bool PelletProjectile::check_hit(Vector3 next_position) { return false; IHealthEntity *health_entity = dynamic_cast(collider); if(health_entity == nullptr) - return false; + return true; health_entity->get_health()->damage(this->data->get_damage()); return true; }