tweak(friendly-fire): la bala empeny la nau abans de morir → els debris hereten la inèrcia
This commit is contained in:
@@ -273,7 +273,12 @@ namespace Systems::Collision {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// *** TEAMMATE HIT (friendly fire) ***
|
// *** TEAMMATE HIT (friendly fire) ***
|
||||||
// Víctima perd 1 vida, atacant en guanya 1.
|
// Víctima perd 1 vida, atacant en guanya 1. Apliquem l'impuls
|
||||||
|
// de la bala a la nau ABANS de on_player_hit perquè tocado()
|
||||||
|
// captura la velocitat per als debris (si no, queden quiets).
|
||||||
|
const Vec2 BULLET_IMPULSE = bullet.getBody().velocity *
|
||||||
|
(bullet.getBody().mass * Defaults::Physics::Bullet::IMPACT_MOMENTUM_FACTOR);
|
||||||
|
ctx.ships[player_id].getBody().applyImpulse(BULLET_IMPULSE);
|
||||||
ctx.on_player_hit(player_id);
|
ctx.on_player_hit(player_id);
|
||||||
ctx.lives_per_player[BULLET_OWNER]++;
|
ctx.lives_per_player[BULLET_OWNER]++;
|
||||||
Audio::get()->playSound(Defaults::Sound::FRIENDLY_FIRE_HIT, Audio::Group::GAME);
|
Audio::get()->playSound(Defaults::Sound::FRIENDLY_FIRE_HIT, Audio::Group::GAME);
|
||||||
|
|||||||
Reference in New Issue
Block a user