Browse Source

le plateau est nettoyé quand le jeu est fini

pull/1/head
Figg 11 months ago
parent
commit
8cf604f999
3 changed files with 11 additions and 1 deletions
  1. 1
    1
      index.html
  2. 0
    0
      js/controller.js
  3. 10
    0
      js/game.js

+ 1
- 1
index.html View File

@@ -10,7 +10,7 @@
10 10
 	<script src="./js/tube.js"></script>
11 11
 	<script src="./js/game.js"></script>
12 12
 	<script src="./js/drawer.js"></script>
13
-	<script src="./js/sketch.js"></script>
13
+	<script src="./js/controller.js"></script>
14 14
 </head>
15 15
 
16 16
 <body>

js/sketch.js → js/controller.js View File


+ 10
- 0
js/game.js View File

@@ -87,6 +87,16 @@ class Game {
87 87
 			this.tubes.splice(tubeIndex, 1);
88 88
 			
89 89
 			if (this.selectedTube == tube) this.selectedTube = null;
90
+			
91
+			this.checkGameCompletion();
92
+		}
93
+	}
94
+	
95
+	checkGameCompletion()
96
+	{
97
+		if (this.tubes.length == 1 && this.tubes[0].isEmpty())
98
+		{
99
+			this.tubes = [];
90 100
 		}
91 101
 	}
92 102
 }

Loading…
Cancel
Save