change collision with bomb

This commit is contained in:
Askou
2021-06-15 14:29:08 +02:00
parent fbe2900f39
commit baac958615
3 changed files with 17 additions and 5 deletions
+1 -4
View File
@@ -18,7 +18,6 @@ namespace BBM {
if (!bombHolder)
return;
bombHolder->maxBombCount++;
std::cout << "BombHolder : " << bombHolder->maxBombCount << std::endl;
}
void Bonus::ExplosionRangeBonus(WAL::Entity &player, const WAL::Entity &bonus, CollisionComponent::CollidedAxis axis)
@@ -42,7 +41,6 @@ namespace BBM {
if (!controllable || !playerBonus)
return;
controllable->speed += 0.05f;
std::cout << "Speed : " << controllable->speed << std::endl;
}
void Bonus::NoClipBonus(WAL::Entity &player, const WAL::Entity &bonus, CollisionComponent::CollidedAxis axis)
@@ -60,8 +58,7 @@ namespace BBM {
{
double rnd = static_cast<double>(std::rand()) / RAND_MAX;
std::cout << "Random" << rnd << std::endl;
if (rnd <= 1)
if (rnd <= 0.8)
return (static_cast<BonusType>((std::rand() % NOCLIP) + 1));
return (NOTHING);
}
+15
View File
@@ -168,6 +168,21 @@ namespace BBM
return (point * this) / std::pow(this->magnitude(), 2) * this;
}
Vector3<T> trunc() const requires(std::is_floating_point_v<T>)
{
return Vector3<T>(std::trunc(this->x), std::trunc(this->y), std::trunc(this->z));
}
Vector3<T> ceil() const requires(std::is_floating_point_v<T>)
{
return Vector3<T>(std::ceil(this->x), std::ceil(this->y), std::ceil(this->z));
}
Vector3<T> floor() const requires(std::is_floating_point_v<T>)
{
return Vector3<T>(std::floor(this->x), std::floor(this->y), std::floor(this->z));
}
Vector3<T> round() const requires(std::is_floating_point_v<T>)
{
return Vector3<T>(std::round(this->x), std::round(this->y), std::round(this->z));
+1 -1
View File
@@ -20,7 +20,7 @@ namespace BBM
for (auto &[owner, ownerPos, _] : this->_wal.getScene()->view<PositionComponent, BombHolderComponent>()) {
if (owner.getUid() != bomb.ownerID)
continue;
if (pos.position != ownerPos.position.round()) {
if (pos.position.distance(ownerPos.position) >= 1.1) {
bomb.ignoreOwner = false;
return;
}