summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
Diffstat (limited to 'play.js')
-rw-r--r--play.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/play.js b/play.js
index e2bf241..4dcf283 100644
--- a/play.js
+++ b/play.js
@@ -502,17 +502,24 @@ function on_update() {
for (let i = 0; i < space_names.length; ++i)
layout[i] = []
+
for (let i = 0; i < 36; ++i) {
if (view.pieces[i] >= 0) {
layout[view.pieces[i]].push(ui.cubes[i])
ui.cubes[i].classList.remove("hide")
- ui.cubes[i].classList.toggle("action", is_piece_action(i))
- ui.cubes[i].classList.toggle("selected", i === view.selected_cube)
- }
- else {
+ } else if (i >= 18) {
ui.cubes[i].classList.add("hide")
}
+ ui.cubes[i].classList.toggle("action", is_piece_action(i))
+ ui.cubes[i].classList.toggle("selected", i === view.selected_cube)
}
+
+ let red_out_of_play = []
+ for (let i = 0; i <= 17; ++i)
+ if (view.pieces[i] < 0)
+ red_out_of_play.push(ui.cubes[i])
+ layout_cubes(red_out_of_play, 1225, 225)
+
for (let i = 0; i < space_count; ++i) {
layout_cubes(layout[i], space_layout_cube[i].x, space_layout_cube[i].y)
ui.spaces[i].classList.toggle("action", is_space_action(i))