Skip to content

Commit

Permalink
Improved score reset mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoTheThird committed Aug 11, 2017
1 parent 5a6c2bd commit 16ddafa
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions qml/modules/Game.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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) {
Expand All @@ -371,8 +371,7 @@ UbuntuShape {
canMerge = false
filled--
}
}
else {
} else {
canMerge = true
}
if (getNumber(i,j).move(app.cols-1-filled,j))
Expand All @@ -394,8 +393,7 @@ UbuntuShape {
canMerge = false
filled--
}
}
else {
} else {
canMerge = true
}
if (getNumber(i,j).move(filled,j))
Expand All @@ -417,8 +415,7 @@ UbuntuShape {
canMerge = false
filled--
}
}
else {
} else {
canMerge = true
}
if (getNumber(i,j).move(i,app.rows-1-filled))
Expand All @@ -440,8 +437,7 @@ UbuntuShape {
canMerge = false
filled--
}
}
else {
} else {
canMerge = true
}
if (getNumber(i,j).move(i,filled))
Expand All @@ -459,5 +455,6 @@ UbuntuShape {
if (!checkNotStuck()) {
app.defeat()
}
points = app.score - scoreBefore
}
}

0 comments on commit 16ddafa

Please sign in to comment.