serv update
This commit is contained in:
		
							parent
							
								
									a543567b99
								
							
						
					
					
						commit
						9dd7da59f5
					
				
					 1 changed files with 6 additions and 3 deletions
				
			
		|  | @ -55,11 +55,12 @@ function generatePosition(){ | |||
|     } | ||||
|   } | ||||
|   //return x, y;
 | ||||
|   return 500, 100; | ||||
|   return [500, 100]; | ||||
| } | ||||
| 
 | ||||
| function createNewPlayer(socket, name){ | ||||
|   let x, y = generatePosition(); | ||||
|   let pos = generatePosition(); | ||||
|   console.log(pos) | ||||
|   var obj = { | ||||
|     id: playerCount, | ||||
|     x: x, | ||||
|  | @ -91,7 +92,9 @@ function createNewPlayer(socket, name){ | |||
| wss.on('connection', (socket, req) => { | ||||
|   //create new player, send informations to new player and broadcast new player for all
 | ||||
|   let username = url.parse(req.url, true).query.name; | ||||
|   console.log(username); | ||||
|   if(username===undefined){ | ||||
|     username = "joueur" | ||||
|   } | ||||
|   createNewPlayer(socket, username); | ||||
| 
 | ||||
|   socket.on('message', (message) => { | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue