commit ffe448ea870e23ac4f66f6cdc3acd177e6995d4e
Author: root <root@hub.scroll.pub> Date: 2024-12-29 00:29:33 +0000 Subject: Initial commit diff --git a/body.html b/body.html new file mode 100644 index 0000000..aaeb4e4 --- /dev/null +++ b/body.html @@ -0,0 +1,15 @@ +<div class="game-container"> + <div class="scoreboard"> + <div class="player">Player 1: <span id="player1-score">0</span></div> + <div class="player">Player 2: <span id="player2-score">0</span></div> + </div> + <div class="game-area"> + <div id="paddle1" class="paddle"></div> + <div id="paddle2" class="paddle"></div> + <div id="ball" class="ball"></div> + </div> + <div class="controls"> + <p>Player 1: W (Up) & S (Down)</p> + <p>Player 2: O (Up) & L (Down)</p> + </div> +</div> \ No newline at end of file diff --git a/index.scroll b/index.scroll new file mode 100644 index 0000000..800936e --- /dev/null +++ b/index.scroll @@ -0,0 +1,8 @@ +buildHtml +baseUrl https://pongbattle.scroll.pub +metaTags +editButton /edit.html +title Pong Battle - Classic Pong Game +style.css +body.html +script.js \ No newline at end of file diff --git a/prompt.json b/prompt.json new file mode 100644 index 0000000..554d2ee --- /dev/null +++ b/prompt.json @@ -0,0 +1,25 @@ +{ + "id": "3a78ae1b-0194-4176-82f2-5dd42d289a87", + "object": "chat.completion", + "created": 1735432158, + "model": "deepseek-chat", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "---domain---\npongbattle.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://pongbattle.scroll.pub\nmetaTags\neditButton /edit.html\ntitle Pong Battle - Classic Pong Game\nstyle.css\nbody.html\nscript.js\n---body.html---\n<div class=\"game-container\">\n <div class=\"scoreboard\">\n <div class=\"player\">Player 1: <span id=\"player1-score\">0</span></div>\n <div class=\"player\">Player 2: <span id=\"player2-score\">0</span></div>\n </div>\n <div class=\"game-area\">\n <div id=\"paddle1\" class=\"paddle\"></div>\n <div id=\"paddle2\" class=\"paddle\"></div>\n <div id=\"ball\" class=\"ball\"></div>\n </div>\n <div class=\"controls\">\n <p>Player 1: W (Up) & S (Down)</p>\n <p>Player 2: O (Up) & L (Down)</p>\n </div>\n</div>\n---style.css---\nbody {\n margin: 0;\n padding: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100vh;\n background: linear-gradient(135deg, #1a1a2e, #16213e);\n color: #fff;\n font-family: 'Arial', sans-serif;\n}\n\n.game-container {\n text-align: center;\n}\n\n.scoreboard {\n display: flex;\n justify-content: space-around;\n margin-bottom: 20px;\n font-size: 24px;\n}\n\n.game-area {\n position: relative;\n width: 800px;\n height: 400px;\n background: #0f3460;\n border: 2px solid #e94560;\n overflow: hidden;\n}\n\n.paddle {\n position: absolute;\n width: 10px;\n height: 80px;\n background: #e94560;\n}\n\n#paddle1 {\n left: 10px;\n top: 160px;\n}\n\n#paddle2 {\n right: 10px;\n top: 160px;\n}\n\n.ball {\n position: absolute;\n width: 15px;\n height: 15px;\n background: #fff;\n border-radius: 50%;\n top: 192.5px;\n left: 392.5px;\n}\n\n.controls {\n margin-top: 20px;\n font-size: 18px;\n}\n\n@media (max-width: 768px) {\n .game-area {\n width: 90vw;\n height: 45vh;\n }\n\n .scoreboard {\n font-size: 18px;\n }\n\n .controls {\n font-size: 14px;\n }\n}\n---script.js---\nconst paddle1 = document.getElementById('paddle1');\nconst paddle2 = document.getElementById('paddle2');\nconst ball = document.getElementById('ball');\nconst player1Score = document.getElementById('player1-score');\nconst player2Score = document.getElementById('player2-score');\n\nlet paddle1Y = 160;\nlet paddle2Y = 160;\nlet ballX = 392.5;\nlet ballY = 192.5;\nlet ballSpeedX = 4;\nlet ballSpeedY = 4;\nlet score1 = 0;\nlet score2 = 0;\n\ndocument.addEventListener('keydown', (e) => {\n if (e.key === 'w' && paddle1Y > 0) {\n paddle1Y -= 20;\n } else if (e.key === 's' && paddle1Y < 320) {\n paddle1Y += 20;\n } else if (e.key === 'o' && paddle2Y > 0) {\n paddle2Y -= 20;\n } else if (e.key === 'l' && paddle2Y < 320) {\n paddle2Y += 20;\n }\n paddle1.style.top = paddle1Y + 'px';\n paddle2.style.top = paddle2Y + 'px';\n});\n\nfunction updateBall() {\n ballX += ballSpeedX;\n ballY += ballSpeedY;\n\n if (ballY <= 0 || ballY >= 385) {\n ballSpeedY = -ballSpeedY;\n }\n\n if (ballX <= 20 && ballY >= paddle1Y && ballY <= paddle1Y + 80) {\n ballSpeedX = -ballSpeedX;\n }\n\n if (ballX >= 765 && ballY >= paddle2Y && ballY <= paddle2Y + 80) {\n ballSpeedX = -ballSpeedX;\n }\n\n if (ballX <= 0) {\n score2++;\n player2Score.textContent = score2;\n resetBall();\n }\n\n if (ballX >= 785) {\n score1++;\n player1Score.textContent = score1;\n resetBall();\n }\n\n ball.style.left = ballX + 'px';\n ball.style.top = ballY + 'px';\n}\n\nfunction resetBall() {\n ballX = 392.5;\n ballY = 192.5;\n ballSpeedX = -ballSpeedX;\n}\n\nsetInterval(updateBall, 16);\n---end---" + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 263, + "completion_tokens": 1149, + "total_tokens": 1412, + "prompt_cache_hit_tokens": 0, + "prompt_cache_miss_tokens": 263 + }, + "system_fingerprint": "fp_f1afce2943" +} \ No newline at end of file diff --git a/readme.scroll b/readme.scroll new file mode 100644 index 0000000..1f40531 --- /dev/null +++ b/readme.scroll @@ -0,0 +1,2 @@ +# pongbattle.scroll.pub +Website generated by DeepSeek from prompt: pong game with points system that uses "w" and "s" to player one and "o" and "l" to player two \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..e014a33 --- /dev/null +++ b/script.js @@ -0,0 +1,68 @@ +const paddle1 = document.getElementById('paddle1'); +const paddle2 = document.getElementById('paddle2'); +const ball = document.getElementById('ball'); +const player1Score = document.getElementById('player1-score'); +const player2Score = document.getElementById('player2-score'); + +let paddle1Y = 160; +let paddle2Y = 160; +let ballX = 392.5; +let ballY = 192.5; +let ballSpeedX = 4; +let ballSpeedY = 4; +let score1 = 0; +let score2 = 0; + +document.addEventListener('keydown', (e) => { + if (e.key === 'w' && paddle1Y > 0) { + paddle1Y -= 20; + } else if (e.key === 's' && paddle1Y < 320) { + paddle1Y += 20; + } else if (e.key === 'o' && paddle2Y > 0) { + paddle2Y -= 20; + } else if (e.key === 'l' && paddle2Y < 320) { + paddle2Y += 20; + } + paddle1.style.top = paddle1Y + 'px'; + paddle2.style.top = paddle2Y + 'px'; +}); + +function updateBall() { + ballX += ballSpeedX; + ballY += ballSpeedY; + + if (ballY <= 0 || ballY >= 385) { + ballSpeedY = -ballSpeedY; + } + + if (ballX <= 20 && ballY >= paddle1Y && ballY <= paddle1Y + 80) { + ballSpeedX = -ballSpeedX; + } + + if (ballX >= 765 && ballY >= paddle2Y && ballY <= paddle2Y + 80) { + ballSpeedX = -ballSpeedX; + } + + if (ballX <= 0) { + score2++; + player2Score.textContent = score2; + resetBall(); + } + + if (ballX >= 785) { + score1++; + player1Score.textContent = score1; + resetBall(); + } + + ball.style.left = ballX + 'px'; + ball.style.top = ballY + 'px'; +} + +function resetBall() { + ballX = 392.5; + ballY = 192.5; + ballSpeedX = -ballSpeedX; +} + +setInterval(updateBall, 16); \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..1740a10 --- /dev/null +++ b/style.css @@ -0,0 +1,78 @@ +body { + margin: 0; + padding: 0; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + background: linear-gradient(135deg, #1a1a2e, #16213e); + color: #fff; + font-family: 'Arial', sans-serif; +} + +.game-container { + text-align: center; +} + +.scoreboard { + display: flex; + justify-content: space-around; + margin-bottom: 20px; + font-size: 24px; +} + +.game-area { + position: relative; + width: 800px; + height: 400px; + background: #0f3460; + border: 2px solid #e94560; + overflow: hidden; +} + +.paddle { + position: absolute; + width: 10px; + height: 80px; + background: #e94560; +} + +#paddle1 { + left: 10px; + top: 160px; +} + +#paddle2 { + right: 10px; + top: 160px; +} + +.ball { + position: absolute; + width: 15px; + height: 15px; + background: #fff; + border-radius: 50%; + top: 192.5px; + left: 392.5px; +} + +.controls { + margin-top: 20px; + font-size: 18px; +} + +@media (max-width: 768px) { + .game-area { + width: 90vw; + height: 45vh; + } + + .scoreboard { + font-size: 18px; + } + + .controls { + font-size: 14px; + } +} \ No newline at end of file