mirror of
				https://github.com/inf112-v20/Fiasko.git
				synced 2025-10-31 09:43:45 +01:00 
			
		
		
		
	Gir noen variabler og metoder klarere navn
This commit is contained in:
		| @@ -145,9 +145,9 @@ public class GameLauncher extends ApplicationAdapter implements InputProcessor { | |||||||
|         Vector2 newTouch = new Vector2(screenX, screenY); |         Vector2 newTouch = new Vector2(screenX, screenY); | ||||||
|         Vector2 diff = newTouch.cpy().sub(lastTouch); |         Vector2 diff = newTouch.cpy().sub(lastTouch); | ||||||
|         lastTouch = newTouch; |         lastTouch = newTouch; | ||||||
|         int[] change = translateToDirection(diff.x, diff.y); |         int[] positionChange = translateCoordinateAccountingForCameraRotation(diff.x, diff.y); | ||||||
|         cameraX = change[0]; |         cameraX = positionChange[0]; | ||||||
|         cameraY = change[1]; |         cameraY = positionChange[1]; | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -157,21 +157,21 @@ public class GameLauncher extends ApplicationAdapter implements InputProcessor { | |||||||
|      * @param y The y coordinate to translate |      * @param y The y coordinate to translate | ||||||
|      * @return A list containing the translated coordinates of x and y |      * @return A list containing the translated coordinates of x and y | ||||||
|      */ |      */ | ||||||
|     private int[] translateToDirection(float x, float y) { |     private int[] translateCoordinateAccountingForCameraRotation(float x, float y) { | ||||||
|         int outX = 0; |         int outX = 0; | ||||||
|         int outY = 0; |         int outY = 0; | ||||||
|         int upX = Math.round(camera.up.x); |         int cameraUpX = Math.round(camera.up.x); | ||||||
|         int upY = Math.round(camera.up.y); |         int cameraUpY = Math.round(camera.up.y); | ||||||
|         if (upX == 0 && Math.round(camera.up.y) == 1) { |         if (cameraUpX == 0 && Math.round(camera.up.y) == 1) { | ||||||
|             outX = (int)-x; |             outX = (int)-x; | ||||||
|             outY = (int)y; |             outY = (int)y; | ||||||
|         } else if (upX == 0 && upY == -1) { |         } else if (cameraUpX == 0 && cameraUpY == -1) { | ||||||
|             outX = (int)x; |             outX = (int)x; | ||||||
|             outY = (int)-y; |             outY = (int)-y; | ||||||
|         } else if (upX == -1 && upY == 0) { |         } else if (cameraUpX == -1 && cameraUpY == 0) { | ||||||
|             outX = (int)-y; |             outX = (int)-y; | ||||||
|             outY = (int)-x; |             outY = (int)-x; | ||||||
|         } else if (upX == 1 && upY == 0) { |         } else if (cameraUpX == 1 && cameraUpY == 0) { | ||||||
|             outX = (int)y; |             outX = (int)y; | ||||||
|             outY = (int)x; |             outY = (int)x; | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user