cutechicken commited on
Commit
987d0b7
ยท
verified ยท
1 Parent(s): 5484dcd

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +221 -190
game.js CHANGED
@@ -1285,210 +1285,241 @@ class Game {
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 3์ดˆ ์ด์ƒ์ผ ๋•Œ ์‹œ์•ผ ํ๋ฆผ ํšจ๊ณผ
1461
- if (this.fighter.overG && this.fighter.overGTimer > 3.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
- const blurIntensity = Math.min((this.fighter.overGTimer - 3.0) * 0.3, 0.8);
1471
- blurEffect.style.cssText = `
1472
- position: fixed;
1473
- top: 0;
1474
- left: 0;
1475
- width: 100%;
1476
- height: 100%;
1477
- background: radial-gradient(ellipse at center,
1478
- transparent 20%,
1479
- rgba(0, 0, 0, ${blurIntensity}) 50%,
1480
- rgba(0, 0, 0, ${blurIntensity + 0.2}) 100%);
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');