commit cce3af8d74c3aa6ebad87f232b6cf07546d0c1aa
Author: root <root@hub.scroll.pub>
Date: 2024-12-29 00:39:36 +0000
Subject: Initial commit
diff --git a/body.html b/body.html
new file mode 100644
index 0000000..986b519
--- /dev/null
+++ b/body.html
@@ -0,0 +1,10 @@
+<header>
+ <h1>Rainbow Breakout</h1>
+ <p>Move the paddle with your mouse to break all the rainbow 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..7d4961b
--- /dev/null
+++ b/index.scroll
@@ -0,0 +1,8 @@
+buildHtml
+baseUrl https://rainbowbreakout.scroll.pub
+metaTags
+editButton /edit.html
+title Rainbow 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..613326c
--- /dev/null
+++ b/prompt.json
@@ -0,0 +1,25 @@
+{
+ "id": "d8c9922a-c5c4-4073-8925-592c38075e01",
+ "object": "chat.completion",
+ "created": 1735432755,
+ "model": "deepseek-chat",
+ "choices": [
+ {
+ "index": 0,
+ "message": {
+ "role": "assistant",
+ "content": "---domain---\nrainbowbreakout.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://rainbowbreakout.scroll.pub\nmetaTags\neditButton /edit.html\ntitle Rainbow Breakout Game\nstyle.css\nbody.html\nscript.js\n---body.html---\n<header>\n <h1>Rainbow Breakout</h1>\n <p>Move the paddle with your mouse to break all the rainbow 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: white;\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\nh1 {\n font-size: 2.5rem;\n margin-bottom: 10px;\n}\n\np {\n font-size: 1.2rem;\n}\n\nmain {\n width: 100%;\n max-width: 800px;\n display: flex;\n justify-content: center;\n}\n\ncanvas {\n background: #000;\n border: 5px solid #fff;\n border-radius: 10px;\n box-shadow: 0 0 20px rgba(255, 255, 255, 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 h1 {\n font-size: 2rem;\n }\n\n p {\n font-size: 1rem;\n }\n\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 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 x = canvas.width / 2;\nlet y = canvas.height - 30;\nlet dx = 2;\nlet dy = -2;\nlet paddleX = (canvas.width - paddleWidth) / 2;\nlet rightPressed = false;\nlet leftPressed = false;\nlet score = 0;\nlet lives = 3;\n\nconst bricks = [];\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', mouseMoveHandler);\n\nfunction mouseMoveHandler(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(x, y, ballRadius, 0, Math.PI * 2);\n ctx.fillStyle = '#fff';\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 = '#fff';\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 = `hsl(${c * 50}, 100%, 50%)`;\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 (x > b.x && x < b.x + brickWidth && y > b.y && y < b.y + brickHeight) {\n dy = -dy;\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 drawLives() {\n ctx.font = '16px Arial';\n ctx.fillStyle = '#fff';\n ctx.fillText(`Lives: ${lives}`, canvas.width - 65, 20);\n}\n\nfunction draw() {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n drawBricks();\n drawBall();\n drawPaddle();\n drawScore();\n drawLives();\n collisionDetection();\n\n if (x + dx > canvas.width - ballRadius || x + dx < ballRadius) {\n dx = -dx;\n }\n if (y + dy < ballRadius) {\n dy = -dy;\n } else if (y + dy > canvas.height - ballRadius) {\n if (x > paddleX && x < paddleX + paddleWidth) {\n dy = -dy;\n } else {\n lives--;\n if (!lives) {\n alert('GAME OVER');\n document.location.reload();\n } else {\n x = canvas.width / 2;\n y = canvas.height - 30;\n dx = 2;\n dy = -2;\n paddleX = (canvas.width - paddleWidth) / 2;\n }\n }\n }\n\n x += dx;\n y += dy;\n requestAnimationFrame(draw);\n}\n\ndraw();\n---end---"
+ },
+ "logprobs": null,
+ "finish_reason": "stop"
+ }
+ ],
+ "usage": {
+ "prompt_tokens": 243,
+ "completion_tokens": 1515,
+ "total_tokens": 1758,
+ "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..1d552f6
--- /dev/null
+++ b/readme.scroll
@@ -0,0 +1,2 @@
+# rainbowbreakout.scroll.pub
+Website generated by DeepSeek from prompt: full functional rainbow 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..b3cadec
--- /dev/null
+++ b/script.js
@@ -0,0 +1,144 @@
+const canvas = document.getElementById('gameCanvas');
+const ctx = canvas.getContext('2d');
+
+const paddleWidth = 100;
+const paddleHeight = 10;
+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 x = canvas.width / 2;
+let y = canvas.height - 30;
+let dx = 2;
+let dy = -2;
+let paddleX = (canvas.width - paddleWidth) / 2;
+let rightPressed = false;
+let leftPressed = false;
+let score = 0;
+let lives = 3;
+
+const 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', mouseMoveHandler);
+
+function mouseMoveHandler(e) {
+ const relativeX = e.clientX - canvas.offsetLeft;
+ if (relativeX > 0 && relativeX < canvas.width) {
+ paddleX = relativeX - paddleWidth / 2;
+ }
+}
+
+function drawBall() {
+ ctx.beginPath();
+ ctx.arc(x, y, ballRadius, 0, Math.PI * 2);
+ ctx.fillStyle = '#fff';
+ ctx.fill();
+ ctx.closePath();
+}
+
+function drawPaddle() {
+ ctx.beginPath();
+ ctx.rect(paddleX, canvas.height - paddleHeight, paddleWidth, paddleHeight);
+ ctx.fillStyle = '#fff';
+ 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 = `hsl(${c * 50}, 100%, 50%)`;
+ 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 (x > b.x && x < b.x + brickWidth && y > b.y && y < b.y + brickHeight) {
+ dy = -dy;
+ 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 drawLives() {
+ ctx.font = '16px Arial';
+ ctx.fillStyle = '#fff';
+ ctx.fillText(`Lives: ${lives}`, canvas.width - 65, 20);
+}
+
+function draw() {
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ drawBricks();
+ drawBall();
+ drawPaddle();
+ drawScore();
+ drawLives();
+ collisionDetection();
+
+ if (x + dx > canvas.width - ballRadius || x + dx < ballRadius) {
+ dx = -dx;
+ }
+ if (y + dy < ballRadius) {
+ dy = -dy;
+ } else if (y + dy > canvas.height - ballRadius) {
+ if (x > paddleX && x < paddleX + paddleWidth) {
+ dy = -dy;
+ } else {
+ lives--;
+ if (!lives) {
+ alert('GAME OVER');
+ document.location.reload();
+ } else {
+ x = canvas.width / 2;
+ y = canvas.height - 30;
+ dx = 2;
+ dy = -2;
+ paddleX = (canvas.width - paddleWidth) / 2;
+ }
+ }
+ }
+
+ x += dx;
+ y += dy;
+ requestAnimationFrame(draw);
+}
+
+draw();
\ No newline at end of file
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..85fc597
--- /dev/null
+++ b/style.css
@@ -0,0 +1,66 @@
+* {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+}
+
+body {
+ font-family: 'Arial', sans-serif;
+ background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
+ color: white;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ min-height: 100vh;
+ padding: 20px;
+}
+
+header {
+ text-align: center;
+ margin-bottom: 20px;
+}
+
+h1 {
+ font-size: 2.5rem;
+ margin-bottom: 10px;
+}
+
+p {
+ font-size: 1.2rem;
+}
+
+main {
+ width: 100%;
+ max-width: 800px;
+ display: flex;
+ justify-content: center;
+}
+
+canvas {
+ background: #000;
+ border: 5px solid #fff;
+ border-radius: 10px;
+ box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
+}
+
+footer {
+ text-align: center;
+ margin-top: 20px;
+ font-size: 1rem;
+}
+
+@media (max-width: 768px) {
+ h1 {
+ font-size: 2rem;
+ }
+
+ p {
+ font-size: 1rem;
+ }
+
+ canvas {
+ width: 100%;
+ height: auto;
+ }
+}
\ No newline at end of file