{"id":1423,"date":"2025-11-21T09:45:39","date_gmt":"2025-11-21T08:45:39","guid":{"rendered":"https:\/\/rhoischnooke.de\/?page_id=1423"},"modified":"2025-11-21T10:24:18","modified_gmt":"2025-11-21T09:24:18","slug":"game","status":"publish","type":"page","link":"https:\/\/rhoischnooke.de\/index.php\/game\/","title":{"rendered":"Game"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"1423\" class=\"elementor elementor-1423\" data-elementor-post-type=\"page\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-30057ec elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"30057ec\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-b624a7d\" data-id=\"b624a7d\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-f58699a\" data-id=\"f58699a\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-baaa853 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"baaa853\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-16 elementor-top-column elementor-element elementor-element-ab13a01\" data-id=\"ab13a01\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-16 elementor-top-column elementor-element elementor-element-ed9acad\" data-id=\"ed9acad\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-16 elementor-top-column elementor-element elementor-element-ec3cbb7\" data-id=\"ec3cbb7\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-16 elementor-top-column elementor-element elementor-element-9b55133\" data-id=\"9b55133\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-16 elementor-top-column elementor-element elementor-element-563aed3\" data-id=\"563aed3\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-82d408b elementor-widget__width-initial elementor-widget elementor-widget-html\" data-id=\"82d408b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"snakegame\" style=\"width:100%;display:flex;justify-content:center; background:#001f3f;\">\r\n  <canvas id=\"game\" width=\"400\" height=\"400\" style=\"border-radius:10px;box-shadow:0 0 20px rgba(0,0,0,0.5);\"><\/canvas>\r\n  <div style=\"display:flex;flex-direction:column;align-items:center;margin-top:8px;\">\r\n    <div class=\"score\" style=\"font-size:20px;color:#ffcc00;font-weight:700;\">Score: <span id=\"score\">0<\/span><\/div>\r\n    <div class=\"high\" style=\"font-size:14px;color:#8fb2ff;\">Highscore: <span id=\"high\">0<\/span><\/div>\r\n    <div style=\"margin-top:4px;\">\r\n      <button id=\"startBtn\" style=\"background:#ffcc00;border:none;color:#071021;padding:10px 16px;border-radius:10px;font-weight:700;font-size:16px;cursor:pointer;margin:2px;\">Start \/ Restart<\/button>\r\n      <button id=\"pauseBtn\" style=\"background:#ffcc00;border:none;color:#071021;padding:10px 16px;border-radius:10px;font-weight:700;font-size:16px;cursor:pointer;margin:2px;\">Pause<\/button>\r\n    <\/div>\r\n  <\/div>\r\n<\/div>\r\n<script>\r\nconst DEFAULT_LOGO='https:\/\/rhoischnooke.de\/wp-content\/uploads\/2025\/11\/Game_Schnook.png';\r\nconst DEFAULT_CANDY='https:\/\/rhoischnooke.de\/wp-content\/uploads\/2025\/11\/bonbon_Game.png';\r\nconst GRID=20,WIDTH=20,HEIGHT=20,TICK_MS=120,GROW_BY=1;\r\nconst canvas=document.getElementById('game');\r\nconst ctx=canvas.getContext('2d');\r\ncanvas.width=GRID*WIDTH;canvas.height=GRID*HEIGHT;\r\nconst scoreEl=document.getElementById('score');\r\nconst highEl=document.getElementById('high');\r\nconst startBtn=document.getElementById('startBtn');\r\nconst pauseBtn=document.getElementById('pauseBtn');\r\nlet logoImg=new Image(),candyImg=new Image();logoImg.src=DEFAULT_LOGO;candyImg.src=DEFAULT_CANDY;let logoLoaded=false,candyLoaded=false;logoImg.onload=()=>logoLoaded=true;candyImg.onload=()=>candyLoaded=true;\r\nconst eatSound=new Audio('https:\/\/actions.google.com\/sounds\/v1\/cartoon\/pop.ogg');\r\nconst gameOverSound=new Audio('https:\/\/actions.google.com\/sounds\/v1\/alarms\/beep_short.ogg');\r\nlet snake=[],dir={x:1,y:0},nextDir=null,food=null,score=0,high=0,running=false,paused=false,tickTimer=null;\r\nif(localStorage.snakeHigh){high=parseInt(localStorage.snakeHigh);}highEl.textContent=high;\r\nfunction resetGame(){snake=[];const sx=Math.floor(WIDTH\/2),sy=Math.floor(HEIGHT\/2);snake.push({x:sx,y:sy,type:'logo'});snake.push({x:sx-1,y:sy,type:'body'});snake.push({x:sx-2,y:sy,type:'body'});dir={x:1,y:0};nextDir=null;placeFood();score=0;updateScore();}\r\nfunction placeFood(){while(true){const x=Math.floor(Math.random()*WIDTH),y=Math.floor(Math.random()*HEIGHT);if(!snake.some(s=>s.x===x&&s.y===y)){food={x,y};return;}}}\r\nfunction updateScore(){scoreEl.textContent=score;}\r\nfunction step(){if(!running||paused)return;if(nextDir&&!(nextDir.x===-dir.x&&nextDir.y===-dir.y))dir=nextDir;nextDir=null;const h=snake[0];const nh={x:h.x+dir.x,y:h.y+dir.y,type:'logo'};if(nh.x<0)nh.x=WIDTH-1;if(nh.x>=WIDTH)nh.x=0;if(nh.y<0)nh.y=HEIGHT-1;if(nh.y>=HEIGHT)nh.y=0;if(snake.some((s,i)=>i>0&&s.x===nh.x&&s.y===nh.y)){stopGame();return;}snake.unshift(nh);if(food&&nh.x===food.x&&nh.y===food.y){score+=10;updateScore();eatSound.play();for(let i=0;i<GROW_BY;i++){const t=snake[snake.length-1];snake.push({x:t.x,y:t.y,type:'candy'});}placeFood();}else snake.pop();draw();}\r\nfunction draw(){ctx.clearRect(0,0,canvas.width,canvas.height);if(food){ctx.fillStyle='#66ff88';const fx=food.x*GRID+GRID*0.15,fy=food.y*GRID+GRID*0.15,fw=GRID*0.7,fh=GRID*0.7;ctx.beginPath();ctx.ellipse(fx+fw\/2,fy+fh\/2,fw\/2,fh\/2,0,0,Math.PI*2);ctx.fill();}for(let i=snake.length-1;i>=0;i--){const s=snake[i],x=s.x*GRID,y=s.y*GRID;if(s.type==='candy'){if(candyLoaded)ctx.drawImage(candyImg,x+2,y+2,GRID-4,GRID-4);else{ctx.fillStyle='#ff66b3';ctx.fillRect(x+2,y+2,GRID-4,GRID-4);}}else if(i===0){if(logoLoaded){ctx.save();ctx.translate(x+GRID\/2,y+GRID\/2);ctx.rotate(Math.atan2(dir.y,dir.x));const sz=GRID*1.1;ctx.drawImage(logoImg,-sz\/2,-sz\/2,sz,sz);ctx.restore();}else{ctx.fillStyle='#ffd166';ctx.fillRect(x+2,y+2,GRID-4,GRID-4);}}else{ctx.fillStyle='#89a7ff';ctx.fillRect(x+3,y+3,GRID-6,GRID-6);}}}\r\nfunction startGame(){resetGame();running=true;paused=false;if(tickTimer)clearInterval(tickTimer);tickTimer=setInterval(step,TICK_MS);draw();}\r\nfunction stopGame(){running=false;paused=false;clearInterval(tickTimer);gameOverSound.play();if(score>high){high=score;localStorage.snakeHigh=high;highEl.textContent=high;}ctx.fillStyle='rgba(0,0,0,0.6)';ctx.fillRect(0,0,canvas.width,canvas.height);ctx.fillStyle='#fff';ctx.textAlign='center';ctx.font='24px sans-serif';ctx.fillText('GAME OVER',canvas.width\/2,canvas.height\/2-10);ctx.fillText('Score: '+score,canvas.width\/2,canvas.height\/2+20);}\r\nstartBtn.onclick=()=>startGame();pauseBtn.onclick=()=>paused=!paused;document.addEventListener('keydown',e=>{if(['ArrowUp','w','W'].includes(e.key))nextDir={x:0,y:-1};if(['ArrowDown','s','S'].includes(e.key))nextDir={x:0,y:1};if(['ArrowLeft','a','A'].includes(e.key))nextDir={x:-1,y:0};if(['ArrowRight','d','D'].includes(e.key))nextDir={x:1,y:0};});\r\ndraw();\r\n<\/script>\r\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-16 elementor-top-column elementor-element elementor-element-62a25a9\" data-id=\"62a25a9\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Score: 0 Highscore: 0 Start \/ Restart Pause<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":16,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1423","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/rhoischnooke.de\/index.php\/wp-json\/wp\/v2\/pages\/1423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rhoischnooke.de\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/rhoischnooke.de\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/rhoischnooke.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rhoischnooke.de\/index.php\/wp-json\/wp\/v2\/comments?post=1423"}],"version-history":[{"count":10,"href":"https:\/\/rhoischnooke.de\/index.php\/wp-json\/wp\/v2\/pages\/1423\/revisions"}],"predecessor-version":[{"id":1443,"href":"https:\/\/rhoischnooke.de\/index.php\/wp-json\/wp\/v2\/pages\/1423\/revisions\/1443"}],"wp:attachment":[{"href":"https:\/\/rhoischnooke.de\/index.php\/wp-json\/wp\/v2\/media?parent=1423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}