Meta Description" name="description" />
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Mobil Minecraft + Zıplama</title>
<style>
body { margin: 0; overflow: hidden; touch-action: none; background: #000; }
canvas { display: block; }
#ui {
position: absolute; top: 10px; width: 100%;
color: white; font-family: sans-serif; text-align: center; pointer-events: none;
text-shadow: 1px 1px 2px black;
}
</style>
</head>
<body>
<div id="ui">ÜST: Zıpla | SOL: İleri | SAĞ: Dön</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script>
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x87CEEB);
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
// Işıklandırma
scene.add(new THREE.AmbientLight(0x404040));
const light = new THREE.DirectionalLight(0xffffff, 1);
light.position.set(5, 10, 7.5);
scene.add(light);
// Zemin
const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshLambertMaterial({ color: 0x33aa33 });
for(let x = -10; x < 10; x++) {
for(let z = -10; z < 10; z++) {
const cube = new THREE.Mesh(geometry, material);
cube.position.set(x, 0, z);
scene.add(cube);
}
}
camera.position.y = 2; // Göz hizası
// Fizik Değişkenleri
let velocityY = 0;
let isJumping = false;
const gravity = -0.01;
const jumpStrength = 0.2;
// Kontrol Değişkenleri
let moveForward = false;
let rotateRight = false;
window.addEventListener('touchstart', (e) => {
const touchX = e.touches[0].clientX;
const touchY = e.touches[0].clientY;
if(touchY < window.innerHeight * 0.3) { // Ekranın üst %30'u zıplatır
if(!isJumping) {
velocityY = jumpStrength;
isJumping = true;
}
} else if(touchX < window.innerWidth / 2) {
moveForward = true;
} else {
rotateRight = true;
}
});
window.addEventListener('touchend', () => {
moveForward = false;
rotateRight = false;
});
function animate() {
requestAnimationFrame(animate);
// Hareket ve Dönüş
if(moveForward) camera.translateZ(-0.1);
if(rotateRight) camera.rotation.y -= 0.05;
// Zıplama ve Yerçekimi Fiziği
velocityY += gravity;
camera.position.y += velocityY;
if(camera.position.y < 2) { // Yere çarpma kontrolü
camera.position.y = 2;
velocityY = 0;
isJumping = false;
}
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
2
2
122KB
593KB
1,097.0ms
104.0ms
1,097.0ms