Skip to content
Snippets Groups Projects
Commit 038287a2 authored by Matyáš Latner's avatar Matyáš Latner
Browse files

#45 Save errors count to game score

parent 678560c7
No related branches found
No related tags found
No related merge requests found
......@@ -109,6 +109,7 @@ public class InTheDarknessGame extends AbstractTablexiaGame<Void> implements Map
}
private static final String SCORE_KEY_PLANNING_DURATION = "planning_duration";
private static final String SCORE_KEY_ERRORS_COUNT = "errors_count";
private static final Interpolation.Pow FADE_IN_INTERPOLATION = Interpolation.pow2;
private static final float FADE_DURATION = 0.4f;
......@@ -167,7 +168,7 @@ public class InTheDarknessGame extends AbstractTablexiaGame<Void> implements Map
private Image keyIcon;
private Player player;
private int errorCount;
private int errorsCount;
private int actualMapWidgetNumber;
private Group dimmer;
......@@ -207,7 +208,7 @@ public class InTheDarknessGame extends AbstractTablexiaGame<Void> implements Map
mapWidgets = new ArrayList<MapWidget>();
errorCount = 0;
errorsCount = 0;
actualMapWidgetNumber = 0;
// screen components
......@@ -279,7 +280,7 @@ public class InTheDarknessGame extends AbstractTablexiaGame<Void> implements Map
private boolean actionFinished;
private boolean sequenceStarted = false;
private void performaNextAction(TileMap tileMap) {
private void performNextAction(TileMap tileMap) {
if (player.hasKey()) {
showKeyIcon();
}
......@@ -295,9 +296,7 @@ public class InTheDarknessGame extends AbstractTablexiaGame<Void> implements Map
addAction(delay(FINISH_ACTION_DELAY, run(new Runnable() {
@Override
public void run() {
// if (getGameManager() != null) {
// getGameManager().setCounterAndSave(errorCount);
// }
setGameScore(SCORE_KEY_ERRORS_COUNT, errorsCount);
gameComplete();
}
})));
......@@ -305,8 +304,8 @@ public class InTheDarknessGame extends AbstractTablexiaGame<Void> implements Map
selectedActionPosition++;
}
private void performaErrorAction() {
errorCount++;
private void performErrorAction() {
errorsCount++;
resetGameState();
goToPlanningMode(Integer.valueOf(selectedActionPosition));
}
......@@ -331,10 +330,10 @@ public class InTheDarknessGame extends AbstractTablexiaGame<Void> implements Map
public void onActionFinished(boolean result) {
try {
if (result) {
performaNextAction(tileMap);
performNextAction(tileMap);
} else {
stopGameSequence();
performaErrorAction();
performErrorAction();
}
actionFinished = true;
} catch (Throwable t) {
......@@ -350,7 +349,7 @@ public class InTheDarknessGame extends AbstractTablexiaGame<Void> implements Map
addAction(delay(FINISH_ACTION_DELAY, run(new Runnable() {
@Override
public void run() {
performaErrorAction();
performErrorAction();
}
})));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment