Spaces:
Running
Running
Update game.js
Browse files
game.js
CHANGED
@@ -1285,210 +1285,241 @@ class Game {
|
|
1285 |
}
|
1286 |
|
1287 |
updateWarnings() {
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
} else {
|
1326 |
-
// LOW ALTITUDE ๊ฒฝ๊ณ - ์ฝํ ๋ถ์ ํจ๊ณผ
|
1327 |
-
edgeIntensity = 0.3;
|
1328 |
-
altitudeEdgeEffect.style.cssText = `
|
1329 |
-
position: fixed;
|
1330 |
-
top: 0;
|
1331 |
-
left: 0;
|
1332 |
-
width: 100%;
|
1333 |
-
height: 100%;
|
1334 |
-
pointer-events: none;
|
1335 |
-
z-index: 1300;
|
1336 |
-
background: radial-gradient(ellipse at center,
|
1337 |
-
transparent 50%,
|
1338 |
-
rgba(255, 0, 0, ${edgeIntensity * 0.2}) 70%,
|
1339 |
-
rgba(255, 0, 0, ${edgeIntensity}) 100%);
|
1340 |
-
box-shadow: inset 0 0 100px rgba(255, 0, 0, ${edgeIntensity}),
|
1341 |
-
inset 0 0 50px rgba(255, 0, 0, ${edgeIntensity * 0.5});
|
1342 |
-
`;
|
1343 |
-
}
|
1344 |
} else {
|
1345 |
-
//
|
1346 |
-
|
1347 |
-
|
1348 |
-
}
|
1349 |
-
}
|
1350 |
-
|
1351 |
-
if (this.fighter.warningBlinkState) {
|
1352 |
-
const warningContainer = document.createElement('div');
|
1353 |
-
warningContainer.className = 'warning-message';
|
1354 |
-
warningContainer.style.cssText = `
|
1355 |
position: fixed;
|
1356 |
-
top:
|
1357 |
-
left:
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
|
|
|
|
|
|
1365 |
`;
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1391 |
}
|
1392 |
|
1393 |
-
// ์คํจ ์ํ์ผ ๋๋ง "Press F to Escape" ๊ฒฝ๊ณ ํ์
|
1394 |
if (this.fighter.stallWarning) {
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1424 |
}
|
1425 |
-
|
1426 |
-
0
|
1427 |
-
|
1428 |
-
transform: translateX(-50%) scale(1);
|
1429 |
-
}
|
1430 |
-
50% {
|
1431 |
-
opacity: 0.8;
|
1432 |
-
transform: translateX(-50%) scale(1.1);
|
1433 |
-
}
|
1434 |
}
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
50% {
|
1442 |
-
background: rgba(255, 50, 50, 1);
|
1443 |
-
box-shadow: 0 0 30px rgba(255, 100, 100, 1),
|
1444 |
-
0 0 60px rgba(255, 0, 0, 0.8);
|
1445 |
-
}
|
1446 |
}
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
50% {
|
1452 |
-
opacity: 0.7;
|
1453 |
-
}
|
1454 |
}
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1458 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1459 |
|
1460 |
-
// Over-G
|
1461 |
-
if (
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
pointer-events: none;
|
1482 |
-
z-index: 1400;
|
1483 |
-
`;
|
1484 |
-
} else {
|
1485 |
-
// Over-G ์ํ๊ฐ ์๋๋ฉด ํจ๊ณผ ์ ๊ฑฐ
|
1486 |
-
const blurEffect = document.getElementById('overGBlurEffect');
|
1487 |
-
if (blurEffect) {
|
1488 |
-
blurEffect.remove();
|
1489 |
-
}
|
1490 |
}
|
1491 |
}
|
|
|
1492 |
|
1493 |
updateRadar() {
|
1494 |
const radar = document.getElementById('radar');
|
|
|
1285 |
}
|
1286 |
|
1287 |
updateWarnings() {
|
1288 |
+
// ๊ธฐ์กด ๊ฒฝ๊ณ ๋ฉ์์ง ์ ๊ฑฐ
|
1289 |
+
const existingWarnings = document.querySelectorAll('.warning-message');
|
1290 |
+
existingWarnings.forEach(w => w.remove());
|
1291 |
+
|
1292 |
+
// ์คํจ ํ์ถ ๊ฒฝ๊ณ ์ ๊ฑฐ
|
1293 |
+
const existingStallWarnings = document.querySelectorAll('.stall-escape-warning');
|
1294 |
+
existingStallWarnings.forEach(w => w.remove());
|
1295 |
+
|
1296 |
+
// ๊ณ ๋ ๊ฒฝ๊ณ ์ธ๊ณฝ ํจ๊ณผ
|
1297 |
+
let altitudeEdgeEffect = document.getElementById('altitudeEdgeEffect');
|
1298 |
+
if (this.fighter.altitude < 500) {
|
1299 |
+
if (!altitudeEdgeEffect) {
|
1300 |
+
altitudeEdgeEffect = document.createElement('div');
|
1301 |
+
altitudeEdgeEffect.id = 'altitudeEdgeEffect';
|
1302 |
+
document.body.appendChild(altitudeEdgeEffect);
|
1303 |
+
}
|
1304 |
+
|
1305 |
+
let edgeIntensity;
|
1306 |
+
if (this.fighter.altitude < 250) {
|
1307 |
+
// PULL UP ๊ฒฝ๊ณ - ๊ฐํ ๋ถ์ ํจ๊ณผ
|
1308 |
+
edgeIntensity = 0.6;
|
1309 |
+
altitudeEdgeEffect.style.cssText = `
|
1310 |
+
position: fixed;
|
1311 |
+
top: 0;
|
1312 |
+
left: 0;
|
1313 |
+
width: 100%;
|
1314 |
+
height: 100%;
|
1315 |
+
pointer-events: none;
|
1316 |
+
z-index: 1300;
|
1317 |
+
background: radial-gradient(ellipse at center,
|
1318 |
+
transparent 40%,
|
1319 |
+
rgba(255, 0, 0, ${edgeIntensity * 0.3}) 60%,
|
1320 |
+
rgba(255, 0, 0, ${edgeIntensity}) 100%);
|
1321 |
+
box-shadow: inset 0 0 150px rgba(255, 0, 0, ${edgeIntensity}),
|
1322 |
+
inset 0 0 100px rgba(255, 0, 0, ${edgeIntensity * 0.8});
|
1323 |
+
animation: pulse-red 0.5s infinite;
|
1324 |
+
`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1325 |
} else {
|
1326 |
+
// LOW ALTITUDE ๊ฒฝ๊ณ - ์ฝํ ๋ถ์ ํจ๊ณผ
|
1327 |
+
edgeIntensity = 0.3;
|
1328 |
+
altitudeEdgeEffect.style.cssText = `
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1329 |
position: fixed;
|
1330 |
+
top: 0;
|
1331 |
+
left: 0;
|
1332 |
+
width: 100%;
|
1333 |
+
height: 100%;
|
1334 |
+
pointer-events: none;
|
1335 |
+
z-index: 1300;
|
1336 |
+
background: radial-gradient(ellipse at center,
|
1337 |
+
transparent 50%,
|
1338 |
+
rgba(255, 0, 0, ${edgeIntensity * 0.2}) 70%,
|
1339 |
+
rgba(255, 0, 0, ${edgeIntensity}) 100%);
|
1340 |
+
box-shadow: inset 0 0 100px rgba(255, 0, 0, ${edgeIntensity}),
|
1341 |
+
inset 0 0 50px rgba(255, 0, 0, ${edgeIntensity * 0.5});
|
1342 |
`;
|
1343 |
+
}
|
1344 |
+
} else {
|
1345 |
+
// ๊ณ ๋๊ฐ ์์ ํ๋ฉด ํจ๊ณผ ์ ๊ฑฐ
|
1346 |
+
if (altitudeEdgeEffect) {
|
1347 |
+
altitudeEdgeEffect.remove();
|
1348 |
+
}
|
1349 |
+
}
|
1350 |
+
|
1351 |
+
if (this.fighter.warningBlinkState) {
|
1352 |
+
const warningContainer = document.createElement('div');
|
1353 |
+
warningContainer.className = 'warning-message';
|
1354 |
+
warningContainer.style.cssText = `
|
1355 |
+
position: fixed;
|
1356 |
+
top: 30%;
|
1357 |
+
left: 50%;
|
1358 |
+
transform: translateX(-50%);
|
1359 |
+
color: #ff0000;
|
1360 |
+
font-size: 24px;
|
1361 |
+
font-weight: bold;
|
1362 |
+
text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
|
1363 |
+
z-index: 1500;
|
1364 |
+
text-align: center;
|
1365 |
+
`;
|
1366 |
+
|
1367 |
+
let warningText = '';
|
1368 |
+
|
1369 |
+
if (this.fighter.altitude < 250) {
|
1370 |
+
warningText += 'PULL UP! PULL UP!\n';
|
1371 |
+
} else if (this.fighter.altitude < 500) {
|
1372 |
+
warningText += 'LOW ALTITUDE WARNING\n';
|
1373 |
+
}
|
1374 |
+
|
1375 |
+
if (this.fighter.altitudeWarning) {
|
1376 |
+
warningText += 'ALTITUDE LIMIT\n';
|
1377 |
}
|
1378 |
|
|
|
1379 |
if (this.fighter.stallWarning) {
|
1380 |
+
warningText += 'STALL WARNING\n';
|
1381 |
+
}
|
1382 |
+
|
1383 |
+
if (this.fighter.overG) {
|
1384 |
+
warningText += 'OVER-G! OVER-G!\n';
|
1385 |
+
}
|
1386 |
+
|
1387 |
+
if (warningText) {
|
1388 |
+
warningContainer.innerHTML = warningText.replace(/\n/g, '<br>');
|
1389 |
+
document.body.appendChild(warningContainer);
|
1390 |
+
}
|
1391 |
+
}
|
1392 |
+
|
1393 |
+
// ์คํจ ์ํ์ผ ๋๋ง "Press F to Escape" ๊ฒฝ๊ณ ํ์
|
1394 |
+
if (this.fighter.stallWarning) {
|
1395 |
+
const stallEscapeWarning = document.createElement('div');
|
1396 |
+
stallEscapeWarning.className = 'stall-escape-warning';
|
1397 |
+
stallEscapeWarning.style.cssText = `
|
1398 |
+
position: fixed;
|
1399 |
+
bottom: 100px;
|
1400 |
+
left: 50%;
|
1401 |
+
transform: translateX(-50%);
|
1402 |
+
background: rgba(255, 0, 0, 0.8);
|
1403 |
+
color: #ffffff;
|
1404 |
+
font-size: 28px;
|
1405 |
+
font-weight: bold;
|
1406 |
+
padding: 15px 30px;
|
1407 |
+
border: 3px solid #ff0000;
|
1408 |
+
border-radius: 10px;
|
1409 |
+
z-index: 1600;
|
1410 |
+
text-align: center;
|
1411 |
+
animation: blink 0.5s infinite;
|
1412 |
+
`;
|
1413 |
+
stallEscapeWarning.innerHTML = 'PRESS F TO ESCAPE';
|
1414 |
+
document.body.appendChild(stallEscapeWarning);
|
1415 |
+
|
1416 |
+
// ์ ๋๋ฉ์ด์
์คํ์ผ ์ถ๊ฐ
|
1417 |
+
if (!document.getElementById('blinkAnimation')) {
|
1418 |
+
const style = document.createElement('style');
|
1419 |
+
style.id = 'blinkAnimation';
|
1420 |
+
style.innerHTML = `
|
1421 |
+
@keyframes blink {
|
1422 |
+
0%, 50% { opacity: 1; }
|
1423 |
+
51%, 100% { opacity: 0.3; }
|
1424 |
+
}
|
1425 |
+
@keyframes pulse-green {
|
1426 |
+
0%, 100% {
|
1427 |
+
opacity: 1;
|
1428 |
+
transform: translateX(-50%) scale(1);
|
1429 |
}
|
1430 |
+
50% {
|
1431 |
+
opacity: 0.8;
|
1432 |
+
transform: translateX(-50%) scale(1.1);
|
|
|
|
|
|
|
|
|
|
|
|
|
1433 |
}
|
1434 |
+
}
|
1435 |
+
@keyframes box-pulse {
|
1436 |
+
0%, 100% {
|
1437 |
+
background: rgba(255, 0, 0, 0.9);
|
1438 |
+
box-shadow: 0 0 20px rgba(255, 0, 0, 0.8),
|
1439 |
+
0 0 40px rgba(255, 0, 0, 0.4);
|
|
|
|
|
|
|
|
|
|
|
1440 |
}
|
1441 |
+
50% {
|
1442 |
+
background: rgba(255, 50, 50, 1);
|
1443 |
+
box-shadow: 0 0 30px rgba(255, 100, 100, 1),
|
1444 |
+
0 0 60px rgba(255, 0, 0, 0.8);
|
|
|
|
|
|
|
1445 |
}
|
1446 |
+
}
|
1447 |
+
@keyframes pulse-red {
|
1448 |
+
0%, 100% {
|
1449 |
+
opacity: 1;
|
1450 |
+
}
|
1451 |
+
50% {
|
1452 |
+
opacity: 0.7;
|
1453 |
+
}
|
1454 |
+
}
|
1455 |
+
`;
|
1456 |
+
document.head.appendChild(style);
|
1457 |
}
|
1458 |
+
}
|
1459 |
+
|
1460 |
+
// Over-G ์์ผ ํจ๊ณผ - ์์ ๋ ๋ถ๋ถ
|
1461 |
+
if (this.fighter.overG && this.fighter.overGTimer > 0) {
|
1462 |
+
let blurEffect = document.getElementById('overGBlurEffect');
|
1463 |
+
if (!blurEffect) {
|
1464 |
+
blurEffect = document.createElement('div');
|
1465 |
+
blurEffect.id = 'overGBlurEffect';
|
1466 |
+
document.body.appendChild(blurEffect);
|
1467 |
+
}
|
1468 |
+
|
1469 |
+
// Over-G ์ง์ ์๊ฐ์ ๋ฐ๋ผ ์ ์ง์ ์ผ๋ก ์ด๋์์ง
|
1470 |
+
// 0์ด: ํจ๊ณผ ์์
|
1471 |
+
// 1์ด: ๊ฑฐ์ ์์ ํ ์ด๋์์ง
|
1472 |
+
const darknessFactor = Math.min(this.fighter.overGTimer, 1.0); // 0~1 ๋ฒ์๋ก ์ ํ
|
1473 |
+
|
1474 |
+
// ์์ผ ๊ฐ์ฅ์๋ฆฌ๋ถํฐ ์ด๋์์ง๋ ํจ๊ณผ
|
1475 |
+
// ์ค์์ ์๋์ ์ผ๋ก ๋ฆ๊ฒ ์ด๋์์ง
|
1476 |
+
const centerTransparency = Math.max(0, 1 - darknessFactor * 1.2); // ์ค์ ํฌ๋ช
๋
|
1477 |
+
const midTransparency = Math.max(0, 1 - darknessFactor * 0.8); // ์ค๊ฐ ํฌ๋ช
๋
|
1478 |
+
const edgeOpacity = Math.min(0.95, darknessFactor * 0.95); // ๊ฐ์ฅ์๋ฆฌ ๋ถํฌ๋ช
๋
|
1479 |
+
|
1480 |
+
// ๋ถ์ ์์กฐ ์ถ๊ฐ (ํ์ก ์ํ ๋ฌธ์ ๋ฅผ ์๊ฐํ)
|
1481 |
+
const redTint = Math.min(darknessFactor * 0.3, 0.3);
|
1482 |
+
|
1483 |
+
blurEffect.style.cssText = `
|
1484 |
+
position: fixed;
|
1485 |
+
top: 0;
|
1486 |
+
left: 0;
|
1487 |
+
width: 100%;
|
1488 |
+
height: 100%;
|
1489 |
+
background: radial-gradient(ellipse at center,
|
1490 |
+
rgba(${Math.floor(255 * redTint)}, 0, 0, ${1 - centerTransparency}) 0%,
|
1491 |
+
rgba(${Math.floor(200 * redTint)}, 0, 0, ${1 - midTransparency}) 40%,
|
1492 |
+
rgba(0, 0, 0, ${edgeOpacity}) 70%,
|
1493 |
+
rgba(0, 0, 0, ${Math.min(0.98, edgeOpacity + 0.05)}) 100%);
|
1494 |
+
pointer-events: none;
|
1495 |
+
z-index: 1400;
|
1496 |
+
transition: background 0.1s ease-out;
|
1497 |
+
`;
|
1498 |
|
1499 |
+
// ์ฌํ Over-G ์ํ์์ ํ๋ฉด ํ๋ค๋ฆผ ํจ๊ณผ
|
1500 |
+
if (darknessFactor > 0.7) {
|
1501 |
+
const shake = (1 - Math.random() * 2) * 2;
|
1502 |
+
blurEffect.style.transform = `translate(${shake}px, ${shake}px)`;
|
1503 |
+
}
|
1504 |
+
|
1505 |
+
// ๋๋ฒ๊ทธ ์ ๋ณด (์ ํ์ฌํญ)
|
1506 |
+
// console.log(`Over-G Timer: ${this.fighter.overGTimer.toFixed(2)}s, Darkness: ${(darknessFactor * 100).toFixed(0)}%`);
|
1507 |
+
|
1508 |
+
} else {
|
1509 |
+
// Over-G ์ํ๊ฐ ์๋๋ฉด ํจ๊ณผ ์ ๊ฑฐ
|
1510 |
+
const blurEffect = document.getElementById('overGBlurEffect');
|
1511 |
+
if (blurEffect) {
|
1512 |
+
// ๋ถ๋๋ฌ์ด ์ ๊ฑฐ๋ฅผ ์ํ ํ์ด๋์์
|
1513 |
+
blurEffect.style.transition = 'opacity 0.5s ease-out';
|
1514 |
+
blurEffect.style.opacity = '0';
|
1515 |
+
setTimeout(() => {
|
1516 |
+
if (blurEffect.parentNode) {
|
1517 |
+
blurEffect.remove();
|
1518 |
+
}
|
1519 |
+
}, 500);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1520 |
}
|
1521 |
}
|
1522 |
+
}
|
1523 |
|
1524 |
updateRadar() {
|
1525 |
const radar = document.getElementById('radar');
|