امتحان بزرگ
by UltraTiger8198 lines2.7 KB
<!doctype html>
<html lang="fa" dir="rtl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>امتحان بزرگ</title>
<style>
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
background: #e8f4ff;
color: #203047;
font-family: Tahoma, Arial, sans-serif;
}
main {
width: min(700px, 95vw);
padding: 20px;
text-align: center;
background: white;
border-radius: 18px;
box-shadow: 0 10px 30px #2342;
}
h1 { margin: 4px 0 10px; }
#status { min-height: 28px; color: #40536a; }
canvas {
display: block;
width: 100%;
max-width: 640px;
margin: 12px auto;
background: #dff3ff;
border: 3px solid #b7d2e8;
border-radius: 12px;
}
button {
padding: 10px 20px;
border: 0;
border-radius: 10px;
background: #3478db;
color: white;
font: inherit;
cursor: pointer;
}
button:hover { background: #245eaf; }
.help { font-size: 14px; line-height: 1.8; }
</style>
</head>
<body>
<main>
<h1>امتحان بزرگ</h1>
<div id="status">برای شروع، دکمه را بزن.</div>
<canvas id="game" width="640" height="360"></canvas>
<button id="start">شروع بازی</button>
<p class="help">
با کلیدهای ← و → علی را حرکت بده. وقتی معلم حواسش نیست، با → به برگهٔ فرید نگاه کن؛
وقتی معلم نگاه میکند، با ← برگرد و وانمود کن داری امتحان میدهی!
</p>
</main>
<script>
const canvas = document.querySelector("#game");
const ctx = canvas.getContext("2d");
const statusText = document.querySelector("#status");
const startButton = document.querySelector("#start");
let playing = false;
let caught = false;
let looking = false;
let cheating = false;
let score = 0;
let suspicion = 0;
let timeLeft = 30;
let timerId;
let lookId;
function drawDesk(x, name, isAli = false) {
ctx.fillStyle = "#b8794b";
ctx.fillRect(x, 230, 92, 12);
ctx.fillRect(x + 10, 242, 8, 42);
ctx.fillRect(x + 74, 242, 8, 42);
ctx.fillStyle = "#fffdf2";
ctx.fillRect(x + 25, 207, 42, 25);
ctx.strokeStyle = "#8b7555";
ctx.strokeRect(x + 25, 207, 42, 25);
ctx.fillStyle = isAli ? "#3576cb" : "#49856a";
ctx.beginPath();
ctx.arc(x + 46, 177, 18, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = "#26374b";
ctx.font = "14px Tahoma";
ctx.textAlign = "center";
ctx.fillText(name
Game Source: امتحان بزرگ
Creator: UltraTiger81
Libraries: none
Complexity: moderate (98 lines, 2.7 KB)
The full source code is displayed above on this page.
Remix Instructions
To remix this game, copy the source code above and modify it. Add a ARCADELAB header at the top with "remix_of: game-ultratiger81" to link back to the original. Then publish at arcadelab.ai/publish.