#65,218,275Inscription #65218274#65,218,274png#65,111,066Inscription #65111065#65,111,065pngInscription #63975373#63,975,373html#63,965,069Inscription #63965068#63,965,068png#63,965,065Inscription #63965064#63,965,064png#63,965,043Inscription #63965042#63,965,042png#63,965,036Inscription #63965035#63,965,035png#63,582,082Inscription #63582081#63,582,081html#63,443,184Inscription #63443183#63,443,183html#62,376,902Inscription #62376901#62,376,901png#62,376,815Inscription #62376814#62,376,814png#62,376,784Inscription #62376783#62,376,783png#62,249,963Inscription #62249962#62,249,962png#62,249,961Inscription #62249960#62,249,960png#62,249,951Inscription #62249950#62,249,950png#62,249,942Inscription #62249941#62,249,941png#62,249,936Inscription #62249935#62,249,935png#62,249,934Inscription #62249933#62,249,933png#61,110,976Inscription #61110975#61,110,975png#61,096,554Inscription #61096553#61,096,553png#61,061,928Inscription #61061927#61,061,927png#61,010,061Inscription #61010060#61,010,060png#61,010,059Inscription #61010058#61,010,058png#61,010,053Inscription #61010052#61,010,052png#60,839,024Inscription #60839023#60,839,023pngInscription #50525447#50,525,447webpInscription #50514950#50,514,950webpInscription #50512132#50,512,132webpInscription #18915731#18,915,731htmlInscription #17716175#17,716,175gifInscription #17716153#17,716,153gifInscription #17716128#17,716,128gif<!DOCTYPE html> <html> <head> <title>Snake Game</title> <style> body { background-color: orange; } #game-board { width: 400px; height: 400px; border: 1px solid #000; margin: 0 auto; position: relative; background-color: black; } .cell { width: 20px; height: 20px; background-color: orange; /* Farbe der Schlange auf orange ändern */ position: absolute; } .bitcoin { background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/4/46/Bitcoin.svg/800px-Bitcoin.svg.png'); background-size: cover; } </style> </head> <body> <div id="game-board"></div> <div id="score">Score: 0</div> <script> document.addEventListener("DOMContentLoaded", function () { var gameBoard = document.getElementById("game-board"); var scoreElement = document.getElementById("score"); var gridSize = 20; var gridWidth = gameBoard.offsetWidth / gridSize; var gridHeight = gameBoard.offsetHeight / gridSize; var snake = [{ x: 0, y: 0 }]; var direction = "right"; var bitcoinImage = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/46/Bitcoin.svg/800px-Bitcoin.svg.png"; var food = { x: Math.floor(Math.random() * gridWidth), y: Math.floor(Math.random() * gridHeight) }; var score = 0; function draw() { gameBoard.innerHTML = ""; snake.forEach(function (segment) { var snakeCell = document.createElement("div"); snakeCell.className = "cell"; snakeCell.style.left = segment.x * gridSize + "px"; snakeCell.style.top = segment.y * gridSize + "px"; gameBoard.appendChild(snakeCell); }); var foodCell = document.createElement("div"); foodCell.className = "cell bitcoin"; foodCell.style.left = food.x * gridSize + "px"; foodCell.style.top = food.y * gridSize + "px"; gameBoard.appendChild(foodCell); } function update() { var head = Object.assign({}, snake[0]); if (direction === "right") { head.x++; } else if (direction === "left") { head.x--; } else if (direction === "up") { head.y--; } else if (direction === "down") { head.y++; } if (head.x < 0 || head.x >= gridWidth || head.y < 0 || head.y >= gridHeight) { // Kollision mit Spielfeldrand gameOver(); return; } if (snake.some(function (segment) { return segment.x === head.x && segment.y === head.y; })) { // Kollision mit dem eigenen Schwanz gameOver(); return; } snake.unshift(head); if (head.x === food.x && head.y === food.y) { // Snake hat das Futter erreicht food = { x: Math.floor(Math.random() * gridWidth), y: Math.floor(Math.random() * gridHeight) }; score += 10; // Punkte erhöhen scoreElement.textContent = "Score: " + score; } else { snake.pop(); } draw(); } function changeDirection(event) { var key = event.keyCode; if (key === 37 && direction !== "right") { direction = "left"; } else if (key === 38 && direction !== "down") { direction = "up"; } else if (key === 39 && direction !== "left") { direction = "right"; } else if (key === 40 && direction !== "up") { direction = "down"; } } function gameOver() { alert("Game Over. Your score is: " + score); resetGame(); } function resetGame() { snake = [{ x: 0, y: 0 }]; direction = "right"; food = { x: Math.floor(Math.random() * gridWidth), y: Math.floor(Math.random() * gridHeight) }; score = 0; // Punktestand zurücksetzen scoreElement.textContent = "Score: " + score; draw(); } draw(); setInterval(update, 200); document.addEventListener("keydown", changeDirection); }); </script> </body> </html>#15,564,245textInscription #13492841#13,492,841png107631.bitmap#13,080,895text107633.bitmap#13,080,835text