LONIPIG KING 👑
JUMP
const cv=document.getElementById('c'),ctx=cv.getContext('2d'); cv.width=window.innerWidth; cv.height=window.innerHeight; let x=100,y=300,vy=0,mx=0,score=0; let items=[300,600,900,1200]; const joy=document.getElementById('joy'),stick=document.getElementById('stick'); let act=false,cx=0,cy=0; joy.addEventListener('touchstart',function(e){act=true;var r=joy.getBoundingClientRect();cx=r.left+55;cy=r.top+55;}); joy.addEventListener('touchmove',function(e){if(!act)return;var dx=e.touches[0].clientX-cx,dy=e.touches[0].clientY-cy;var d=Math.sqrt(dx*dx+dy*dy);if(d>40){dx=dx/d*40;dy=dy/d*40;}stick.style.transform='translate('+dx+'px,'+dy+'px)';mx=dx/40;}); joy.addEventListener('touchend',function(){act=false;stick.style.transform='translate(0,0)';mx=0;}); document.getElementById('jump').addEventListener('touchstart',function(){if(y>=350)vy=-16;}); function loop(){ x+=mx*7; vy+=0.9; y+=vy; if(y>400){y=400;vy=0;} ctx.fillStyle='#87CEEB'; ctx.fillRect(0,0,cv.width,cv.height); ctx.fillStyle='#3a9d23'; ctx.fillRect(0,450,cv.width,cv.height); // Lapis ctx.fillStyle='blue'; for(var i=0;i380){items.splice(i,1); score++; document.getElementById('hud').innerHTML='Lapis: '+score+' KING';} } // Spieler ctx.fillStyle='gold'; ctx.fillRect(x,y,40,40); ctx.fillStyle='black'; ctx.fillRect(x+8,y+8,6,6); ctx.fillRect(x+24,y+8,6,6); requestAnimationFrame(loop); } LONIPIG KING
LONIPIG KING 👑 TIP: Wischen= Laufen, Tippen= Springen
loop();