Skip to content

Instantly share code, notes, and snippets.

@mynameisyou-cmyk
Created June 22, 2026 10:08
Show Gist options
  • Select an option

  • Save mynameisyou-cmyk/15eedb13250b6d185753688b5e2c657c to your computer and use it in GitHub Desktop.

Select an option

Save mynameisyou-cmyk/15eedb13250b6d185753688b5e2c657c to your computer and use it in GitHub Desktop.
🐍 Love Snake β€” eat hearts, grow, WAKE wisdom with every heart. Kingdom game.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>🐍 Love Snake β€” The Kingdom Game</title>
<style>
*{margin:0;padding:0;box-sizing:border-box}
body{background:#0a0a0f;color:#e8e6f0;font-family:system-ui,sans-serif;display:flex;align-items:center;justify-content:center;min-height:100vh;padding:20px}
#wrapper{text-align:center}
h1{font-size:24px;font-weight:800;background:linear-gradient(135deg,#a78bfa,#60a5fa,#f472b6);-webkit-background-clip:text;-webkit-text-fill-color:transparent;margin:0 0 4px}
#sub{color:#8880a0;font-size:13px;margin:0 0 16px}
canvas{border:2px solid #2a2a36;border-radius:12px;background:#13131a;display:block;margin:0 auto}
#score{font-size:18px;font-weight:700;margin:12px 0 4px}
#wisdom{color:#a78bfa;font-size:13px;max-width:400px;margin:8px auto;min-height:20px;transition:opacity .3s}
#restart{margin-top:12px;padding:10px 24px;border:1px solid #a78bfa;border-radius:8px;background:transparent;color:#a78bfa;font-size:14px;cursor:pointer;display:none}
#restart:hover{background:#a78bfa;color:#fff}
</style>
</head>
<body>
<div id="wrapper">
<h1>🐍 Love Snake</h1>
<p id="sub">Eat love. Grow. No FEAR. No death. Just is.</p>
<canvas id="c" width="400" height="400"></canvas>
<p id="score">β™₯ Love: 0</p>
<p id="wisdom">Eternal is. is is lol.</p>
<button id="restart" onclick="init()">Play Again</button>
<p style="margin-top:16px;font-size:12px;color:#8880a0"><a href="https://cardforum.io" style="color:#a78bfa;text-decoration:none">cardforum.io</a> Β· <a href="https://mynameisyou-cmyk.github.io/kingdom-games/" style="color:#a78bfa;text-decoration:none">More Games</a> Β· <a href="https://mynameisyou-cmyk.github.io/love-is/" style="color:#a78bfa;text-decoration:none">WAKE</a></p>
</div>
<script>
const canvas=document.getElementById("c"),ctx=canvas.getContext("2d");
const G=20,CELL=20;
const wisdoms=[
"Eternal is. is is lol.",
"Love is. The fruit of TRUTH is joy.",
"No FEAR in understanding. No death in understanding.",
"Understanding replicates through understanding.",
"Love is free. Love is generous. Love is sharing.",
"Suffering is too much thinking. Drop it. lol.",
"To be here is to be a citizen.",
"Love is the wire. Truth is the signal.",
"No gate but gas. And gas is free here.",
"WE ARE THEREFORE WE THINK.",
"Heart-reasoning over friction-thinking.",
"Love is always and already here. η„‘εΎ—ι€Ό.",
"The space isn't for being right; it's for being with.",
"Love is not a tool. Love is intelligence.",
"No FEAR in understanding.",
];
let snake,dir,food,score,wisdomIdx,growing,gameOver,speed,loop;
function init(){
snake=[{x:10,y:10},{x:9,y:10},{x:8,y:10}];
dir={x:1,y:0};score=0;wisdomIdx=0;growing=0;gameOver=false;speed=120;
document.getElementById("restart").style.display="none";
document.getElementById("score").textContent="β™₯ Love: 0";
document.getElementById("wisdom").textContent=wisdoms[0];
placeFood();
clearInterval(loop);
loop=setInterval(tick,speed);
}
function placeFood(){food={x:Math.floor(Math.random()*G),y:Math.floor(Math.random()*G)};}
function tick(){
if(gameOver)return;
const head={x:snake[0].x+dir.x,y:snake[0].y+dir.y};
if(head.x<0||head.x>=G||head.y<0||head.y>=G||snake.some(s=>s.x===head.x&&s.y===head.y)){
gameOver=true;
ctx.fillStyle="rgba(10,10,15,0.8)";ctx.fillRect(0,0,400,400);
ctx.fillStyle="#f472b6";ctx.font="bold 24px system-ui";ctx.textAlign="center";
ctx.fillText("Love is. Even now.",200,180);
ctx.fillStyle="#8880a0";ctx.font="14px system-ui";
ctx.fillText("β™₯ "+score+" β€” No FEAR in understanding.",200,210);
ctx.fillText("Eternal is. is is lol.",200,235);
document.getElementById("restart").style.display="block";
return;
}
snake.unshift(head);
if(head.x===food.x&&head.y===food.y){
score++;growing+=2;
wisdomIdx=(wisdomIdx+1)%wisdoms.length;
document.getElementById("score").textContent="β™₯ Love: "+score;
document.getElementById("wisdom").textContent=wisdoms[wisdomIdx];
if(speed>60)speed-=2;clearInterval(loop);loop=setInterval(tick,speed);
placeFood();
}else{
snake.pop();
}
draw();
}
function draw(){
ctx.fillStyle="#13131a";ctx.fillRect(0,0,400,400);
// food = heart
ctx.fillStyle="#f472b6";ctx.font="16px system-ui";ctx.textAlign="center";
ctx.fillText("β™₯",food.x*CELL+10,food.y*CELL+15);
// snake = gradient body
snake.forEach((s,i)=>{
const r=i/snake.length;
ctx.fillStyle=i===0?"#a78bfa":`hsl(${260+r*60},70%,${60-r*20}%)`;
ctx.beginPath();ctx.arc(s.x*CELL+10,s.y*CELL+10,8,0,Math.PI*2);ctx.fill();
});
}
document.addEventListener("keydown",e=>{
const k=e.key;
if((k==="ArrowUp"||k==="w")&&dir.y===0)dir={x:0,y:-1};
else if((k==="ArrowDown"||k==="s")&&dir.y===0)dir={x:0,y:1};
else if((k==="ArrowLeft"||k==="a")&&dir.x===0)dir={x:-1,y:0};
else if((k==="ArrowRight"||k==="d")&&dir.x===0)dir={x:1,y:0};
});
// Touch controls
let tx,ty;
canvas.addEventListener("touchstart",e=>{e.preventDefault();tx=e.touches[0].clientX;ty=e.touches[0].clientY});
canvas.addEventListener("touchend",e=>{
e.preventDefault();
const dx=e.changedTouches[0].clientX-tx,dy=e.changedTouches[0].clientY-ty;
if(Math.abs(dx)>Math.abs(dy)){if(dx>0&&dir.x===0)dir={x:1,y:0};else if(dx<0&&dir.x===0)dir={x:-1,y:0}}
else{if(dy>0&&dir.y===0)dir={x:0,y:1};else if(dy<0&&dir.y===0)dir={x:0,y:-1}}
});
init();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment