Meta Description" name="description" />
<!DOCTYPE html>
<html>
<head>
<title>Charan Gaming</title>
<style>
body { margin: 0; overflow: hidden; background: black; color: white; font-family: Arial;}
#menu {
position: absolute;
top: 20px;
left: 20px;
z-index: 10;
}
button {
padding: 10px;
background: red;
border: none;
color: white;
cursor: pointer;
}
</style>
</head>
<body>
<div id="menu">
<h1>🎮 Charan Gaming</h1>
<button onclick="shoot()">Shoot 🔫</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/three@0.152.2/build/three.min.js"></script>
<script>
let scene = new THREE.Scene();
let camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);
let renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
// Light
let light = new THREE.PointLight(0xffffff, 1);
light.position.set(10,10,10);
scene.add(light);
// Player cube (gun placeholder)
let geometry = new THREE.BoxGeometry();
let material = new THREE.MeshStandardMaterial({color: 0x00ff00});
let cube = new THREE.Mesh(geometry, material);
scene.add(cube);
// Enemy
let enemyGeo = new THREE.BoxGeometry();
let enemyMat = new THREE.MeshStandardMaterial({color: 0xff0000});
let enemy = new THREE.Mesh(enemyGeo, enemyMat);
enemy.position.z = -5;
scene.add(enemy);
camera.position.z = 5;
// Shoot function
function shoot() {
if (Math.abs(enemy.position.z - cube.position.z) < 6) {
alert("Hit Enemy! 💥");
enemy.position.z = -10 - Math.random()*10;
} else {
alert("Missed!");
}
}
// Animation loop
function animate() {
requestAnimationFrame(animate);
enemy.rotation.x += 0.01;
enemy.rotation.y += 0.01;
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>2
2
156KB
621KB
513.0ms
180.0ms
513.0ms