Browse Source

L'aspect des tubes est plus joli

master
Figg 7 months ago
parent
commit
f948aa8e36
1 changed files with 22 additions and 5 deletions
  1. 22
    5
      js/drawer.js

+ 22
- 5
js/drawer.js View File

20
 	
20
 	
21
 	draw(game)
21
 	draw(game)
22
 	{
22
 	{
23
-		background('orange');
24
-		
23
+		clear();
24
+
25
 		this.drawTubes(this.padding, this.padding+this.scale, game);
25
 		this.drawTubes(this.padding, this.padding+this.scale, game);
26
 	}
26
 	}
27
 
27
 
46
 		let tubeLevels = tube.height();
46
 		let tubeLevels = tube.height();
47
 		
47
 		
48
 		y += (tubeLevels-1) * this.scale;
48
 		y += (tubeLevels-1) * this.scale;
49
+		strokeWeight(2);
49
 		
50
 		
50
 		for(let i = 0; i < tubeLevels; i++)
51
 		for(let i = 0; i < tubeLevels; i++)
51
 		{
52
 		{
52
-			color = tube.getColorAtLevel(i);
53
+			let layerY = y - i * this.scale;
54
+
55
+			let color = tube.getColorAtLevel(i);
53
 			color == null ? noFill() : fill(color);
56
 			color == null ? noFill() : fill(color);
54
 			
57
 			
55
-			if (i >= 0)
58
+			if (i > 0)
56
 			{
59
 			{
57
-				rect(x, y - i * this.scale, this.scale);
60
+				noStroke();
61
+				rect(x, layerY, this.scale);
62
+				stroke('black');
63
+				line(x, layerY, x, layerY + this.scale);
64
+				line(x + this.scale, layerY, x + this.scale, layerY + this.scale);
65
+			}
66
+			else
67
+			{
68
+				noStroke();
69
+				rect(x, layerY, this.scale, this.scale/2);
70
+				stroke('black');
71
+				line(x, layerY, x, layerY + this.scale/2);
72
+				line(x + this.scale, layerY, x + this.scale, layerY + this.scale/2);
73
+
74
+				arc(x + this.scale/2, layerY + this.scale/2, this.scale, this.scale, 0, PI);
58
 			}
75
 			}
59
 		}
76
 		}
60
 	}
77
 	}

Loading…
Cancel
Save