Skip to content
Snippets Groups Projects
Commit 568e353b authored by Mathis Decoster's avatar Mathis Decoster :apple:
Browse files

update pour imunité avatar quand il ne joue pas

parent fed231cc
Branches
No related tags found
No related merge requests found
......@@ -165,7 +165,7 @@ document.addEventListener('keyup', handleKeyEvent);
function handleKeyEvent(event) {
keysPressed[event.keyCode] = event.type === 'keydown';
if (event.key === ' ') {
if (event.key === ' ' && gameStarted) {
socket.emit('shoot', {
id: `${socket.id}`,
shoot: true,
......
......@@ -76,6 +76,27 @@
"nom": "uu",
"score": -15
},
{
"score": -15
},
{
"score": -15
},
{
"score": -15
},
{
"score": -35
},
{
"score": 0
},
{
"score": -15
},
{
"score": -15
},
{
"score": -15
}
......
......@@ -325,7 +325,10 @@ function handleAvatarBonusCollisions(avatar) {
if (bonus.hitbox.colision(avatar.hitbox)) {
if (bonusNoms[bonus.getChoix()] == 'vie') {
avatar.gagnerVie();
} else if (bonusNoms[bonus.getChoix()] == 'invincibilite') {
} else if (
bonusNoms[bonus.getChoix()] == 'invincibilite' ||
!gameStarted
) {
avatar.setStatut('invincibilite');
avatar.setStatutTime(t.getTotalTime());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment