Spaces:
Running
Running
cutechicken
commited on
Commit
β’
0e11cb1
1
Parent(s):
e9310dc
Update game.js
Browse files
game.js
CHANGED
@@ -150,50 +150,50 @@ class TankPlayer {
|
|
150 |
}
|
151 |
|
152 |
createMuzzleFlash(scene) {
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
flashGroup.position.copy(this.body.position).add(muzzlePosition);
|
188 |
|
189 |
-
|
190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
-
// μΌμ μκ° ν μ κ±°
|
193 |
-
setTimeout(() => {
|
194 |
-
scene.remove(flashGroup);
|
195 |
-
}, 300); // 300ms μ μ§
|
196 |
-
}
|
197 |
|
198 |
|
199 |
createBullet(scene) {
|
|
|
150 |
}
|
151 |
|
152 |
createMuzzleFlash(scene) {
|
153 |
+
const flashGroup = new THREE.Group();
|
154 |
+
|
155 |
+
// νμΌ μμ±
|
156 |
+
const flameGeometry = new THREE.SphereGeometry(0.5, 8, 8);
|
157 |
+
const flameMaterial = new THREE.MeshBasicMaterial({
|
158 |
+
color: 0xffa500,
|
159 |
+
transparent: true,
|
160 |
+
opacity: 0.8
|
161 |
+
});
|
162 |
+
const flame = new THREE.Mesh(flameGeometry, flameMaterial);
|
163 |
+
flame.scale.set(1.5, 1.5, 2);
|
164 |
+
flashGroup.add(flame);
|
165 |
+
|
166 |
+
// μ°κΈ° μμ±
|
167 |
+
const smokeGeometry = new THREE.SphereGeometry(0.3, 8, 8);
|
168 |
+
const smokeMaterial = new THREE.MeshBasicMaterial({
|
169 |
+
color: 0x555555,
|
170 |
+
transparent: true,
|
171 |
+
opacity: 0.5
|
172 |
+
});
|
173 |
+
for (let i = 0; i < 3; i++) {
|
174 |
+
const smoke = new THREE.Mesh(smokeGeometry, smokeMaterial);
|
175 |
+
smoke.position.set(
|
176 |
+
Math.random() * 0.5 - 0.25,
|
177 |
+
Math.random() * 0.5 - 0.25,
|
178 |
+
-0.5 - Math.random() * 0.5
|
179 |
+
);
|
180 |
+
flashGroup.add(smoke);
|
181 |
+
}
|
182 |
|
183 |
+
// μμΉ μ€μ (ν¬ν λ)
|
184 |
+
const muzzlePosition = new THREE.Vector3(0, 0, 2); // ν¬ν λ μλ μ’ν
|
185 |
+
this.turret.getWorldPosition(muzzlePosition); // ν¬ν λμ μ μ μ’ν κ³μ°
|
186 |
+
flashGroup.position.copy(muzzlePosition);
|
|
|
187 |
|
188 |
+
// μ¬μ μΆκ°
|
189 |
+
scene.add(flashGroup);
|
190 |
+
|
191 |
+
// μΌμ μκ° ν μ κ±°
|
192 |
+
setTimeout(() => {
|
193 |
+
scene.remove(flashGroup);
|
194 |
+
}, 300); // 300ms μ μ§
|
195 |
+
}
|
196 |
|
|
|
|
|
|
|
|
|
|
|
197 |
|
198 |
|
199 |
createBullet(scene) {
|