Skip to content

Commit

Permalink
Some layout changes.
Browse files Browse the repository at this point in the history
Don't count enclosed dots as cleared.
Start with scores, not new game.
Don't finish move if closed loop.
In time mode, add 5 seconds to timer.
  • Loading branch information
abranson committed Jan 19, 2020
1 parent 4272ad8 commit 34fd443
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
38 changes: 23 additions & 15 deletions qml/MainPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Page {
color: Theme.highlightColor
Label {
id: moves_label
text: "0"
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Expand Down Expand Up @@ -98,6 +99,7 @@ Page {
color: Theme.highlightColor
Label {
id: score_label
text: "0"
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Expand Down Expand Up @@ -125,6 +127,7 @@ Page {
color: Theme.highlightColor
Label {
id: current_label
text: "0"
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Expand Down Expand Up @@ -193,8 +196,9 @@ Page {
game.dots[x] = new Array(6)
}

actions.start_game()
//actions.start_game()
game.layout()
result_box.scale = 1.5
}
}
}
Expand All @@ -207,19 +211,19 @@ Page {
id: result_box
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
width: 120
width: Theme.itemSize.Huge
height: width
radius: width / 2
color: Theme.highlightColor
MouseArea {
id: result_restart
anchors.fill: parent
onClicked: actions.start_game()
enabled: result_box.visible;
}
Label {
id: result_label
anchors.fill: parent
text: "999"
text: "Colourdots"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "white"
Expand Down Expand Up @@ -419,11 +423,6 @@ Page {
line_width = Math.round(dot_radius / 2)
result_box.width = dot_radius * 10

for (var x = 0; x < dots.length; x++)
for (var y = 0; y < dots[0].length; y++)
place_dot(dots[x][y])
for (var i = 0; i < lines.length; line++)
lines[i].width = line_width
}

function place_dot(dot) {
Expand Down Expand Up @@ -455,10 +454,9 @@ Page {
}
// If go to new dot beside this one then extend line
else if (nearest !== last_dot && nearest.color === last_dot.color && d <= 2) {
// If already had this dot selected, then made a loop!
// already had this dot selected
for (var i = 0; i < selected_dots.length; i++) {
if (selected_dots[i] === nearest) {
complete()
return
}
}
Expand Down Expand Up @@ -563,14 +561,22 @@ Page {
if (below) merge_array(fill_dots, below)
}
//console.log("Total: "+fill_dots.length)

while (fill_dots.length > 0) {
var thisDot = fill_dots.pop()
if (dots[thisDot.x_coord][thisDot.y_coord] === undefined)
continue
dots[thisDot.x_coord][thisDot.y_coord] = undefined
if (fill_dots.length > 0) {
if (play_mode === "time")
time_left+=5
else
n_moves++
}
else {
n_cleared++
}
thisDot.destroy()
n_cleared++
if (fill_dots.length > 0) n_moves++
}

}
Expand Down Expand Up @@ -624,7 +630,8 @@ Page {

function init_game() {
// Hide UI
result_box.visible = false;
result_box.scale = 0;
result_restart.enabled = false;
score_history_label.opacity = 0

// Fade game in
Expand All @@ -646,7 +653,8 @@ Page {

// Show result
result_label.text = n_cleared
result_box.visible = true;
result_box.scale = 1;
result_restart.enabled = true;
score_history_label.opacity = 1

update_scores(n_cleared);
Expand Down
5 changes: 2 additions & 3 deletions rpm/harbour-colourdots.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ Name: harbour-colourdots
%{!?qtc_qmake5:%define qtc_qmake5 %qmake5}
%{!?qtc_make:%define qtc_make make}
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: Link as many same coloured dots as you can. Close a shape to include its contents!
Version: 0.5
Summary: Link coloured dots for points. Make loops for bonuses.
Version: 1.0
Release: 1
Group: Amusements/Games
License: LICENSE
URL: http://github.com/abranson/colourdots
Source0: %{name}-%{version}.tar.bz2
Expand Down

0 comments on commit 34fd443

Please sign in to comment.