Skip to content

Instantly share code, notes, and snippets.

@aligabr-cmd
Forked from isdaviddong/index.html
Last active September 12, 2025 00:06
Show Gist options
  • Select an option

  • Save aligabr-cmd/bf68aa77f58ca53cbf39f0a5cb7aa72e to your computer and use it in GitHub Desktop.

Select an option

Save aligabr-cmd/bf68aa77f58ca53cbf39f0a5cb7aa72e to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no" />
<title>مغامرات جاسم - نسخة مطورة</title>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0
}
body {
background: #5C94FC;
font-family: "Segoe UI", Tahoma, Arial, sans-serif;
color: #fff;
display: flex;
flex-direction: column;
align-items: center;
min-height: 100vh;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
h1 {
margin: 10px 0 8px;
text-shadow: 3px 3px 0 #000;
font-weight: 900;
}
.sub {
opacity: .9;
margin-bottom: 8px
}
.game-wrap {
position: relative;
width: 95
}
}
function drawHouse(x, groundY) {
ctx.fillStyle = '#8B4513';
ctx.fillRect(x, groundY - 110, 100, 110);
ctx.fillStyle = '#b33';
ctx.beginPath();
ctx.moveTo(x - 10, groundY - 110);
ctx.lineTo(x + 50, groundY - 150);
ctx.lineTo(x + 110, groundY - 110);
ctx.closePath()
;
ctx.fill();
ctx.fillStyle = '#2b1a0d';
ctx.fillRect(x + 36, groundY - 50, 28, 50);
ctx.fillStyle = '#eee';
ctx.fillRect(x + 16, groundY - 85, 18, 18);
ctx.fillRect(x + 66, groundY - 85, 18, 18);
}
function drawPlayer(x, y, w, h, facing, big) {
ctx.save();
if (facing < 0) {
ctx.scale(-1, 1);
x = -x - w;
}
// Hat
ctx.fillStyle = '#ff4136';
ctx.fillRect(x, y, w, 10);
// Face
ctx.fillStyle = '#f6c6a6';
ctx.fillRect(x + 4, y + 10, w - 8, 12);
// Eyes
ctx.fillStyle = '#000';
ctx.fillRect(x + w - 10, y + 12, 3, 3);
// Shirt & overalls
ctx.fillStyle = big ? '#d11' : '#ff4136';
ctx.fillRect(x + 2, y + 22, w - 4, 16);
ctx.fillStyle = '#0074d9';
ctx.fillRect(x + 2, y + 38, w - 4, h - 38);
ctx.restore();
}
// حلقة اللعبة
function update() {
if (state.gameOver || state.win) return;
updatePlayer();
updateCoins();
updatePowerups();
updateEnemies();
updateBullets();
updateCheckpoints();
checkPipes();
checkFlag();
}
function loop() { update(); draw(); requestAnimationFrame(loop); }
// ابدأ
startGame();
loop();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment