bullet silent mode in donjon

This commit is contained in:
Killian Marty 2023-12-30 15:21:05 +01:00
parent 1341c18260
commit 8e23565602
3 changed files with 13 additions and 13 deletions

View file

@ -44,9 +44,9 @@ html, body{
#phoneScreen{ #phoneScreen{
background-color: #322b2a; background-color: #322b2a;
position: absolute; position: absolute;
left: 7%; left: 6.7%;
top: 12%; top: 11.9%;
right: 7%; right: 6.7%;
bottom: 13%; bottom: 13%;
} }

View file

@ -108,9 +108,9 @@ class Player
class Bullet class Bullet
{ {
constructor (x,y,z,dx,dy,id) constructor (x,y,z,dx,dy,id, silent = false)
{ {
if(z==player.z) if(z==player.z && silent!=true)
bulletSound.play(); bulletSound.play();
this.x=x; this.x=x;
this.y=y; this.y=y;

View file

@ -183,8 +183,8 @@ function Donjon() {
if(player.z==10) { if(player.z==10) {
if(lastbulletdonjon[1]>=7) { if(lastbulletdonjon[1]>=7) {
lastbulletdonjon[1]=0 lastbulletdonjon[1]=0
bullets.push(new Bullet(107,95+(Date.now()*0.1)%365,10,1,0,-2)); bullets.push(new Bullet(107,95+(Date.now()*0.1)%365,10,1,0,-2, true));
bullets.push(new Bullet(107,460-(Date.now()*0.1)%365,10,1,0,-2)); bullets.push(new Bullet(107,460-(Date.now()*0.1)%365,10,1,0,-2, true));
} else { } else {
lastbulletdonjon[1]++ lastbulletdonjon[1]++
} }
@ -192,12 +192,12 @@ function Donjon() {
if(Math.floor(Date.now()/1000)%60 > lastbulletdonjon[0]) { if(Math.floor(Date.now()/1000)%60 > lastbulletdonjon[0]) {
lastbulletdonjon[0]=Math.floor(Date.now()/1000)%60 lastbulletdonjon[0]=Math.floor(Date.now()/1000)%60
for(let i=0;i<5;i++){ for(let i=0;i<5;i++){
bullets.push(new Bullet(235,65,10,0,2,-2)); bullets.push(new Bullet(235,65,10,0,2,-2, true));
bullets.push(new Bullet(235,491,10,0,-2,-2)); bullets.push(new Bullet(235,491,10,0,-2,-2, true));
bullets.push(new Bullet(395,65,10,0,2,-2)); bullets.push(new Bullet(395,65,10,0,2,-2, true));
bullets.push(new Bullet(395,491,10,0,-2,-2)); bullets.push(new Bullet(395,491,10,0,-2,-2, true));
bullets.push(new Bullet(615,178,10,0,2,-2)); bullets.push(new Bullet(615,178,10,0,2,-2, true));
bullets.push(new Bullet(615,385,10,0,-2,-2)); bullets.push(new Bullet(615,385,10,0,-2,-2, true));
} }
} }
} }