no more death softlock
This commit is contained in:
		
							parent
							
								
									49b578405e
								
							
						
					
					
						commit
						89b277111a
					
				
					 3 changed files with 8 additions and 5 deletions
				
			
		|  | @ -46,7 +46,10 @@ function updatePlayer(data) | ||||||
|     { |     { | ||||||
|         player.x=data.x; |         player.x=data.x; | ||||||
|         player.y=data.y; |         player.y=data.y; | ||||||
|         player.z=data.z; |         if(data.z==undefined) | ||||||
|  |             player.z=0; | ||||||
|  |         else | ||||||
|  |             player.z=data.z; | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
|  | @ -57,8 +60,9 @@ function updatePlayer(data) | ||||||
|                 players[i].x=data.x; |                 players[i].x=data.x; | ||||||
|                 players[i].y=data.y; |                 players[i].y=data.y; | ||||||
|                 if(data.z==undefined) |                 if(data.z==undefined) | ||||||
|                     data.z=0; |                     players[i].z=0; | ||||||
|                 players[i].z=data.z; |                 else | ||||||
|  |                     players[i].z=data.z; | ||||||
|                 players[i].dir=data.dir; |                 players[i].dir=data.dir; | ||||||
|                 players[i].visibleDir=data.visibleDir; |                 players[i].visibleDir=data.visibleDir; | ||||||
|                 break; |                 break; | ||||||
|  |  | ||||||
|  | @ -7,7 +7,6 @@ class Network{ | ||||||
| 
 | 
 | ||||||
| 	message(data){ | 	message(data){ | ||||||
| 		switch(data.type){ | 		switch(data.type){ | ||||||
| 			 |  | ||||||
| 			case 'connect': | 			case 'connect': | ||||||
| 				this.playerId = data.data.playerId; | 				this.playerId = data.data.playerId; | ||||||
| 				for (let i = 0; i<data.data.players.length; i++) { | 				for (let i = 0; i<data.data.players.length; i++) { | ||||||
|  |  | ||||||
|  | @ -116,7 +116,7 @@ class Render { | ||||||
| 		{ | 		{ | ||||||
| 			background=mapImages[player.z]; | 			background=mapImages[player.z]; | ||||||
| 		} | 		} | ||||||
| 
 | 		 | ||||||
| 		let mapWidth = background.width; | 		let mapWidth = background.width; | ||||||
| 		let mapHeight = background.height; | 		let mapHeight = background.height; | ||||||
| 		this.ctx.canvas.width = mapWidth; | 		this.ctx.canvas.width = mapWidth; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue