donjon qui envoie des balles
This commit is contained in:
		
							parent
							
								
									fc1f8642b5
								
							
						
					
					
						commit
						12bc2ed640
					
				
					 2 changed files with 25 additions and 0 deletions
				
			
		|  | @ -37,6 +37,7 @@ function game() { | ||||||
| 	let newTime = new Date(); | 	let newTime = new Date(); | ||||||
| 	dt=newTime - currentTime; | 	dt=newTime - currentTime; | ||||||
| 	currentTime=newTime; | 	currentTime=newTime; | ||||||
|  | 	Donjon() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| net.connect(); //connect to server, create a player, and retrieve all players info
 | net.connect(); //connect to server, create a player, and retrieve all players info
 | ||||||
|  |  | ||||||
|  | @ -89,6 +89,8 @@ let maps = [new Game_Map(portals.slice(0,8),0,map0Squares,[]), | ||||||
| maps[-1]=maps[0] | maps[-1]=maps[0] | ||||||
|          |          | ||||||
| players.push(new Player(-1,-50,-50,-1,"VOITURES",0)); | players.push(new Player(-1,-50,-50,-1,"VOITURES",0)); | ||||||
|  |          | ||||||
|  | players.push(new Player(-2,-50,-50,-1,"DONJON",0)); | ||||||
| 
 | 
 | ||||||
| function updatePlayer(data) | 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)); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
		Loading…
	
		Reference in a new issue