Merge branch 'dev' of https://git.etud.insa-toulouse.fr/rebillar/GrandTabernacleAutoVI into dev
This commit is contained in:
		
						commit
						cfbfee45fb
					
				
					 2 changed files with 5 additions and 2 deletions
				
			
		|  | @ -35,7 +35,7 @@ class Network{ | ||||||
| 				this.playersToRemove.push(data.data.id); | 				this.playersToRemove.push(data.data.id); | ||||||
| 				break; | 				break; | ||||||
| 			case "newBullet": | 			case "newBullet": | ||||||
| 				this.bulletsToAdd.push(new Bullet(data.x,data.y,data.dx,data.dy)); | 				this.bulletsToAdd.push(new Bullet(data.data.x,data.data.y,data.data.dx,data.data.dy)); | ||||||
| 				break; | 				break; | ||||||
| 			default: | 			default: | ||||||
| 				break; | 				break; | ||||||
|  | @ -61,7 +61,7 @@ class Network{ | ||||||
| 
 | 
 | ||||||
| 	newBullet(x_,y_,dx_,dy_) | 	newBullet(x_,y_,dx_,dy_) | ||||||
| 	{ | 	{ | ||||||
| 		this.socket.send(JSON.stringify({type:"newBullet",x: x_,y: y_,dx: dx_,dy: dy_})); | 		this.socket.send(JSON.stringify({type:"newBullet",data:{x: x_,y: y_,dx: dx_,dy: dy_}})); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	getPlayersToAdd(){  //returns the list of new players
 | 	getPlayersToAdd(){  //returns the list of new players
 | ||||||
|  |  | ||||||
|  | @ -113,6 +113,9 @@ wss.on('connection', (socket, req) => { | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|       broadcast(JSON.stringify(message), socket.id); |       broadcast(JSON.stringify(message), socket.id); | ||||||
|  |     } else if(message.type=="newBullet"){ | ||||||
|  |       console.log(message); | ||||||
|  |       broadcast(JSON.stringify(message), socket.id); | ||||||
|     } |     } | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue