bana uçan balon oyunu yap
- User
bana uçan balon oyunu yap
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
bana uçan balon oyunu yap
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
İşte sana basit bir uçan balon oyunu – HTML, CSS ve JavaScript ile yazılmış, tarayıcıda çalışan bir mini oyun. Balonu fare ile kontrol ederek engelleri aşmaya çalışıyorsun.
index.html<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Uçan Balon Oyunu</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>Uçan Balon Oyunu</h1>
<div id="gameArea">
<div id="balloon"></div>
<div id="score">Skor: 0</div>
</div>
<script src="script.js"></script>
</body>
</html>
style.cssbody {
margin: 0;
font-family: Arial, sans-serif;
background: #87ceeb;
text-align: center;
}
h1 {
margin-top: 10px;
}
#gameArea {
position: relative;
width: 400px;
height: 600px;
margin: 0 auto;
background: #e0f7ff;
overflow: hidden;
border: 2px solid #333;
}
#balloon {
position: absolute;
width: 50px;
height: 70px;
background: red;
border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
bottom: 50px;
left: 175px;
transition: transform 0.1s;
}
.obstacle {
position: absolute;
width: 60px;
background: #333;
top: 0;
}
#score {
position: absolute;
top: 10px;
left: 10px;
font-size: 20px;
color: #000;
}
script.jsconst gameArea = document.getElementById("gameArea");
const balloon = document.getElementById("balloon");
const scoreDisplay = document.getElementById("score");
let score = 0;
let gameOver = false;
// Balonu fare ile hareket ettir
gameArea.addEventListener("mousemove", (e) => {
if (gameOver) return;
const rect = gameArea.getBoundingClientRect();
const x = e.clientX - rect.left - balloon.offsetWidth / 2;
balloon.style.left = `${Math.max(0, Math.min(x, 350))}px`;
});
// Engel oluştur
function createObstacle() {
if (gameOver) return;
const obstacle = document.createElement("div");
obstacle.classList.add("obstacle");
const left = Math.random() * 340;
obstacle.style.left = `${left}px`;
obstacle.style.height = `${Math.random() * 100 + 50}px`;
gameArea.appendChild(obstacle);
let top = 0;
const move = setInterval(() => {
if (gameOver) {
clearInterval(move);
return;
}
top += 5;
obstacle.style.top = `${top}px`;
// Çarpışma kontrolü
const bRect = balloon.getBoundingClientRect();
const oRect = obstacle.getBoundingClientRect();
if (
bRect.left < oRect.right &&
bRect.right > oRect.left &&
bRect.top < oRect.bottom &&
bRect.bottom > oRect.top
) {
gameOver = true;
alert("Oyun bitti! Skor: " + score);
location.reload();
}
// Engel geçti
if (top > 600) {
obstacle.remove();
score++;
scoreDisplay.textContent = "Skor: " + score;
}
}, 30);
}
// Engel üretme döngüsü
setInterval(createObstacle, 1500);
index.html, style.css, script.jsindex.html'i bir tarayıcıda aç.İstersen ses efekti, zorluk seviyesi, mobil uyum gibi özellikler de ekleyebilirim.