Fixed up / down bug
This commit is contained in:
		
							parent
							
								
									2a4a6a7dc9
								
							
						
					
					
						commit
						3832f56cb7
					
				| @ -94,18 +94,12 @@ pub struct KeyboardMap { | ||||
|     /// The key corresponding to the run button.
 | ||||
|     run_key: Key, | ||||
| 
 | ||||
|     /// The key corresponding to the up button.
 | ||||
|     up_key: Key, | ||||
| 
 | ||||
|     /// The key corresponding to the left button.
 | ||||
|     left_key: Key, | ||||
| 
 | ||||
|     /// The key corresponding to the right button.
 | ||||
|     right_key: Key, | ||||
| 
 | ||||
|     /// The key corresponding to the down button.
 | ||||
|     down_key: Key, | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| impl KeyboardMap { | ||||
| @ -115,10 +109,8 @@ impl KeyboardMap { | ||||
|         KeyboardMap { | ||||
|             jump_key: Key::Space, | ||||
|             run_key: Key::LAlt, | ||||
|             up_key: Key::Up, | ||||
|             left_key: Key::Left, | ||||
|             right_key: Key::Right, | ||||
|             down_key: Key::Down, | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| @ -143,7 +135,6 @@ impl KeyboardMap { | ||||
|         let mut ret = Vector2::new(0.0, 0.0); | ||||
| 
 | ||||
|         const RIGHT: Vector2<f32> = Vector2 { x: 1.0, y: 0.0 }; | ||||
|         const UP: Vector2<f32> = Vector2 {x: 0.0, y: 1.0}; | ||||
| 
 | ||||
|         if self.right_key.is_pressed() { | ||||
|             ret += RIGHT; | ||||
| @ -153,14 +144,6 @@ impl KeyboardMap { | ||||
|             ret -= RIGHT; | ||||
|         } | ||||
| 
 | ||||
|         if self.up_key.is_pressed() { | ||||
|             ret += UP; | ||||
|         } | ||||
| 
 | ||||
|         if self.down_key.is_pressed() { | ||||
|             ret -= UP; | ||||
|         } | ||||
| 
 | ||||
|         ret | ||||
| 
 | ||||
|     } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user