From 12bc2ed640b0af58e025be0c54081e09d0291d0b Mon Sep 17 00:00:00 2001 From: Baptiste Date: Wed, 27 Dec 2023 16:03:37 +0100 Subject: [PATCH] donjon qui envoie des balles --- public_html/js/game.js | 1 + public_html/js/global.js | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/public_html/js/game.js b/public_html/js/game.js index 873b336..6988aaf 100644 --- a/public_html/js/game.js +++ b/public_html/js/game.js @@ -37,6 +37,7 @@ function game() { let newTime = new Date(); dt=newTime - currentTime; currentTime=newTime; + Donjon() } net.connect(); //connect to server, create a player, and retrieve all players info diff --git a/public_html/js/global.js b/public_html/js/global.js index 2f42a71..9d9bec7 100644 --- a/public_html/js/global.js +++ b/public_html/js/global.js @@ -89,6 +89,8 @@ let maps = [new Game_Map(portals.slice(0,8),0,map0Squares,[]), maps[-1]=maps[0] players.push(new Player(-1,-50,-50,-1,"VOITURES",0)); + +players.push(new Player(-2,-50,-50,-1,"DONJON",0)); function updatePlayer(data) { @@ -167,3 +169,25 @@ function updateBullets(dt) } } } + +let lastbulletdonjon=[0] +function Donjon() { + if(player.z==10) { + if(lastbulletdonjon[0]==59) { lastbulletdonjon[0]=0 } + if(Math.floor(Date.now()/1000)%60 > lastbulletdonjon[0]) { + lastbulletdonjon[0]=Math.floor(Date.now()/1000)%60 + bullets.push(new Bullet(235,65,10,0,2,-2)); + bullets.push(new Bullet(235,491,10,0,-2,-2)); + bullets.push(new Bullet(395,65,10,0,2,-2)); + bullets.push(new Bullet(395,491,10,0,-2,-2)); + bullets.push(new Bullet(104,209,10,2,0,-2)); + bullets.push(new Bullet(107,356,10,2,0,-2)); + bullets.push(new Bullet(235,65,10,0,2,-2)); + bullets.push(new Bullet(235,491,10,0,-2,-2)); + bullets.push(new Bullet(395,65,10,0,2,-2)); + bullets.push(new Bullet(395,491,10,0,-2,-2)); + bullets.push(new Bullet(104,209,10,2,0,-2)); + bullets.push(new Bullet(107,356,10,2,0,-2)); + } + } +} \ No newline at end of file