瀏覽代碼

Le message de victoire ne fonctionnait plus

master
Figg 7 月之前
父節點
當前提交
43a173c59b
共有 3 個檔案被更改,包括 5 行新增6 行删除
  1. 1
    1
      index.html
  2. 4
    4
      js/controller.js
  3. 0
    1
      js/model/game.js

+ 1
- 1
index.html 查看文件

@@ -8,8 +8,8 @@
8 8
 	<link href="./css/style.css" rel="stylesheet">
9 9
 	<script src="./js/lib/p5.min.js"></script>
10 10
 	<script src="./js/model/tube.js"></script>
11
-	<script src="./js/ui.js"></script>
12 11
 	<script src="./js/model/game.js"></script>
12
+	<script src="./js/ui.js"></script>
13 13
 	<script src="./js/drawer.js"></script>
14 14
 	<script src="./js/controller.js"></script>
15 15
 	<script src="./js/main.js"></script>

+ 4
- 4
js/controller.js 查看文件

@@ -18,7 +18,7 @@ class Controller
18 18
 		this.#drawer.computeGameParams(params.TUBESNUMBERS, params.TUBESLEVELS);
19 19
 
20 20
 		this.ui = new UI(800, 600);
21
-		this.lastTime = 0;
21
+		this.lastTime = millis();
22 22
 		
23 23
 		this.initializeColorTubes(params.TUBESLEVELS - 1);
24 24
 		
@@ -126,15 +126,15 @@ class Controller
126 126
 	
127 127
 	runLoop()
128 128
 	{
129
-		const timeDelta = millis() - this.lastTime;
129
+		let timeDelta = millis() - this.lastTime;
130 130
 		// peut-être pas nécessaire de limiter le framerate
131
-		if (timeDelta < 50)
131
+		if (timeDelta < 1000 / 60)
132 132
 			return;
133 133
 		this.lastTime = millis();
134 134
 		
135 135
 		const steps = [
136 136
 			(this.needUpdate || this.#game.isCompleted) && this.drawGame,
137
-			this.#game.isCompleted && this.drawUI
137
+			this.#game.isComplete() && this.drawUI
138 138
 		]
139 139
 
140 140
 		steps.forEach(step => step && step.call(this));

+ 0
- 1
js/model/game.js 查看文件

@@ -6,7 +6,6 @@ class Game {
6 6
 	{
7 7
 		this.#tubes = [];
8 8
 		this.#selectedTube = null;
9
-		this.isCompleted = false;
10 9
 
11 10
 		for (let i = 0; i < nbTubes; i++)
12 11
 		{

Loading…
取消
儲存