about summary refs log tree commit diff stats
path: root/html
diff options
context:
space:
mode:
Diffstat (limited to 'html')
-rw-r--r--html/mountain/game.js23
1 files changed, 17 insertions, 6 deletions
diff --git a/html/mountain/game.js b/html/mountain/game.js
index 8cbfa4d..7db1892 100644
--- a/html/mountain/game.js
+++ b/html/mountain/game.js
@@ -30,6 +30,11 @@ const PARTITION_RATIO = 0.3;
 const MIN_PLATFORM_SPACING = 100;
 const DEADLY_BORDER_HEIGHT = 7;
 
+const ENEMY_SPEED = 2;
+
+const FALLING_PLATFORM_DELAY = 800;
+const FALLING_PLATFORM_GRAVITY = 0.5;
+
 const FPS = 60;
 const FRAME_TIME = 1000 / FPS;
 
@@ -44,11 +49,6 @@ const DEATH_PARTICLE_SIZE = 4;
 const DEATH_PARTICLE_LIFETIME = 50;
 const DEATH_ANIMATION_DURATION = 55;
 
-const ENEMY_SPEED = 2;
-
-const FALLING_PLATFORM_DELAY = 800;
-const FALLING_PLATFORM_GRAVITY = 0.5;
-
 const PLATFORM_PARTICLE_COUNT = 30;
 const PLATFORM_PARTICLE_SPEED = 8;
 const PLATFORM_PARTICLE_SIZE = 4;
@@ -154,12 +154,23 @@ function platformsOverlap(platform1, platform2) {
 
 function createParticle(x, y, velocityY) {
     return {
+        // Randomly places particles around the player, within the player's width
         x: x + PLAYER_SIZE / 2 + (Math.random() - 0.5) * PLAYER_SIZE,
+        
+        // Put particles to the top or bottom of the player depending on the direction
+        // the player is moving
         y: y + (velocityY > 0 ? 0 : PLAYER_SIZE),
+        
+        // Zoot out to the left and right of the player
         velocityX: (Math.random() - 0.5) * PARTICLE_SPEED * 2,
+        
+        // Zoot up or down, matching the player's direction
         velocityY: (Math.random() * PARTICLE_SPEED) * Math.sign(velocityY),
+        
+        // Add some variety to the particle sizes
         size: PARTICLE_SIZE + Math.random() * 2,
-        life: PARTICLE_LIFETIME,
+        
+        life: PARTICLE_LIFETIME,        
         initialOpacity: 0.3 + Math.random() * 0.7
     };
 }
ommit/html/apps/raytracing/2.mu.html?h=hlt&id=6112864aeac32ec21bd27bfce6b9c44d6a74d45c'>6112864a ^
3350c34a ^

6112864a ^
d3a9db3a ^
3350c34a ^
6112864a ^
































3350c34a ^
6112864a ^
d3a9db3a ^




3350c34a ^
d3a9db3a ^
6112864a ^
dd60a1d7 ^
3350c34a ^






6112864a ^


3350c34a ^
6112864a ^


dd60a1d7 ^
d3a9db3a ^
3350c34a ^


6112864a ^



d3a9db3a ^
3350c34a ^


6112864a ^
d3a9db3a ^
3350c34a ^
6112864a ^
d3a9db3a ^
3350c34a ^
dd60a1d7 ^
3350c34a ^
6112864a ^

3350c34a ^
6112864a ^

3d1c4216 ^
6112864a ^

dd60a1d7 ^
d3a9db3a ^
6112864a ^




d3a9db3a ^
3350c34a ^



d3a9db3a ^
3350c34a ^





d3a9db3a ^
3350c34a ^





d3a9db3a ^
3350c34a ^





f6eba676 ^
6112864a ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149