Spaces:
Running
Running
cutechicken
commited on
Commit
β’
71f9ded
1
Parent(s):
20cb103
Update game.js
Browse files
game.js
CHANGED
@@ -633,164 +633,6 @@ class Enemy {
|
|
633 |
maxConsecutiveHits: 3
|
634 |
};
|
635 |
}
|
636 |
-
createMassiveExplosion() {
|
637 |
-
// μ€μ¬ νλ°
|
638 |
-
const explosionGroup = new THREE.Group();
|
639 |
-
|
640 |
-
// μ£Ό νλ° νλμ
|
641 |
-
const flashGeometry = new THREE.SphereGeometry(8);
|
642 |
-
const flashMaterial = new THREE.MeshBasicMaterial({
|
643 |
-
color: 0xffff00,
|
644 |
-
transparent: true,
|
645 |
-
opacity: 1
|
646 |
-
});
|
647 |
-
const flash = new THREE.Mesh(flashGeometry, flashMaterial);
|
648 |
-
flash.position.copy(this.mesh.position);
|
649 |
-
this.scene.add(flash);
|
650 |
-
|
651 |
-
// λ€μ€ νλ° νν°ν΄
|
652 |
-
for (let i = 0; i < 100; i++) { // νν°ν΄ μ μ¦κ°
|
653 |
-
const size = Math.random() * 2 + 1;
|
654 |
-
const geometry = new THREE.SphereGeometry(size);
|
655 |
-
|
656 |
-
// λ€μν νλ° μμ
|
657 |
-
const colors = [0xff4500, 0xff8c00, 0xff0000, 0xffd700, 0xff6347];
|
658 |
-
const material = new THREE.MeshBasicMaterial({
|
659 |
-
color: colors[Math.floor(Math.random() * colors.length)],
|
660 |
-
transparent: true,
|
661 |
-
opacity: 1
|
662 |
-
});
|
663 |
-
|
664 |
-
const particle = new THREE.Mesh(geometry, material);
|
665 |
-
particle.position.copy(this.mesh.position);
|
666 |
-
|
667 |
-
// λ κ°λ ₯ν νλ° ν¨κ³Όλ₯Ό μν μλ μ¦κ°
|
668 |
-
const speed = Math.random() * 2 + 1;
|
669 |
-
const angle = Math.random() * Math.PI * 2;
|
670 |
-
const elevation = Math.random() * Math.PI - Math.PI / 2;
|
671 |
-
|
672 |
-
particle.velocity = new THREE.Vector3(
|
673 |
-
Math.cos(angle) * Math.cos(elevation) * speed,
|
674 |
-
Math.sin(elevation) * speed,
|
675 |
-
Math.sin(angle) * Math.cos(elevation) * speed
|
676 |
-
);
|
677 |
-
|
678 |
-
particle.gravity = -0.1;
|
679 |
-
particle.life = Math.random() * 60 + 60;
|
680 |
-
particle.fadeRate = 0.98;
|
681 |
-
|
682 |
-
this.scene.add(particle);
|
683 |
-
window.gameInstance.particles.push({
|
684 |
-
mesh: particle,
|
685 |
-
velocity: particle.velocity,
|
686 |
-
gravity: particle.gravity,
|
687 |
-
life: particle.life,
|
688 |
-
fadeRate: particle.fadeRate
|
689 |
-
});
|
690 |
-
}
|
691 |
-
|
692 |
-
// νλ° λ§ μ΄ννΈ
|
693 |
-
for (let i = 0; i < 3; i++) {
|
694 |
-
const ringGeometry = new THREE.RingGeometry(0.1, 4, 32);
|
695 |
-
const ringMaterial = new THREE.MeshBasicMaterial({
|
696 |
-
color: 0xff8c00,
|
697 |
-
transparent: true,
|
698 |
-
opacity: 1,
|
699 |
-
side: THREE.DoubleSide
|
700 |
-
});
|
701 |
-
const ring = new THREE.Mesh(ringGeometry, ringMaterial);
|
702 |
-
ring.position.copy(this.mesh.position);
|
703 |
-
ring.rotation.x = Math.random() * Math.PI;
|
704 |
-
ring.rotation.y = Math.random() * Math.PI;
|
705 |
-
this.scene.add(ring);
|
706 |
-
|
707 |
-
// λ§ νμ₯ μ λλ©μ΄μ
|
708 |
-
const expandRing = () => {
|
709 |
-
ring.scale.x += 0.3;
|
710 |
-
ring.scale.y += 0.3;
|
711 |
-
ring.material.opacity *= 0.96;
|
712 |
-
|
713 |
-
if (ring.material.opacity > 0.01) {
|
714 |
-
requestAnimationFrame(expandRing);
|
715 |
-
} else {
|
716 |
-
this.scene.remove(ring);
|
717 |
-
}
|
718 |
-
};
|
719 |
-
expandRing();
|
720 |
-
}
|
721 |
-
|
722 |
-
// νμΌ κΈ°λ₯ ν¨κ³Ό
|
723 |
-
const fireColumn = new THREE.Group();
|
724 |
-
for (let i = 0; i < 20; i++) {
|
725 |
-
const fireGeometry = new THREE.ConeGeometry(2, 8, 8);
|
726 |
-
const fireMaterial = new THREE.MeshBasicMaterial({
|
727 |
-
color: 0xff4500,
|
728 |
-
transparent: true,
|
729 |
-
opacity: 0.8
|
730 |
-
});
|
731 |
-
const fire = new THREE.Mesh(fireGeometry, fireMaterial);
|
732 |
-
fire.position.y = i * 0.5;
|
733 |
-
fire.rotation.x = Math.random() * Math.PI;
|
734 |
-
fire.rotation.z = Math.random() * Math.PI;
|
735 |
-
fireColumn.add(fire);
|
736 |
-
}
|
737 |
-
fireColumn.position.copy(this.mesh.position);
|
738 |
-
this.scene.add(fireColumn);
|
739 |
-
|
740 |
-
// νμΌ κΈ°λ₯ μ λλ©μ΄μ
|
741 |
-
const animateFireColumn = () => {
|
742 |
-
fireColumn.scale.y += 0.1;
|
743 |
-
fireColumn.children.forEach(fire => {
|
744 |
-
fire.material.opacity *= 0.95;
|
745 |
-
});
|
746 |
-
|
747 |
-
if (fireColumn.children[0].material.opacity > 0.01) {
|
748 |
-
requestAnimationFrame(animateFireColumn);
|
749 |
-
} else {
|
750 |
-
this.scene.remove(fireColumn);
|
751 |
-
}
|
752 |
-
};
|
753 |
-
animateFireColumn();
|
754 |
-
|
755 |
-
// νλ° μ¬μ΄λ ν¨κ³Όλ€
|
756 |
-
const explosionSounds = [
|
757 |
-
new Audio('sounds/explosion.ogg'),
|
758 |
-
new Audio('sounds/bang.ogg')
|
759 |
-
];
|
760 |
-
explosionSounds.forEach(sound => {
|
761 |
-
sound.volume = 0.5;
|
762 |
-
sound.play();
|
763 |
-
});
|
764 |
-
|
765 |
-
// μΉ΄λ©λΌ νλ€λ¦Ό ν¨κ³Ό
|
766 |
-
if (window.gameInstance && window.gameInstance.camera) {
|
767 |
-
const camera = window.gameInstance.camera;
|
768 |
-
const originalPosition = camera.position.clone();
|
769 |
-
let shakeTime = 0;
|
770 |
-
const shakeIntensity = 1.0;
|
771 |
-
const shakeDuration = 1000;
|
772 |
-
|
773 |
-
const shakeCamera = () => {
|
774 |
-
if (shakeTime < shakeDuration) {
|
775 |
-
camera.position.x = originalPosition.x + (Math.random() - 0.5) * shakeIntensity;
|
776 |
-
camera.position.y = originalPosition.y + (Math.random() - 0.5) * shakeIntensity;
|
777 |
-
camera.position.z = originalPosition.z + (Math.random() - 0.5) * shakeIntensity;
|
778 |
-
|
779 |
-
shakeTime += 16;
|
780 |
-
requestAnimationFrame(shakeCamera);
|
781 |
-
} else {
|
782 |
-
camera.position.copy(originalPosition);
|
783 |
-
}
|
784 |
-
};
|
785 |
-
shakeCamera();
|
786 |
-
}
|
787 |
-
|
788 |
-
// μ€μ¬ νλμ μ κ±°
|
789 |
-
setTimeout(() => {
|
790 |
-
this.scene.remove(flash);
|
791 |
-
}, 200);
|
792 |
-
}
|
793 |
-
|
794 |
// μ₯μ λ¬Ό κ°μ§ μμ€ν
|
795 |
detectObstacles() {
|
796 |
const obstacles = [];
|
@@ -1343,6 +1185,164 @@ checkPathClear(start, end) {
|
|
1343 |
this.scene.remove(flashGroup);
|
1344 |
}, 500);
|
1345 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1346 |
|
1347 |
shoot(playerPosition) {
|
1348 |
const currentTime = Date.now();
|
|
|
633 |
maxConsecutiveHits: 3
|
634 |
};
|
635 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
636 |
// μ₯μ λ¬Ό κ°μ§ μμ€ν
|
637 |
detectObstacles() {
|
638 |
const obstacles = [];
|
|
|
1185 |
this.scene.remove(flashGroup);
|
1186 |
}, 500);
|
1187 |
}
|
1188 |
+
createMassiveExplosion() {
|
1189 |
+
// μ€μ¬ νλ°
|
1190 |
+
const explosionGroup = new THREE.Group();
|
1191 |
+
|
1192 |
+
// μ£Ό νλ° νλμ
|
1193 |
+
const flashGeometry = new THREE.SphereGeometry(8);
|
1194 |
+
const flashMaterial = new THREE.MeshBasicMaterial({
|
1195 |
+
color: 0xffff00,
|
1196 |
+
transparent: true,
|
1197 |
+
opacity: 1
|
1198 |
+
});
|
1199 |
+
const flash = new THREE.Mesh(flashGeometry, flashMaterial);
|
1200 |
+
flash.position.copy(this.mesh.position);
|
1201 |
+
this.scene.add(flash);
|
1202 |
+
|
1203 |
+
// λ€μ€ νλ° νν°ν΄
|
1204 |
+
for (let i = 0; i < 100; i++) { // νν°ν΄ μ μ¦κ°
|
1205 |
+
const size = Math.random() * 2 + 1;
|
1206 |
+
const geometry = new THREE.SphereGeometry(size);
|
1207 |
+
|
1208 |
+
// λ€μν νλ° μμ
|
1209 |
+
const colors = [0xff4500, 0xff8c00, 0xff0000, 0xffd700, 0xff6347];
|
1210 |
+
const material = new THREE.MeshBasicMaterial({
|
1211 |
+
color: colors[Math.floor(Math.random() * colors.length)],
|
1212 |
+
transparent: true,
|
1213 |
+
opacity: 1
|
1214 |
+
});
|
1215 |
+
|
1216 |
+
const particle = new THREE.Mesh(geometry, material);
|
1217 |
+
particle.position.copy(this.mesh.position);
|
1218 |
+
|
1219 |
+
// λ κ°λ ₯ν νλ° ν¨κ³Όλ₯Ό μν μλ μ¦κ°
|
1220 |
+
const speed = Math.random() * 2 + 1;
|
1221 |
+
const angle = Math.random() * Math.PI * 2;
|
1222 |
+
const elevation = Math.random() * Math.PI - Math.PI / 2;
|
1223 |
+
|
1224 |
+
particle.velocity = new THREE.Vector3(
|
1225 |
+
Math.cos(angle) * Math.cos(elevation) * speed,
|
1226 |
+
Math.sin(elevation) * speed,
|
1227 |
+
Math.sin(angle) * Math.cos(elevation) * speed
|
1228 |
+
);
|
1229 |
+
|
1230 |
+
particle.gravity = -0.1;
|
1231 |
+
particle.life = Math.random() * 60 + 60;
|
1232 |
+
particle.fadeRate = 0.98;
|
1233 |
+
|
1234 |
+
this.scene.add(particle);
|
1235 |
+
window.gameInstance.particles.push({
|
1236 |
+
mesh: particle,
|
1237 |
+
velocity: particle.velocity,
|
1238 |
+
gravity: particle.gravity,
|
1239 |
+
life: particle.life,
|
1240 |
+
fadeRate: particle.fadeRate
|
1241 |
+
});
|
1242 |
+
}
|
1243 |
+
|
1244 |
+
// νλ° λ§ μ΄ννΈ
|
1245 |
+
for (let i = 0; i < 3; i++) {
|
1246 |
+
const ringGeometry = new THREE.RingGeometry(0.1, 4, 32);
|
1247 |
+
const ringMaterial = new THREE.MeshBasicMaterial({
|
1248 |
+
color: 0xff8c00,
|
1249 |
+
transparent: true,
|
1250 |
+
opacity: 1,
|
1251 |
+
side: THREE.DoubleSide
|
1252 |
+
});
|
1253 |
+
const ring = new THREE.Mesh(ringGeometry, ringMaterial);
|
1254 |
+
ring.position.copy(this.mesh.position);
|
1255 |
+
ring.rotation.x = Math.random() * Math.PI;
|
1256 |
+
ring.rotation.y = Math.random() * Math.PI;
|
1257 |
+
this.scene.add(ring);
|
1258 |
+
|
1259 |
+
// λ§ νμ₯ μ λλ©μ΄μ
|
1260 |
+
const expandRing = () => {
|
1261 |
+
ring.scale.x += 0.3;
|
1262 |
+
ring.scale.y += 0.3;
|
1263 |
+
ring.material.opacity *= 0.96;
|
1264 |
+
|
1265 |
+
if (ring.material.opacity > 0.01) {
|
1266 |
+
requestAnimationFrame(expandRing);
|
1267 |
+
} else {
|
1268 |
+
this.scene.remove(ring);
|
1269 |
+
}
|
1270 |
+
};
|
1271 |
+
expandRing();
|
1272 |
+
}
|
1273 |
+
|
1274 |
+
// νμΌ κΈ°λ₯ ν¨κ³Ό
|
1275 |
+
const fireColumn = new THREE.Group();
|
1276 |
+
for (let i = 0; i < 20; i++) {
|
1277 |
+
const fireGeometry = new THREE.ConeGeometry(2, 8, 8);
|
1278 |
+
const fireMaterial = new THREE.MeshBasicMaterial({
|
1279 |
+
color: 0xff4500,
|
1280 |
+
transparent: true,
|
1281 |
+
opacity: 0.8
|
1282 |
+
});
|
1283 |
+
const fire = new THREE.Mesh(fireGeometry, fireMaterial);
|
1284 |
+
fire.position.y = i * 0.5;
|
1285 |
+
fire.rotation.x = Math.random() * Math.PI;
|
1286 |
+
fire.rotation.z = Math.random() * Math.PI;
|
1287 |
+
fireColumn.add(fire);
|
1288 |
+
}
|
1289 |
+
fireColumn.position.copy(this.mesh.position);
|
1290 |
+
this.scene.add(fireColumn);
|
1291 |
+
|
1292 |
+
// νμΌ κΈ°λ₯ μ λλ©μ΄μ
|
1293 |
+
const animateFireColumn = () => {
|
1294 |
+
fireColumn.scale.y += 0.1;
|
1295 |
+
fireColumn.children.forEach(fire => {
|
1296 |
+
fire.material.opacity *= 0.95;
|
1297 |
+
});
|
1298 |
+
|
1299 |
+
if (fireColumn.children[0].material.opacity > 0.01) {
|
1300 |
+
requestAnimationFrame(animateFireColumn);
|
1301 |
+
} else {
|
1302 |
+
this.scene.remove(fireColumn);
|
1303 |
+
}
|
1304 |
+
};
|
1305 |
+
animateFireColumn();
|
1306 |
+
|
1307 |
+
// νλ° μ¬μ΄λ ν¨κ³Όλ€
|
1308 |
+
const explosionSounds = [
|
1309 |
+
new Audio('sounds/explosion.ogg'),
|
1310 |
+
new Audio('sounds/bang.ogg')
|
1311 |
+
];
|
1312 |
+
explosionSounds.forEach(sound => {
|
1313 |
+
sound.volume = 0.5;
|
1314 |
+
sound.play();
|
1315 |
+
});
|
1316 |
+
|
1317 |
+
// μΉ΄λ©λΌ νλ€λ¦Ό ν¨κ³Ό
|
1318 |
+
if (window.gameInstance && window.gameInstance.camera) {
|
1319 |
+
const camera = window.gameInstance.camera;
|
1320 |
+
const originalPosition = camera.position.clone();
|
1321 |
+
let shakeTime = 0;
|
1322 |
+
const shakeIntensity = 1.0;
|
1323 |
+
const shakeDuration = 1000;
|
1324 |
+
|
1325 |
+
const shakeCamera = () => {
|
1326 |
+
if (shakeTime < shakeDuration) {
|
1327 |
+
camera.position.x = originalPosition.x + (Math.random() - 0.5) * shakeIntensity;
|
1328 |
+
camera.position.y = originalPosition.y + (Math.random() - 0.5) * shakeIntensity;
|
1329 |
+
camera.position.z = originalPosition.z + (Math.random() - 0.5) * shakeIntensity;
|
1330 |
+
|
1331 |
+
shakeTime += 16;
|
1332 |
+
requestAnimationFrame(shakeCamera);
|
1333 |
+
} else {
|
1334 |
+
camera.position.copy(originalPosition);
|
1335 |
+
}
|
1336 |
+
};
|
1337 |
+
shakeCamera();
|
1338 |
+
}
|
1339 |
+
|
1340 |
+
// μ€μ¬ νλμ μ κ±°
|
1341 |
+
setTimeout(() => {
|
1342 |
+
this.scene.remove(flash);
|
1343 |
+
}, 200);
|
1344 |
+
}
|
1345 |
+
|
1346 |
|
1347 |
shoot(playerPosition) {
|
1348 |
const currentTime = Date.now();
|