|
36 | 36 | align-items: center; |
37 | 37 | justify-content: center; |
38 | 38 | min-height: 100vh; |
39 | | - overflow: hidden; |
40 | | - transition: background-color 0.3s ease; |
| 39 | + margin: 0; |
| 40 | + padding: 0; |
41 | 41 | } |
42 | 42 |
|
43 | 43 | .game-container { |
44 | 44 | position: relative; |
45 | 45 | width: var(--game-width); |
46 | | - margin: 20px auto; |
| 46 | + max-width: 100%; |
| 47 | + margin: 0 auto; |
47 | 48 | } |
48 | 49 |
|
49 | 50 | .game-header { |
|
104 | 105 | } |
105 | 106 |
|
106 | 107 | #game-board { |
107 | | - width: var(--game-width); |
108 | | - height: var(--game-height); |
| 108 | + width: 100%; |
| 109 | + aspect-ratio: 6/5; |
| 110 | + max-height: 80vh; |
109 | 111 | background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); |
110 | 112 | border-radius: 10px; |
111 | 113 | position: relative; |
|
259 | 261 | display: flex; |
260 | 262 | flex-direction: column; |
261 | 263 | align-items: center; |
262 | | - justify-content: center; |
| 264 | + justify-content: flex-start; |
263 | 265 | background: rgba(18, 18, 18, 0.9); |
264 | 266 | z-index: 50; |
265 | 267 | opacity: 0; |
266 | 268 | pointer-events: none; |
267 | 269 | transition: opacity 0.5s ease; |
268 | 270 | text-align: center; |
269 | | - padding: 20px; |
| 271 | + padding: 5% 5% 0 5%; |
270 | 272 | overflow-y: auto; |
| 273 | + box-sizing: border-box; |
271 | 274 | } |
272 | 275 |
|
273 | 276 | .screen.active { |
|
319 | 322 | background: rgba(25, 27, 58, 0.7); |
320 | 323 | border-radius: 10px; |
321 | 324 | padding: 15px; |
322 | | - margin: 20px auto; |
323 | | - width: 80%; |
324 | | - max-width: 500px; |
| 325 | + margin: 10px 0 20px 0; |
| 326 | + width: 90%; |
325 | 327 | gap: 20px; |
| 328 | + flex-wrap: wrap; |
326 | 329 | } |
327 | 330 |
|
328 | 331 | .controls-column { |
329 | 332 | flex: 1; |
| 333 | + min-width: 120px; |
330 | 334 | padding: 10px; |
331 | 335 | text-align: left; |
332 | 336 | } |
|
444 | 448 |
|
445 | 449 | @media (max-width: 768px) { |
446 | 450 | :root { |
447 | | - --game-width: 100%; |
448 | | - --game-height: 400px; |
| 451 | + --game-width: 95vw; |
449 | 452 | } |
450 | 453 |
|
451 | 454 | .game-container { |
|
464 | 467 | .controls-info { |
465 | 468 | flex-direction: column; |
466 | 469 | } |
467 | | - } |
468 | 470 |
|
| 471 | + .screen h2 { |
| 472 | + font-size: 1.8rem; |
| 473 | + margin-top: 10px; |
| 474 | + } |
| 475 | + |
| 476 | + .screen p { |
| 477 | + font-size: 1rem; |
| 478 | + margin-bottom: 15px; |
| 479 | + } |
| 480 | + } |
469 | 481 |
|
470 | 482 | @media (min-width: 769px) { |
471 | 483 | .game-container { |
|
478 | 490 | height: min(var(--game-height), 70vh); |
479 | 491 | } |
480 | 492 | } |
| 493 | + |
| 494 | + @media (min-width: 1200px) { |
| 495 | + :root { |
| 496 | + --game-width: 800px; |
| 497 | + } |
| 498 | + } |
481 | 499 | </style> |
482 | 500 | </head> |
483 | 501 | <body> |
@@ -1679,33 +1697,72 @@ <h2>You Win!</h2> |
1679 | 1697 | } |
1680 | 1698 |
|
1681 | 1699 | function applyMultiballPowerup() { |
1682 | | - for (let i = 0; i < config.multiBallCount; i++) { |
1683 | | - createNewBall(); |
| 1700 | + // Store all active balls that need to be duplicated |
| 1701 | + const activeBalls = []; |
| 1702 | + |
| 1703 | + // Add main ball if it's launched |
| 1704 | + if (ball.launched) { |
| 1705 | + activeBalls.push({ |
| 1706 | + x: ball.x, |
| 1707 | + y: ball.y, |
| 1708 | + speed: ball.speed, |
| 1709 | + fireball: ball.fireball |
| 1710 | + }); |
| 1711 | + } |
| 1712 | + |
| 1713 | + // Add all other active balls |
| 1714 | + state.balls.forEach(ballObj => { |
| 1715 | + if (ballObj.launched) { |
| 1716 | + activeBalls.push({ |
| 1717 | + x: ballObj.x, |
| 1718 | + y: ballObj.y, |
| 1719 | + speed: ballObj.speed, |
| 1720 | + fireball: ballObj.fireball |
| 1721 | + }); |
| 1722 | + } |
| 1723 | + }); |
| 1724 | + |
| 1725 | + // If no active balls, create from main ball position even if not launched |
| 1726 | + if (activeBalls.length === 0) { |
| 1727 | + activeBalls.push({ |
| 1728 | + x: ball.x, |
| 1729 | + y: ball.y, |
| 1730 | + speed: ball.speed, |
| 1731 | + fireball: ball.fireball |
| 1732 | + }); |
1684 | 1733 | } |
| 1734 | + |
| 1735 | + // Create new balls based on each active ball |
| 1736 | + activeBalls.forEach(activeBall => { |
| 1737 | + for (let i = 0; i < config.multiBallCount; i++) { |
| 1738 | + createNewBall(activeBall.x, activeBall.y, activeBall.speed, activeBall.fireball); |
| 1739 | + } |
| 1740 | + }); |
1685 | 1741 | } |
1686 | 1742 |
|
1687 | | - function createNewBall() { |
| 1743 | + function createNewBall(x, y, speed, isFireball) { |
1688 | 1744 | const newBallElement = document.createElement('div'); |
1689 | 1745 | newBallElement.classList.add('ball'); |
1690 | 1746 | newBallElement.style.width = config.ballSize + 'px'; |
1691 | 1747 | newBallElement.style.height = config.ballSize + 'px'; |
1692 | 1748 |
|
1693 | | - if (ball.fireball) { |
| 1749 | + if (isFireball) { |
1694 | 1750 | newBallElement.style.background = 'radial-gradient(circle at 30% 30%, white, #FF9E00)'; |
1695 | 1751 | newBallElement.style.boxShadow = '0 0 15px rgba(255, 158, 0, 0.7)'; |
1696 | 1752 | } |
1697 | 1753 |
|
1698 | 1754 | elements.gameBoard.appendChild(newBallElement); |
1699 | 1755 |
|
| 1756 | + const angle = (Math.random() * 90 - 45) * Math.PI / 180; |
1700 | 1757 | const newBall = { |
1701 | | - x: ball.x, |
1702 | | - y: ball.y, |
1703 | | - dx: (Math.random() * 2 - 1) * ball.speed, |
1704 | | - dy: -ball.speed, |
1705 | | - speed: ball.speed, |
| 1758 | + x: x, |
| 1759 | + y: y, |
| 1760 | + dx: speed * Math.sin(angle), |
| 1761 | + dy: -speed * Math.cos(angle), |
| 1762 | + speed: speed, |
1706 | 1763 | launched: true, |
1707 | | - radius: ball.radius, |
1708 | | - fireball: ball.fireball, |
| 1764 | + radius: config.ballSize / 2, |
| 1765 | + fireball: isFireball, |
1709 | 1766 | element: newBallElement |
1710 | 1767 | }; |
1711 | 1768 |
|
|
0 commit comments