commit df5fba3af538e3adf8e46ff6d5aa5c8d34c3ad50
Author: root <root@hub.scroll.pub>
Date: 2024-12-29 00:36:37 +0000
Subject: Initial commit
diff --git a/body.html b/body.html
new file mode 100644
index 0000000..05c8003
--- /dev/null
+++ b/body.html
@@ -0,0 +1,10 @@
+<header>
+ <h1>Colorful Breakout Game</h1>
+ <p>Move the paddle with your mouse to break all the bricks!</p>
+</header>
+<main>
+ <canvas id="gameCanvas" width="800" height="600"></canvas>
+</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..28a215e
--- /dev/null
+++ b/index.scroll
@@ -0,0 +1,8 @@
+buildHtml
+baseUrl https://breakout.scroll.pub
+metaTags
+editButton /edit.html
+title Colorful Breakout 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..4b39b35
--- /dev/null
+++ b/prompt.json
@@ -0,0 +1,25 @@
+{
+ "id": "41637fb2-c8e6-4d73-8c17-b77e11a91d79",
+ "object": "chat.completion",
+ "created": 1735432580,
+ "model": "deepseek-chat",
+ "choices": [
+ {
+ "index": 0,
+ "message": {
+ "role": "assistant",
+ "content": "---domain---\nbreakout.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://breakout.scroll.pub\nmetaTags\neditButton /edit.html\ntitle Colorful Breakout Game\nstyle.css\nbody.html\nscript.js\n---body.html---\n<header>\n <h1>Colorful Breakout Game</h1>\n <p>Move the paddle with your mouse to break all the bricks!</p>\n</header>\n<main>\n <canvas id=\"gameCanvas\" width=\"800\" height=\"600\"></canvas>\n</main>\n<footer>\n <p>Enjoy the game!</p>\n</footer>\n---style.css---\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: 'Arial', sans-serif;\n background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);\n color: #fff;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n min-height: 100vh;\n padding: 20px;\n}\n\nheader {\n text-align: center;\n margin-bottom: 20px;\n}\n\nheader h1 {\n font-size: 2.5rem;\n margin-bottom: 10px;\n}\n\nheader p {\n font-size: 1.2rem;\n}\n\nmain {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\ncanvas {\n background: #000;\n border-radius: 10px;\n box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);\n}\n\nfooter {\n text-align: center;\n margin-top: 20px;\n font-size: 1rem;\n}\n\n@media (max-width: 768px) {\n canvas {\n width: 100%;\n height: auto;\n }\n}\n---script.js---\nconst canvas = document.getElementById('gameCanvas');\nconst ctx = canvas.getContext('2d');\n\nconst paddleWidth = 100;\nconst paddleHeight = 10;\nconst paddleSpeed = 8;\nconst ballRadius = 10;\nconst brickRowCount = 5;\nconst brickColumnCount = 7;\nconst brickWidth = 75;\nconst brickHeight = 20;\nconst brickPadding = 10;\nconst brickOffsetTop = 30;\nconst brickOffsetLeft = 30;\n\nlet paddleX = (canvas.width - paddleWidth) / 2;\nlet ballX = canvas.width / 2;\nlet ballY = canvas.height - 30;\nlet ballDX = 4;\nlet ballDY = -4;\nlet rightPressed = false;\nlet leftPressed = false;\nlet score = 0;\nlet bricks = [];\n\nfor (let c = 0; c < brickColumnCount; c++) {\n bricks[c] = [];\n for (let r = 0; r < brickRowCount; r++) {\n bricks[c][r] = { x: 0, y: 0, status: 1 };\n }\n}\n\ndocument.addEventListener('mousemove', (e) => {\n const relativeX = e.clientX - canvas.offsetLeft;\n if (relativeX > 0 && relativeX < canvas.width) {\n paddleX = relativeX - paddleWidth / 2;\n }\n});\n\nfunction drawBall() {\n ctx.beginPath();\n ctx.arc(ballX, ballY, ballRadius, 0, Math.PI * 2);\n ctx.fillStyle = '#ff4757';\n ctx.fill();\n ctx.closePath();\n}\n\nfunction drawPaddle() {\n ctx.beginPath();\n ctx.rect(paddleX, canvas.height - paddleHeight, paddleWidth, paddleHeight);\n ctx.fillStyle = '#2ed573';\n ctx.fill();\n ctx.closePath();\n}\n\nfunction drawBricks() {\n for (let c = 0; c < brickColumnCount; c++) {\n for (let r = 0; r < brickRowCount; r++) {\n if (bricks[c][r].status === 1) {\n const brickX = c * (brickWidth + brickPadding) + brickOffsetLeft;\n const brickY = r * (brickHeight + brickPadding) + brickOffsetTop;\n bricks[c][r].x = brickX;\n bricks[c][r].y = brickY;\n ctx.beginPath();\n ctx.rect(brickX, brickY, brickWidth, brickHeight);\n ctx.fillStyle = '#ffa502';\n ctx.fill();\n ctx.closePath();\n }\n }\n }\n}\n\nfunction collisionDetection() {\n for (let c = 0; c < brickColumnCount; c++) {\n for (let r = 0; r < brickRowCount; r++) {\n const b = bricks[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 if (score === brickRowCount * brickColumnCount) {\n alert('YOU WIN, CONGRATULATIONS!');\n document.location.reload();\n }\n }\n }\n }\n }\n}\n\nfunction drawScore() {\n ctx.font = '16px Arial';\n ctx.fillStyle = '#fff';\n ctx.fillText('Score: ' + score, 8, 20);\n}\n\nfunction draw() {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n drawBricks();\n drawBall();\n drawPaddle();\n drawScore();\n collisionDetection();\n\n if (ballX + ballDX > canvas.width - ballRadius || ballX + ballDX < ballRadius) {\n ballDX = -ballDX;\n }\n if (ballY + ballDY < ballRadius) {\n ballDY = -ballDY;\n } else if (ballY + ballDY > canvas.height - ballRadius) {\n if (ballX > paddleX && ballX < paddleX + paddleWidth) {\n ballDY = -ballDY;\n } else {\n alert('GAME OVER');\n document.location.reload();\n }\n }\n\n ballX += ballDX;\n ballY += ballDY;\n requestAnimationFrame(draw);\n}\n\ndraw();\n---end---"
+ },
+ "logprobs": null,
+ "finish_reason": "stop"
+ }
+ ],
+ "usage": {
+ "prompt_tokens": 243,
+ "completion_tokens": 1377,
+ "total_tokens": 1620,
+ "prompt_cache_hit_tokens": 0,
+ "prompt_cache_miss_tokens": 243
+ },
+ "system_fingerprint": "fp_f1afce2943"
+}
\ No newline at end of file
diff --git a/readme.scroll b/readme.scroll
new file mode 100644
index 0000000..5c0f702
--- /dev/null
+++ b/readme.scroll
@@ -0,0 +1,2 @@
+# breakout1.scroll.pub
+Website generated by DeepSeek from prompt: full functional colorful breakout game controlled by the mouse
\ No newline at end of file
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..0643759
--- /dev/null
+++ b/script.js
@@ -0,0 +1,126 @@
+const canvas = document.getElementById('gameCanvas');
+const ctx = canvas.getContext('2d');
+
+const paddleWidth = 100;
+const paddleHeight = 10;
+const paddleSpeed = 8;
+const ballRadius = 10;
+const brickRowCount = 5;
+const brickColumnCount = 7;
+const brickWidth = 75;
+const brickHeight = 20;
+const brickPadding = 10;
+const brickOffsetTop = 30;
+const brickOffsetLeft = 30;
+
+let paddleX = (canvas.width - paddleWidth) / 2;
+let ballX = canvas.width / 2;
+let ballY = canvas.height - 30;
+let ballDX = 4;
+let ballDY = -4;
+let rightPressed = false;
+let leftPressed = false;
+let score = 0;
+let bricks = [];
+
+for (let c = 0; c < brickColumnCount; c++) {
+ bricks[c] = [];
+ for (let r = 0; r < brickRowCount; r++) {
+ bricks[c][r] = { x: 0, y: 0, status: 1 };
+ }
+}
+
+document.addEventListener('mousemove', (e) => {
+ const relativeX = e.clientX - canvas.offsetLeft;
+ if (relativeX > 0 && relativeX < canvas.width) {
+ paddleX = relativeX - paddleWidth / 2;
+ }
+});
+
+function drawBall() {
+ ctx.beginPath();
+ ctx.arc(ballX, ballY, ballRadius, 0, Math.PI * 2);
+ ctx.fillStyle = '#ff4757';
+ ctx.fill();
+ ctx.closePath();
+}
+
+function drawPaddle() {
+ ctx.beginPath();
+ ctx.rect(paddleX, canvas.height - paddleHeight, paddleWidth, paddleHeight);
+ ctx.fillStyle = '#2ed573';
+ ctx.fill();
+ ctx.closePath();
+}
+
+function drawBricks() {
+ for (let c = 0; c < brickColumnCount; c++) {
+ for (let r = 0; r < brickRowCount; r++) {
+ if (bricks[c][r].status === 1) {
+ const brickX = c * (brickWidth + brickPadding) + brickOffsetLeft;
+ const brickY = r * (brickHeight + brickPadding) + brickOffsetTop;
+ bricks[c][r].x = brickX;
+ bricks[c][r].y = brickY;
+ ctx.beginPath();
+ ctx.rect(brickX, brickY, brickWidth, brickHeight);
+ ctx.fillStyle = '#ffa502';
+ ctx.fill();
+ ctx.closePath();
+ }
+ }
+ }
+}
+
+function collisionDetection() {
+ for (let c = 0; c < brickColumnCount; c++) {
+ for (let r = 0; r < brickRowCount; r++) {
+ const b = bricks[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++;
+ if (score === brickRowCount * brickColumnCount) {
+ alert('YOU WIN, CONGRATULATIONS!');
+ document.location.reload();
+ }
+ }
+ }
+ }
+ }
+}
+
+function drawScore() {
+ ctx.font = '16px Arial';
+ ctx.fillStyle = '#fff';
+ ctx.fillText('Score: ' + score, 8, 20);
+}
+
+function draw() {
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ drawBricks();
+ drawBall();
+ drawPaddle();
+ drawScore();
+ collisionDetection();
+
+ if (ballX + ballDX > canvas.width - ballRadius || ballX + ballDX < ballRadius) {
+ ballDX = -ballDX;
+ }
+ if (ballY + ballDY < ballRadius) {
+ ballDY = -ballDY;
+ } else if (ballY + ballDY > canvas.height - ballRadius) {
+ if (ballX > paddleX && ballX < paddleX + paddleWidth) {
+ ballDY = -ballDY;
+ } else {
+ alert('GAME OVER');
+ document.location.reload();
+ }
+ }
+
+ ballX += ballDX;
+ ballY += ballDY;
+ requestAnimationFrame(draw);
+}
+
+draw();
\ No newline at end of file
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..49d9433
--- /dev/null
+++ b/style.css
@@ -0,0 +1,56 @@
+* {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+}
+
+body {
+ font-family: 'Arial', sans-serif;
+ background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
+ color: #fff;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ min-height: 100vh;
+ padding: 20px;
+}
+
+header {
+ text-align: center;
+ margin-bottom: 20px;
+}
+
+header h1 {
+ font-size: 2.5rem;
+ margin-bottom: 10px;
+}
+
+header p {
+ font-size: 1.2rem;
+}
+
+main {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+canvas {
+ background: #000;
+ border-radius: 10px;
+ box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
+}
+
+footer {
+ text-align: center;
+ margin-top: 20px;
+ font-size: 1rem;
+}
+
+@media (max-width: 768px) {
+ canvas {
+ width: 100%;
+ height: auto;
+ }
+}
\ No newline at end of file