Browse Source

Le message de victoire ne fonctionnait plus

master
Figg 11 months ago
parent
commit
43a173c59b
3 changed files with 5 additions and 6 deletions
  1. 1
    1
      index.html
  2. 4
    4
      js/controller.js
  3. 0
    1
      js/model/game.js

+ 1
- 1
index.html View File

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

+ 4
- 4
js/controller.js View File

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

+ 0
- 1
js/model/game.js View File

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

Loading…
Cancel
Save