Skip to content

Commit

Permalink
Smoothed the controls again.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGussio committed Jun 12, 2017
1 parent 2e9a93e commit 5b14488
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions core/src/ga/gussio/ld38/earthinvaders/screen/GameScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public GameScreen() {
scoreFont = new BitmapFont(Gdx.files.internal("score.fnt"), Gdx.files.internal("score.png"), false);
scoreFont.getData().setScale(0.8f);

leftButton = new Button(10, 60, 180, "buttons/control_button.png");
rightButton = new Button(150, 60, "buttons/control_button.png");
leftButton = new Button(10, 10, 180, "buttons/control_button.png");
rightButton = new Button(150, 10, "buttons/control_button.png");

exit = new Button(1230, 450, "buttons/exit.png");
retry = new Button(500, 450, "buttons/retry.png");
Expand Down Expand Up @@ -265,8 +265,13 @@ public void touchDragged(int screenX, int screenY, int pointer) {
Vector3 coords = camera.unproject(new Vector3(screenX, screenY, 0));
boolean left = leftButton.drag(new Vector2(coords.x, coords.y));
boolean right = rightButton.drag(new Vector2(coords.x, coords.y));
if(pointers.containsKey(pointer)) {
int currentValue = pointers.get(pointer);
int currentValue;
if(pointers.containsKey(pointers)) {
currentValue = pointers.get(pointer);
pointers.remove(pointer);
}else{
currentValue = 0;
}
if (left) {
pointers.put(pointer, 1);
leftButton.clicked = true;
Expand All @@ -282,8 +287,6 @@ public void touchDragged(int screenX, int screenY, int pointer) {
else if (currentValue == 2)
rightButton.clicked = false;
}
pointers.remove(pointer);
}
retry.drag(new Vector2(coords.x, coords.y));
exit.drag(new Vector2(coords.x, coords.y));
}
Expand Down

0 comments on commit 5b14488

Please sign in to comment.