From 16ddafac88c322be4e8224725cc26d8096638685 Mon Sep 17 00:00:00 2001 From: NeoTheThird Date: Sat, 12 Aug 2017 00:19:30 +0200 Subject: [PATCH] Improved score reset mechanism --- qml/modules/Game.qml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/qml/modules/Game.qml b/qml/modules/Game.qml index 2bd26e7..3a7f42f 100644 --- a/qml/modules/Game.qml +++ b/qml/modules/Game.qml @@ -176,8 +176,7 @@ UbuntuShape { return false if (app.getNumber(h, v)) { number += app.getNumber(h, v).number - app.points = number - app.score += points + app.score += number if (number == finalValue && !won) { won = true app.victory() @@ -358,6 +357,7 @@ UbuntuShape { function move(col, row) { save() reversible = true + var scoreBefore = app.score var somethingMoved = false var tmp = numbers if (col > 0) { @@ -371,8 +371,7 @@ UbuntuShape { canMerge = false filled-- } - } - else { + } else { canMerge = true } if (getNumber(i,j).move(app.cols-1-filled,j)) @@ -394,8 +393,7 @@ UbuntuShape { canMerge = false filled-- } - } - else { + } else { canMerge = true } if (getNumber(i,j).move(filled,j)) @@ -417,8 +415,7 @@ UbuntuShape { canMerge = false filled-- } - } - else { + } else { canMerge = true } if (getNumber(i,j).move(i,app.rows-1-filled)) @@ -440,8 +437,7 @@ UbuntuShape { canMerge = false filled-- } - } - else { + } else { canMerge = true } if (getNumber(i,j).move(i,filled)) @@ -459,5 +455,6 @@ UbuntuShape { if (!checkNotStuck()) { app.defeat() } + points = app.score - scoreBefore } }