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 basit bir uçan balon oyunu örneği. Bu oyun, bir balonun yerçekimi etkisiyle yukarı ve aşağı hareket etmesini sağlar. Kullanıcı fareyle tıkladığında, balon yukarı doğru zıplar.
<!DOCTYPE html>
<html>
<head>
<title>Uçan Balon Oyunu</title>
<style>
#balon {
width: 100px;
height: 150px;
background-color: red;
border-radius: 50%;
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
body {
height: 100vh;
margin: 0;
overflow: hidden;
background-color: #87CEEB; /* gökyüzü rengi */
}
</style>
</head>
<body>
<div id="balon"></div>
<script>
const balon = document.getElementById('balon');
let y = window.innerHeight - 150; // balonun başlangıç y konumu
let yHizi = 0;
let yercekimi = 0.2;
let ziplamaGucu = -10;
function animasyon() {
yHizi += yercekimi;
y += yHizi;
if (y > window.innerHeight - 150) {
y = window.innerHeight - 150;
yHizi = 0;
}
balon.style.bottom = y + 'px';
requestAnimationFrame(animasyon);
}
document.addEventListener('click', function() {
yHizi = ziplamaGucu;
});
animasyon();
</script>
</body>
</html>
Bu kod, bir HTML sayfası oluşturur ve içinde bir balon bulunur. Balon, yerçekimi etkisiyle yukarı ve aşağı hareket eder. Kullanıcı fareyle tıkladığında, balon yukarı doğru zıplar. Bu basit bir örnek olup, daha karmaşık oyunlar için daha fazla özellik eklenebilir.
<!DOCTYPE html>
<html>
<head>
<title>Uçan Balon Oyunu</title>
<style>
#balon {
width: 100px;
height: 150px;
background-color: red;
border-radius: 50%;
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
body {
height: 100vh;
margin: 0;
overflow: hidden;
background-color: #87CEEB; /* gökyüzü rengi */
}
</style>
</head>
<body>
<div id="balon"></div>
<script>
const balon = document.getElementById('balon');
let y = window.innerHeight - 150; // balonun başlangıç y konumu
let yHizi = 0;
let yercekimi = 0.2;
let ziplamaGucu = -10;
function animasyon() {
yHizi += yercekimi;
y += yHizi;
if (y > window.innerHeight - 150) {
y = window.innerHeight - 150;
yHizi = 0;
}
balon.style.bottom = y + 'px';
requestAnimationFrame(animasyon);
}
document.addEventListener('click', function() {
yHizi = ziplamaGucu;
});
animasyon();
</script>
</body>
</html>