mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Forbedrer translateToDirection funksjonen i GameLauncher
This commit is contained in:
parent
6a544086e1
commit
aa24075874
@ -160,16 +160,18 @@ public class GameLauncher extends ApplicationAdapter implements InputProcessor {
|
|||||||
private int[] translateToDirection(float x, float y) {
|
private int[] translateToDirection(float x, float y) {
|
||||||
int outX = 0;
|
int outX = 0;
|
||||||
int outY = 0;
|
int outY = 0;
|
||||||
if (Math.round(camera.up.x) == 0 && Math.round(camera.up.y) == 1) {
|
int upX = Math.round(camera.up.x);
|
||||||
|
int upY = Math.round(camera.up.y);
|
||||||
|
if (upX == 0 && Math.round(camera.up.y) == 1) {
|
||||||
outX = (int)-x;
|
outX = (int)-x;
|
||||||
outY = (int)y;
|
outY = (int)y;
|
||||||
} else if (Math.round(camera.up.x) == 0 && Math.round(camera.up.y) == -1) {
|
} else if (upX == 0 && upY == -1) {
|
||||||
outX = (int)x;
|
outX = (int)x;
|
||||||
outY = (int)-y;
|
outY = (int)-y;
|
||||||
} else if (Math.round(camera.up.x) == -1 && Math.round(camera.up.y) == 0) {
|
} else if (upX == -1 && upY == 0) {
|
||||||
outX = (int)-y;
|
outX = (int)-y;
|
||||||
outY = (int)-x;
|
outY = (int)-x;
|
||||||
} else if (Math.round(camera.up.x) == 1 && Math.round(camera.up.y) == 0) {
|
} else if (upX == 1 && upY == 0) {
|
||||||
outX = (int)y;
|
outX = (int)y;
|
||||||
outY = (int)x;
|
outY = (int)x;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,6 @@ public class DrawableObjectTest {
|
|||||||
assertEquals(HEIGHT_MAX_ARG, drawableObjectMaximumArguments.getHeight());
|
assertEquals(HEIGHT_MAX_ARG, drawableObjectMaximumArguments.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getRotationMinArg() {
|
public void getRotationMinArg() {
|
||||||
assertEquals(0, drawableObjectMinimumArguments.getRotation());
|
assertEquals(0, drawableObjectMinimumArguments.getRotation());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user