keyboard
This commit is contained in:
		
							parent
							
								
									31b49f48dc
								
							
						
					
					
						commit
						0f4d37f776
					
				
					 2 changed files with 7 additions and 1 deletions
				
			
		|  | @ -25,6 +25,7 @@ function game() { | |||
| 			players=Net.getPlayersToAdd(); | ||||
| 			//Inp.player=player; //pour connecter les input au joueur client
 | ||||
| 			console.log("Connected as id ",playerId); | ||||
| 			Inp.player=player; | ||||
| 		} | ||||
| 	} | ||||
| 	else | ||||
|  |  | |||
|  | @ -46,6 +46,8 @@ class Input { | |||
|     updateDir(){ | ||||
|         if(this.player==null) | ||||
|             return; | ||||
|         let oldDir=this.dir; | ||||
|         this.dir=0; | ||||
|         if(this.keysDown.has('z')){ | ||||
|             if(this.keysDown.has('d')){ | ||||
|                 this.dir = 2; | ||||
|  | @ -73,7 +75,10 @@ class Input { | |||
|         }else if(this.keysDown.has('q')){ | ||||
|             this.dir = 7; | ||||
|         } | ||||
|         this.player.updateDir(this.dir) | ||||
|         if(oldDir!=this.dir) | ||||
|         { | ||||
|             this.player.changeDirection(this.dir) | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     get getDirection() { | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue