commit 2365e1a614aac03b0ebdcd085eaff3e94fabec2d
Author: root <root@hub.scroll.pub>
Date: 2024-12-27 17:02:45 +0000
Subject: Initial commit
diff --git a/body.html b/body.html
new file mode 100644
index 0000000..918ff77
--- /dev/null
+++ b/body.html
@@ -0,0 +1,16 @@
+<header>
+ <h1>Arkanoid Game</h1>
+ <p>Break the bricks and score points!</p>
+</header>
+<main>
+ <svg id="gameArea" width="800" height="600">
+ <rect id="paddle" x="350" y="550" width="100" height="10" fill="#4CAF50" />
+ <circle id="ball" cx="400" cy="300" r="10" fill="#FF5722" />
+ <g id="bricks"></g>
+ </svg>
+ <div id="score">Score: 0</div>
+ <button id="startButton">Start Game</button>
+</main>
+<footer>
+ <p>Enjoy the game!</p>
+</footer>
\ No newline at end of file
diff --git a/index.scroll b/index.scroll
new file mode 100644
index 0000000..ccaec07
--- /dev/null
+++ b/index.scroll
@@ -0,0 +1,8 @@
+buildHtml
+baseUrl https://arkanoid.scroll.pub
+metaTags
+editButton /edit.html
+title Arkanoid 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..e3885af
--- /dev/null
+++ b/prompt.json
@@ -0,0 +1,25 @@
+{
+ "id": "bb5f5301-4eba-45ea-9b1a-b96928ef2756",
+ "object": "chat.completion",
+ "created": 1735318940,
+ "model": "deepseek-chat",
+ "choices": [
+ {
+ "index": 0,
+ "message": {
+ "role": "assistant",
+ "content": "---domain---\narkanoid.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://arkanoid.scroll.pub\nmetaTags\neditButton /edit.html\ntitle Arkanoid Game\nstyle.css\nbody.html\nscript.js\n---body.html---\n<header>\n <h1>Arkanoid Game</h1>\n <p>Break the bricks and score points!</p>\n</header>\n<main>\n <svg id=\"gameArea\" width=\"800\" height=\"600\">\n <rect id=\"paddle\" x=\"350\" y=\"550\" width=\"100\" height=\"10\" fill=\"#4CAF50\" />\n <circle id=\"ball\" cx=\"400\" cy=\"300\" r=\"10\" fill=\"#FF5722\" />\n <g id=\"bricks\"></g>\n </svg>\n <div id=\"score\">Score: 0</div>\n <button id=\"startButton\">Start Game</button>\n</main>\n<footer>\n <p>Enjoy the game!</p>\n</footer>\n---style.css---\nbody {\n font-family: 'Arial', sans-serif;\n background-color: #f4f4f4;\n color: #333;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100vh;\n}\n\nheader {\n text-align: center;\n margin-bottom: 20px;\n}\n\nh1 {\n font-size: 2.5rem;\n color: #4CAF50;\n}\n\np {\n font-size: 1.2rem;\n}\n\n#gameArea {\n background-color: #fff;\n border: 2px solid #4CAF50;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n}\n\n#paddle {\n transition: x 0.1s;\n}\n\n#ball {\n transition: cx 0.1s, cy 0.1s;\n}\n\n#bricks rect {\n fill: #2196F3;\n stroke: #0D47A1;\n stroke-width: 2;\n}\n\n#score {\n font-size: 1.5rem;\n margin-top: 20px;\n}\n\n#startButton {\n margin-top: 20px;\n padding: 10px 20px;\n font-size: 1rem;\n background-color: #4CAF50;\n color: #fff;\n border: none;\n cursor: pointer;\n transition: background-color 0.3s;\n}\n\n#startButton:hover {\n background-color: #45a049;\n}\n\nfooter {\n margin-top: 20px;\n text-align: center;\n font-size: 0.9rem;\n color: #777;\n}\n---script.js---\nconst paddle = document.getElementById('paddle');\nconst ball = document.getElementById('ball');\nconst bricks = document.getElementById('bricks');\nconst startButton = document.getElementById('startButton');\nconst scoreDisplay = document.getElementById('score');\n\nlet paddleX = 350;\nlet ballX = 400;\nlet ballY = 300;\nlet ballDX = 4;\nlet ballDY = -4;\nlet score = 0;\nlet gameInterval;\n\nconst brickRowCount = 5;\nconst brickColumnCount = 10;\nconst brickWidth = 75;\nconst brickHeight = 20;\nconst brickPadding = 10;\nconst brickOffsetTop = 30;\nconst brickOffsetLeft = 30;\n\nconst brickLayout = [];\n\nfor (let c = 0; c < brickColumnCount; c++) {\n brickLayout[c] = [];\n for (let r = 0; r < brickRowCount; r++) {\n brickLayout[c][r] = { x: 0, y: 0, status: 1 };\n }\n}\n\nfunction drawBricks() {\n bricks.innerHTML = '';\n for (let c = 0; c < brickColumnCount; c++) {\n for (let r = 0; r < brickRowCount; r++) {\n if (brickLayout[c][r].status === 1) {\n const brickX = c * (brickWidth + brickPadding) + brickOffsetLeft;\n const brickY = r * (brickHeight + brickPadding) + brickOffsetTop;\n brickLayout[c][r].x = brickX;\n brickLayout[c][r].y = brickY;\n const brick = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n brick.setAttribute('x', brickX);\n brick.setAttribute('y', brickY);\n brick.setAttribute('width', brickWidth);\n brick.setAttribute('height', brickHeight);\n bricks.appendChild(brick);\n }\n }\n }\n}\n\nfunction movePaddle(event) {\n const gameArea = document.getElementById('gameArea');\n const rect = gameArea.getBoundingClientRect();\n paddleX = event.clientX - rect.left - paddle.getAttribute('width') / 2;\n if (paddleX < 0) paddleX = 0;\n if (paddleX > 700) paddleX = 700;\n paddle.setAttribute('x', paddleX);\n}\n\nfunction moveBall() {\n ballX += ballDX;\n ballY += ballDY;\n\n if (ballX < 10 || ballX > 790) ballDX = -ballDX;\n if (ballY < 10) ballDY = -ballDY;\n\n if (ballY > 540) {\n if (ballX > paddleX && ballX < paddleX + 100) {\n ballDY = -ballDY;\n } else {\n clearInterval(gameInterval);\n alert('Game Over! Your score: ' + score);\n resetGame();\n }\n }\n\n ball.setAttribute('cx', ballX);\n ball.setAttribute('cy', ballY);\n\n collisionDetection();\n}\n\nfunction collisionDetection() {\n for (let c = 0; c < brickColumnCount; c++) {\n for (let r = 0; r < brickRowCount; r++) {\n const b = brickLayout[c][r];\n if (b.status === 1) {\n if (ballX > b.x && ballX < b.x + brickWidth && ballY > b.y && ballY < b.y + brickHeight) {\n ballDY = -ballDY;\n b.status = 0;\n score++;\n scoreDisplay.textContent = 'Score: ' + score;\n if (score === brickRowCount * brickColumnCount) {\n alert('You Win!');\n resetGame();\n }\n }\n }\n }\n }\n}\n\nfunction resetGame() {\n ballX = 400;\n ballY = 300;\n ballDX = 4;\n ballDY = -4;\n score = 0;\n scoreDisplay.textContent = 'Score: 0';\n for (let c = 0; c < brickColumnCount; c++) {\n for (let r = 0; r < brickRowCount; r++) {\n brickLayout[c][r].status = 1;\n }\n }\n drawBricks();\n}\n\nstartButton.addEventListener('click', () => {\n resetGame();\n gameInterval = setInterval(moveBall, 10);\n});\n\ndocument.addEventListener('mousemove', movePaddle);\n\ndrawBricks();\n---end---"
+ },
+ "logprobs": null,
+ "finish_reason": "stop"
+ }
+ ],
+ "usage": {
+ "prompt_tokens": 246,
+ "completion_tokens": 1599,
+ "total_tokens": 1845,
+ "prompt_cache_hit_tokens": 0,
+ "prompt_cache_miss_tokens": 246
+ },
+ "system_fingerprint": "fp_f1afce2943"
+}
\ No newline at end of file
diff --git a/readme.scroll b/readme.scroll
new file mode 100644
index 0000000..f3b39bf
--- /dev/null
+++ b/readme.scroll
@@ -0,0 +1,2 @@
+# arkanoid.scroll.pub
+Website generated by DeepSeek from prompt: Build a game similar to arkanoid using svg images
\ No newline at end of file
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..120ab0f
--- /dev/null
+++ b/script.js
@@ -0,0 +1,126 @@
+const paddle = document.getElementById('paddle');
+const ball = document.getElementById('ball');
+const bricks = document.getElementById('bricks');
+const startButton = document.getElementById('startButton');
+const scoreDisplay = document.getElementById('score');
+
+let paddleX = 350;
+let ballX = 400;
+let ballY = 300;
+let ballDX = 4;
+let ballDY = -4;
+let score = 0;
+let gameInterval;
+
+const brickRowCount = 5;
+const brickColumnCount = 10;
+const brickWidth = 75;
+const brickHeight = 20;
+const brickPadding = 10;
+const brickOffsetTop = 30;
+const brickOffsetLeft = 30;
+
+const brickLayout = [];
+
+for (let c = 0; c < brickColumnCount; c++) {
+ brickLayout[c] = [];
+ for (let r = 0; r < brickRowCount; r++) {
+ brickLayout[c][r] = { x: 0, y: 0, status: 1 };
+ }
+}
+
+function drawBricks() {
+ bricks.innerHTML = '';
+ for (let c = 0; c < brickColumnCount; c++) {
+ for (let r = 0; r < brickRowCount; r++) {
+ if (brickLayout[c][r].status === 1) {
+ const brickX = c * (brickWidth + brickPadding) + brickOffsetLeft;
+ const brickY = r * (brickHeight + brickPadding) + brickOffsetTop;
+ brickLayout[c][r].x = brickX;
+ brickLayout[c][r].y = brickY;
+ const brick = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
+ brick.setAttribute('x', brickX);
+ brick.setAttribute('y', brickY);
+ brick.setAttribute('width', brickWidth);
+ brick.setAttribute('height', brickHeight);
+ bricks.appendChild(brick);
+ }
+ }
+ }
+}
+
+function movePaddle(event) {
+ const gameArea = document.getElementById('gameArea');
+ const rect = gameArea.getBoundingClientRect();
+ paddleX = event.clientX - rect.left - paddle.getAttribute('width') / 2;
+ if (paddleX < 0) paddleX = 0;
+ if (paddleX > 700) paddleX = 700;
+ paddle.setAttribute('x', paddleX);
+}
+
+function moveBall() {
+ ballX += ballDX;
+ ballY += ballDY;
+
+ if (ballX < 10 || ballX > 790) ballDX = -ballDX;
+ if (ballY < 10) ballDY = -ballDY;
+
+ if (ballY > 540) {
+ if (ballX > paddleX && ballX < paddleX + 100) {
+ ballDY = -ballDY;
+ } else {
+ clearInterval(gameInterval);
+ alert('Game Over! Your score: ' + score);
+ resetGame();
+ }
+ }
+
+ ball.setAttribute('cx', ballX);
+ ball.setAttribute('cy', ballY);
+
+ collisionDetection();
+}
+
+function collisionDetection() {
+ for (let c = 0; c < brickColumnCount; c++) {
+ for (let r = 0; r < brickRowCount; r++) {
+ const b = brickLayout[c][r];
+ if (b.status === 1) {
+ if (ballX > b.x && ballX < b.x + brickWidth && ballY > b.y && ballY < b.y + brickHeight) {
+ ballDY = -ballDY;
+ b.status = 0;
+ score++;
+ scoreDisplay.textContent = 'Score: ' + score;
+ if (score === brickRowCount * brickColumnCount) {
+ alert('You Win!');
+ resetGame();
+ }
+ }
+ }
+ }
+ }
+}
+
+function resetGame() {
+ ballX = 400;
+ ballY = 300;
+ ballDX = 4;
+ ballDY = -4;
+ score = 0;
+ scoreDisplay.textContent = 'Score: 0';
+ for (let c = 0; c < brickColumnCount; c++) {
+ for (let r = 0; r < brickRowCount; r++) {
+ brickLayout[c][r].status = 1;
+ }
+ }
+ drawBricks();
+}
+
+startButton.addEventListener('click', () => {
+ resetGame();
+ gameInterval = setInterval(moveBall, 10);
+});
+
+document.addEventListener('mousemove', movePaddle);
+
+drawBricks();
\ No newline at end of file
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..2f95f18
--- /dev/null
+++ b/style.css
@@ -0,0 +1,73 @@
+body {
+ font-family: 'Arial', sans-serif;
+ background-color: #f4f4f4;
+ color: #333;
+ margin: 0;
+ padding: 0;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ height: 100vh;
+}
+
+header {
+ text-align: center;
+ margin-bottom: 20px;
+}
+
+h1 {
+ font-size: 2.5rem;
+ color: #4CAF50;
+}
+
+p {
+ font-size: 1.2rem;
+}
+
+#gameArea {
+ background-color: #fff;
+ border: 2px solid #4CAF50;
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
+}
+
+#paddle {
+ transition: x 0.1s;
+}
+
+#ball {
+ transition: cx 0.1s, cy 0.1s;
+}
+
+#bricks rect {
+ fill: #2196F3;
+ stroke: #0D47A1;
+ stroke-width: 2;
+}
+
+#score {
+ font-size: 1.5rem;
+ margin-top: 20px;
+}
+
+#startButton {
+ margin-top: 20px;
+ padding: 10px 20px;
+ font-size: 1rem;
+ background-color: #4CAF50;
+ color: #fff;
+ border: none;
+ cursor: pointer;
+ transition: background-color 0.3s;
+}
+
+#startButton:hover {
+ background-color: #45a049;
+}
+
+footer {
+ margin-top: 20px;
+ text-align: center;
+ font-size: 0.9rem;
+ color: #777;
+}
\ No newline at end of file