From 38df088b80cb6c159eb9941cf6d3c0a8492e65ee Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 22 Apr 2022 19:53:36 +0200 Subject: Added invulnerability timer and death screen --- Player-inl.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Player-inl.h') diff --git a/Player-inl.h b/Player-inl.h index 140bfad..32f6117 100644 --- a/Player-inl.h +++ b/Player-inl.h @@ -7,11 +7,15 @@ template bool -Player::collide(const std::vector& bullets) const +Player::collide(const std::vector& bullets) { + if (m_invulnerability > 0) + return false; for (const auto& bullet : bullets) { - if (CheckCollisionCircles(m_position, 4, bullet.position, bullet.radius)) + if (CheckCollisionCircles(m_position, 4, bullet.position, bullet.radius)) { + hit(); return true; + } } return false; } -- cgit v1.1