Merge branch 'dev' of https://git.etud.insa-toulouse.fr/rebillar/GrandTabernacleAutoVI into dev
This commit is contained in:
		
						commit
						7b7da9b4eb
					
				
					 4 changed files with 12 additions and 10 deletions
				
			
		|  | @ -32,11 +32,6 @@ class Player | |||
|     takeDamage(amount) | ||||
|     { | ||||
|         this.health-=amount; | ||||
|         if(this.health<=0) | ||||
|         { | ||||
|             //send death message to server
 | ||||
|             //this.reset()
 | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     retrieveServerInfo(id,x,y,dir) | ||||
|  |  | |||
							
								
								
									
										12
									
								
								js/game.js
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								js/game.js
									
									
									
									
									
								
							|  | @ -133,10 +133,14 @@ function game() { | |||
| 		remPlayers(); | ||||
| 		addBullets(); | ||||
| 		player.update(squares, circles, dt); | ||||
| 
 | ||||
| 		players.forEach((p) => { | ||||
| 			p.update(squares, circles, dt); | ||||
| 		}); | ||||
| 		if(player.health <= 0) | ||||
| 		{ | ||||
| 			Net.died(player.id); | ||||
| 			player.health=10; | ||||
| 		} | ||||
| 		for (var i = players.length - 1; i >= 0; i--) { | ||||
| 			players[i].update(squares, circles, dt); | ||||
| 		} | ||||
| 		Renderer.ReloadAff(); | ||||
| 		updateBullets(dt); | ||||
| 		LB.ReloadAff(players, player); | ||||
|  |  | |||
|  | @ -52,6 +52,10 @@ class Network{ | |||
| 		}) | ||||
| 	} | ||||
| 
 | ||||
| 	die(id_){ | ||||
| 		this.socket.send(JSON.stringify({type:"died",data:{id:id_}})); | ||||
| 	} | ||||
| 
 | ||||
| 	update(obj){ 		//send data to server in order to broadcast
 | ||||
| 		this.socket.send(JSON.stringify({ | ||||
| 			type: "update", | ||||
|  |  | |||
|  | @ -122,7 +122,6 @@ wss.on('connection', (socket, req) => { | |||
|       broadcast(JSON.stringify(message), socket.id); | ||||
| 
 | ||||
|     } else if(message.type=="died"){ | ||||
| 
 | ||||
|       broadcast(JSON.stringify(message), socket.id); | ||||
|       for (var i = players.length - 1; i >= 0; i--) { | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue