猜猜我用的是哪个大模型?我的世界游戏界面简单的模拟效果

我的罗里吧嗦的,根据小朋友的要求,边听边写边输入的提示词:

请生成一段完整的在网页中用html5和javascript代码模拟“我的世界”中游戏场景的互动画面,要求提供若干人物选项可以选择,请自行选择需要使用哪些库或框架来实现该功能,但希望能够保存之后,用浏览器打开就能够使用。希望能够实现若干个人物的选择,其中可供选择的人物要具有动作演示的效果,请自己选一些实现动画效果的JavaScript库,可以直接在线使用,无须其它依赖和安装,此功能可以支持两个人同时操作。请提供完整的可以直接在浏览器中打开就能够简单实现的代码

结果打开之后是这样的,真能操控:

在这里插入图片描述
代码也是毫不吝啬,一口气输出这么多:

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Minecraft-Style 3D Game</title><link href="https://fastly.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"><link href="https://fastly.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.0.0/css/all.min.css" rel="stylesheet"><style>body {margin: 0;overflow: hidden;font-family: 'Minecraft', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;background-color: #333;}@font-face {font-family: 'Minecraft';src: url('https://fastly.jsdelivr.net/npm/minecraft-font@1.0.0/assets/fonts/minecraft.woff2') format('woff2');font-weight: normal;font-style: normal;}#game-container {position: relative;width: 100vw;height: 100vh;}#render-canvas {position: absolute;top: 0;left: 0;width: 100%;height: 100%;}.interface {position: absolute;z-index: 10;color: white;text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);}.character-selection {top: 20px;left: 50%;transform: translateX(-50%);background-color: rgba(0, 0, 0, 0.6);border: 2px solid #555;padding: 15px;border-radius: 8px;width: 90%;max-width: 800px;}.controls {bottom: 20px;background-color: rgba(0, 0, 0, 0.6);border: 2px solid #555;padding: 10px;border-radius: 8px;width: 250px;}#player1-controls {left: 20px;}#player2-controls {right: 20px;}.status-bar {bottom: 20px;left: 50%;transform: translateX(-50%);background-color: rgba(0, 0, 0, 0.6);border: 2px solid #555;padding: 10px;border-radius: 8px;width: 90%;max-width: 500px;text-align: center;}.character-option {display: inline-block;margin: 5px;cursor: pointer;transition: all 0.3s;vertical-align: top;text-align: center;}.character-option img {width: 60px;height: 120px;object-fit: cover;border: 3px solid transparent;border-radius: 4px;filter: brightness(0.7);transition: all 0.3s;}.character-option:hover img {border-color: #aaa;filter: brightness(1);}.character-option.selected img {border-color: #5cf;filter: brightness(1);}.key {display: inline-block;background-color: rgba(255, 255, 255, 0.2);border: 1px solid rgba(255, 255, 255, 0.4);padding: 5px 8px;margin: 2px;border-radius: 4px;font-weight: bold;}.loading-screen {position: absolute;top: 0;left: 0;width: 100%;height: 100%;background-color: #333;display: flex;flex-direction: column;justify-content: center;align-items: center;z-index: 100;color: white;font-size: 24px;}.progress-bar {width: 300px;height: 20px;background-color: #222;border: 2px solid #555;margin-top: 20px;border-radius: 10px;overflow: hidden;}.progress {height: 100%;background-color: #5cf;width: 0%;transition: width 0.3s;}.dirt-block {display: inline-block;width: 30px;height: 30px;background-image: url('https://images.unsplash.com/photo-1607513746994-51f730a44832?q=80&w=30&auto=format&fit=crop');background-size: cover;margin: 0 5px;border-radius: 2px;vertical-align: middle;}@media (max-width: 768px) {.character-selection {padding: 10px;}.character-option img {width: 40px;height: 80px;}.controls {width: 150px;font-size: 12px;}.status-bar {font-size: 12px;}}</style>
</head>
<body><!-- Loading Screen --><div id="f2305d93-bcef-4e15-b7ce-a63c8d491b52" class="loading-screen"><div id="d40cd4d8-4c0e-48e4-a4d0-05bbfd6fa7db" class="dirt-block"></div><span id="916207e2-1aa4-49bc-b83c-c3eece7a44c2">Loading Minecraft-Style Game...</span><div id="b83699d9-78e5-4708-b801-716a85eef33f" class="progress-bar"><div id="39d52c16-9215-4ebf-a6a0-25c67b5a8de1" class="progress"></div></div></div><!-- Game Container --><div id="a24df7c4-8bb6-4ac3-9e3b-91aa2a63136f" class="game-container"><!-- Canvas for Three.js rendering --><canvas id="render-canvas"></canvas><!-- Character Selection UI --><div id="6c1abfc1-2331-40ab-a1e5-5eeb687d8092" class="interface character-selection"><div id="cf8ae90c-cf05-40b4-af8a-faf0b60c47cb" class="grid grid-cols-2 md:grid-cols-4 gap-2"><div id="b05e2f3c-5dbe-444f-9fa0-0e9a1e637919" class="text-center col-span-2 md:col-span-4 mb-2"><h2 id="c815cc5e-5ff2-46f5-9342-c4118cb0ecd7" class="text-xl font-bold">Select Characters</h2><div id="8268f04e-2325-4c9e-aa64-44bb6acb32c0" class="mt-1"><span id="1cff1ae5-0e54-4f3f-bf0b-ab87bce5408f" class="text-blue-300">Player 1:</span> <span id="player1-character">Steve</span> | <span id="5f21f725-c5c0-4034-bb01-a7f56da3f128" class="text-green-300">Player 2:</span> <span id="player2-character">Alex</span></div></div><div id="character-options"></div></div></div><!-- Player 1 Controls --><div id="player1-controls" class="interface controls"><h3 id="0376da1d-f2a0-4b95-907e-936476a841a1" class="text-blue-300 font-bold">Player 1 Controls:</h3><div id="d2bc2fb3-0502-4f5d-86b3-0f2a5f028a3a"><div id="a0294bc3-bcc8-4f28-b001-e9fc0ea2f56a" class="mb-1"><span id="cd96b41c-00d3-4309-b805-f2befdda40c9" class="key">W</span> Forward</div><div id="369be69d-d537-4bc3-a11e-2411ca8ee159" class="mb-1"><span id="9ae1c1c2-6f71-4575-8dd1-dc0fccd922e3" class="key">A</span><span id="d7053019-0309-433e-be51-603a9a10cb23" class="key">S</span><span id="1f78a456-bc7e-4bb2-9c52-7efc4c2c65c4" class="key">D</span> Move</div><div id="27312d5e-377e-4469-9802-7c3b846846f3" class="mb-1"><span id="0c01c5d2-b55a-4e2c-b21b-bdd32152b755" class="key">Space</span> Jump</div><div id="15cfdb30-6696-4cfd-b61c-6ac80e730ebe"><span id="6a42c7fc-dc00-442c-9478-8c5d295bd8b5" class="key">E</span> Action</div></div></div><!-- Player 2 Controls --><div id="player2-controls" class="interface controls"><h3 id="140c646d-11b9-4ea8-82ad-bf915bd8b8f0" class="text-green-300 font-bold">Player 2 Controls:</h3><div id="9dba0abc-4a53-4299-92b3-2c6319cfe33d"><div id="0c620c17-2910-430a-b0c5-428c2e86fbc8" class="mb-1"><span id="80c340f8-c8d9-41d0-9e71-0d14ea07e90e" class="key"></span> Forward</div><div id="007bccc6-d4fb-4658-98cf-6b5c88d491be" class="mb-1"><span id="086ae8b2-c512-4ad3-8a35-4d60e8a441ae" class="key"></span><span id="e4222974-a876-490d-aa4b-c2f4188ac164" class="key"></span><span id="0a94ad7f-9ef5-440e-a144-a875a790ffb0" class="key"></span> Move</div><div id="fb07362d-4363-40d3-b520-3b56722fbea1" class="mb-1"><span id="9a900166-a068-4c4c-b1a6-59bcc0304d38" class="key">Enter</span> Jump</div><div id="bac976e5-fa44-462a-902e-bf729516482e"><span id="d6c0bf9a-6007-4f5f-a530-a9b64c6f6c11" class="key">/</span> Action</div></div></div><!-- Status Bar --><div id="de6f85ed-466b-4bd7-9e51-5b778908622d" class="interface status-bar"><div id="game-status">Use WASD+Space and Arrow+Enter to move around and explore the world!</div></div></div><!-- Scripts --><script src="https://fastly.jsdelivr.net/npm/three@0.142.0/build/three.min.js"></script><script src="https://fastly.jsdelivr.net/npm/three@0.142.0/examples/js/controls/OrbitControls.js"></script><script src="https://fastly.jsdelivr.net/npm/@tweenjs/tween.js@18.6.4/dist/tween.umd.js"></script><script>// Main game classclass MinecraftStyleGame {constructor() {// Core propertiesthis.scene = null;this.camera = null;this.renderer = null;this.clock = new THREE.Clock();// Game statethis.players = [{ id: 1, character: 'Steve', model: null, position: new THREE.Vector3(0, 1, 0), velocity: new THREE.Vector3(), isJumping: false, onGround: true },{ id: 2, character: 'Alex', model: null, position: new THREE.Vector3(3, 1, 0), velocity: new THREE.Vector3(), isJumping: false, onGround: true }];this.keys = {player1: {forward: false,backward: false,left: false,right: false,jump: false,action: false},player2: {forward: false,backward: false,left: false,right: false,jump: false,action: false}};// Game world parametersthis.worldSize = 20;this.blockSize = 1;this.gravity = 0.02;this.jumpForce = 0.2;this.moveSpeed = 0.1;// Character optionsthis.characterOptions = [{ name: 'Steve', texture: 'https://minecraft-heads.com/media/com_minecraft/skins/original/steve.png', playerID: 1 },{ name: 'Alex', texture: 'https://minecraft-heads.com/media/com_minecraft/skins/original/alex.png', playerID: 2 },{ name: 'Zombie', texture: 'https://minecraft-heads.com/media/com_minecraft/skins/original/zombie.png', playerID: null },{ name: 'Skeleton', texture: 'https://minecraft-heads.com/media/com_minecraft/skins/original/skeleton.png', playerID: null },{ name: 'Creeper', texture: 'https://minecraft-heads.com/media/com_minecraft/skins/original/creeper.png', playerID: null },{ name: 'Enderman', texture: 'https://minecraft-heads.com/media/com_minecraft/skins/original/enderman.png', playerID: null },{ name: 'Villager', texture: 'https://minecraft-heads.com/media/com_minecraft/skins/original/villager.png', playerID: null },{ name: 'Pig', texture: 'https://minecraft-heads.com/media/com_minecraft/skins/original/pig.png', playerID: null }];// Resources to loadthis.textures = {dirt: new THREE.TextureLoader().load('https://images.unsplash.com/photo-1607513746994-51f730a44832?q=80&w=200&auto=format&fit=crop'),grass: new THREE.TextureLoader().load('https://images.unsplash.com/photo-1626269555171-153a1bca85f7?q=80&w=200&auto=format&fit=crop'),stone: new THREE.TextureLoader().load('https://images.unsplash.com/photo-1588371758051-e93a5ce1b5f4?q=80&w=200&auto=format&fit=crop'),wood: new THREE.TextureLoader().load('https://images.unsplash.com/photo-1599751449128-eb7249c3d6b1?q=80&w=200&auto=format&fit=crop'),leaves: new THREE.TextureLoader().load('https://images.unsplash.com/photo-1570822153940-2b3b795f54cf?q=80&w=200&auto=format&fit=crop')};// Loading progressthis.resourcesLoaded = 0;this.totalResources = Object.keys(this.textures).length + this.characterOptions.length;// Initialize the gamethis.init();}init() {// Initialize Three.js scenethis.initScene();// Handle loadingthis.loadResources();// UI setupthis.setupCharacterSelection();// Setup event listenersthis.setupEventListeners();// Start animation loopthis.animate();}initScene() {// Create scenethis.scene = new THREE.Scene();this.scene.background = new THREE.Color(0x87CEEB); // Sky blue// Create camerathis.camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);this.camera.position.set(10, 10, 10);this.camera.lookAt(0, 0, 0);// Create rendererthis.renderer = new THREE.WebGLRenderer({ canvas: document.getElementById('render-canvas'),antialias: true });this.renderer.setSize(window.innerWidth, window.innerHeight);this.renderer.shadowMap.enabled = true;// Add lightconst ambientLight = new THREE.AmbientLight(0xffffff, 0.6);this.scene.add(ambientLight);const directionalLight = new THREE.DirectionalLight(0xffffff, 0.8);directionalLight.position.set(10, 20, 10);directionalLight.castShadow = true;directionalLight.shadow.mapSize.width = 2048;directionalLight.shadow.mapSize.height = 2048;this.scene.add(directionalLight);// Add controls for debugging// this.controls = new THREE.OrbitControls(this.camera, this.renderer.domElement);}loadResources() {// Track texture loadingconst loadingManager = new THREE.LoadingManager();loadingManager.onProgress = (url, itemsLoaded, itemsTotal) => {this.resourcesLoaded++;this.updateLoadingProgress();};loadingManager.onLoad = () => {// All textures are loadedthis.createWorld();setTimeout(() => {document.getElementById('f2305d93-bcef-4e15-b7ce-a63c8d491b52').style.display = 'none';}, 500);};// Create texture loader with the loading managerconst textureLoader = new THREE.TextureLoader(loadingManager);// Load all texturesObject.keys(this.textures).forEach(key => {const url = this.textures[key].source?.data?.src;if (url) {this.textures[key] = textureLoader.load(url);this.textures[key].wrapS = THREE.RepeatWrapping;this.textures[key].wrapT = THREE.RepeatWrapping;}});// Load character texturesthis.characterOptions.forEach(char => {textureLoader.load(char.texture, () => {this.resourcesLoaded++;this.updateLoadingProgress();});});}updateLoadingProgress() {const progress = Math.min((this.resourcesLoaded / this.totalResources) * 100, 100);document.getElementById('39d52c16-9215-4ebf-a6a0-25c67b5a8de1').style.width = `${progress}%`;}createWorld() {// Create groundthis.createTerrain();// Create various structuresthis.createStructures();// Create player charactersthis.createPlayerCharacters();}createTerrain() {// Create base terrainconst groundGeometry = new THREE.BoxGeometry(this.worldSize, 1, this.worldSize);const groundMaterial = new THREE.MeshStandardMaterial({ map: this.textures.grass });const ground = new THREE.Mesh(groundGeometry, groundMaterial);ground.position.y = -0.5;ground.receiveShadow = true;this.scene.add(ground);// Create random terrain variationsfor (let x = -this.worldSize/2; x < this.worldSize/2; x += this.blockSize) {for (let z = -this.worldSize/2; z < this.worldSize/2; z += this.blockSize) {// Skip the center area for player spawnif (Math.abs(x) < 4 && Math.abs(z) < 4) continue;if (Math.random() < 0.1) {const height = Math.floor(Math.random() * 3) + 1;for (let y = 0; y < height; y++) {const material = y === height - 1 ? new THREE.MeshStandardMaterial({ map: this.textures.grass }) : new THREE.MeshStandardMaterial({ map: this.textures.dirt });this.createBlock(x, y, z, material);}}// Create treesif (Math.random() < 0.02) {this.createTree(x, 0, z);}}}}createBlock(x, y, z, material) {const geometry = new THREE.BoxGeometry(this.blockSize, this.blockSize, this.blockSize);const block = new THREE.Mesh(geometry, material);block.position.set(x, y, z);block.castShadow = true;block.receiveShadow = true;this.scene.add(block);return block;}createTree(x, y, z) {// Tree trunkconst trunkHeight = 4 + Math.floor(Math.random() * 3);const woodMaterial = new THREE.MeshStandardMaterial({ map: this.textures.wood });for (let i = 0; i < trunkHeight; i++) {this.createBlock(x, y + i, z, woodMaterial);}// Tree leavesconst leavesMaterial = new THREE.MeshStandardMaterial({ map: this.textures.leaves,transparent: true,alphaTest: 0.8});const leavesSize = 3;for (let lx = -leavesSize; lx <= leavesSize; lx++) {for (let ly = 0; ly <= leavesSize + 1; ly++) {for (let lz = -leavesSize; lz <= leavesSize; lz++) {// Create spherical-ish shape for leavesif (lx*lx + (ly-1)*(ly-1) + lz*lz <= leavesSize*leavesSize) {// Don't place leaves where trunk isif (!(lx === 0 && lz === 0 && ly < leavesSize)) {this.createBlock(x + lx, y + trunkHeight - 1 + ly, z + lz, leavesMaterial);}}}}}}createStructures() {// Create a small houseconst housePosX = 8;const housePosZ = 8;const houseSizeX = 5;const houseSizeZ = 4;const wallHeight = 3;const stoneMaterial = new THREE.MeshStandardMaterial({ map: this.textures.stone });const woodMaterial = new THREE.MeshStandardMaterial({ map: this.textures.wood });// Floorfor (let x = 0; x < houseSizeX; x++) {for (let z = 0; z < houseSizeZ; z++) {this.createBlock(housePosX + x, 0, housePosZ + z, stoneMaterial);}}// Wallsfor (let x = 0; x < houseSizeX; x++) {for (let y = 1; y <= wallHeight; y++) {// Front and back wallsif (!(x === 2 && y < 3)) { // Door in front wallthis.createBlock(housePosX + x, y, housePosZ, woodMaterial); // Front wall}this.createBlock(housePosX + x, y, housePosZ + houseSizeZ - 1, woodMaterial); // Back wall}}for (let z = 0; z < houseSizeZ; z++) {for (let y = 1; y <= wallHeight; y++) {// Side wallsthis.createBlock(housePosX, y, housePosZ + z, woodMaterial); // Left wallthis.createBlock(housePosX + houseSizeX - 1, y, housePosZ + z, woodMaterial); // Right wall}}// Rooffor (let x = -1; x <= houseSizeX; x++) {for (let z = -1; z <= houseSizeZ; z++) {this.createBlock(housePosX + x, wallHeight + 1, housePosZ + z, stoneMaterial);}}// Create a small mining areaconst minePosX = -8;const minePosZ = -8;// Create pitfor (let x = 0; x < 4; x++) {for (let z = 0; z < 4; z++) {// Remove blocks to create a pit// but leave some stone blocks at the bottomif (!(x === 1 && z === 1) && !(x === 2 && z === 2)) {this.createBlock(minePosX + x, -3, minePosZ + z, stoneMaterial);}}}// Add some stone around the pitfor (let i = 0; i < 10; i++) {const rx = minePosX + Math.floor(Math.random() * 6) - 1;const rz = minePosZ + Math.floor(Math.random() * 6) - 1;const ry = Math.floor(Math.random() * 2);this.createBlock(rx, ry, rz, stoneMaterial);}}createPlayerCharacters() {// We'll create simple block player models for now// In a real implementation, you would load Minecraft character models// Player 1this.createPlayerModel(this.players[0]);// Player 2this.createPlayerModel(this.players[1]);}createPlayerModel(player) {// Get character info from optionsconst characterInfo = this.characterOptions.find(c => c.name === player.character);if (!characterInfo) return;// Create character groupconst playerModel = new THREE.Group();// Load character textureconst textureLoader = new THREE.TextureLoader();const texture = textureLoader.load(characterInfo.texture);// Create body parts with correct proportions// Headconst headGeometry = new THREE.BoxGeometry(0.8, 0.8, 0.8);const headMaterial = new THREE.MeshStandardMaterial({ map: texture });const head = new THREE.Mesh(headGeometry, headMaterial);head.position.y = 1.4;head.castShadow = true;playerModel.add(head);// Bodyconst bodyGeometry = new THREE.BoxGeometry(0.6, 1.2, 0.4);const bodyMaterial = new THREE.MeshStandardMaterial({ map: texture,color: player.id === 1 ? 0x3090ff : 0x60d060 });const body = new THREE.Mesh(bodyGeometry, bodyMaterial);body.position.y = 0.6;body.castShadow = true;playerModel.add(body);// Armsconst armGeometry = new THREE.BoxGeometry(0.3, 1.0, 0.3);const armMaterial = new THREE.MeshStandardMaterial({ map: texture,color: player.id === 1 ? 0x2080dd : 0x50c050});const leftArm = new THREE.Mesh(armGeometry, armMaterial);leftArm.position.set(-0.45, 0.5, 0);leftArm.castShadow = true;playerModel.add(leftArm);const rightArm = new THREE.Mesh(armGeometry, armMaterial);rightArm.position.set(0.45, 0.5, 0);rightArm.castShadow = true;playerModel.add(rightArm);// Legsconst legGeometry = new THREE.BoxGeometry(0.3, 1.0, 0.3);const legMaterial = new THREE.MeshStandardMaterial({ map: texture,color: 0x3060b0});const leftLeg = new THREE.Mesh(legGeometry, legMaterial);leftLeg.position.set(-0.2, -0.5, 0);leftLeg.castShadow = true;playerModel.add(leftLeg);const rightLeg = new THREE.Mesh(legGeometry, legMaterial);rightLeg.position.set(0.2, -0.5, 0);rightLeg.castShadow = true;playerModel.add(rightLeg);// Position the player modelplayerModel.position.copy(player.position);// Store limbs for animationplayerModel.userData = {head,leftArm,rightArm,leftLeg,rightLeg,animationTime: 0};// Add to scene and assign to playerthis.scene.add(playerModel);player.model = playerModel;}setupCharacterSelection() {const container = document.getElementById('character-options');this.characterOptions.forEach((char, index) => {const option = document.createElement('div');option.className = 'character-option';if (char.playerID === 1) option.classList.add('selected');const img = document.createElement('img');img.src = char.texture;img.alt = char.name;const name = document.createElement('div');name.textContent = char.name;option.appendChild(img);option.appendChild(name);option.addEventListener('click', () => {// Show character selection dialogthis.selectCharacter(char, index);});container.appendChild(option);});}selectCharacter(character, index) {// Create a simple modal for character selectionconst selection = prompt(`Assign ${character.name} to:\n1: Player 1\n2: Player 2\n0: Cancel`);if (selection === '1' || selection === '2') {const playerIndex = parseInt(selection) - 1;const player = this.players[playerIndex];// Update selectedPlayerID on old characterconst oldCharOption = this.characterOptions.find(c => c.name === player.character);if (oldCharOption) oldCharOption.playerID = null;// Update player characterplayer.character = character.name;character.playerID = parseInt(selection);// Update UIdocument.getElementById(`player${selection}-character`).textContent = character.name;// Remove old player model and create a new oneif (player.model) {this.scene.remove(player.model);}this.createPlayerModel(player);// Update character selection UIconst options = document.querySelectorAll('.character-option');options.forEach((opt, idx) => {if (this.characterOptions[idx].playerID === 1 || this.characterOptions[idx].playerID === 2) {opt.classList.add('selected');} else {opt.classList.remove('selected');}});}}setupEventListeners() {// Keyboard controlsdocument.addEventListener('keydown', (event) => this.handleKeyDown(event));document.addEventListener('keyup', (event) => this.handleKeyUp(event));// Window resizewindow.addEventListener('resize', () => this.handleResize());}handleKeyDown(event) {// Player 1 controls (WASD + Space)switch(event.code) {case 'KeyW': this.keys.player1.forward = true; break;case 'KeyS': this.keys.player1.backward = true; break;case 'KeyA': this.keys.player1.left = true; break;case 'KeyD': this.keys.player1.right = true; break;case 'Space': event.preventDefault();this.keys.player1.jump = true; break;case 'KeyE': this.keys.player1.action = true; break;}// Player 2 controls (Arrow keys + Enter)switch(event.code) {case 'ArrowUp': this.keys.player2.forward = true; break;case 'ArrowDown': this.keys.player2.backward = true; break;case 'ArrowLeft': this.keys.player2.left = true; break;case 'ArrowRight': this.keys.player2.right = true; break;case 'Enter': this.keys.player2.jump = true; break;case 'Slash': this.keys.player2.action = true; break;}}handleKeyUp(event) {// Player 1 controlsswitch(event.code) {case 'KeyW': this.keys.player1.forward = false; break;case 'KeyS': this.keys.player1.backward = false; break;case 'KeyA': this.keys.player1.left = false; break;case 'KeyD': this.keys.player1.right = false; break;case 'Space': this.keys.player1.jump = false; break;case 'KeyE': this.keys.player1.action = false; break;}// Player 2 controlsswitch(event.code) {case 'ArrowUp': this.keys.player2.forward = false; break;case 'ArrowDown': this.keys.player2.backward = false; break;case 'ArrowLeft': this.keys.player2.left = false; break;case 'ArrowRight': this.keys.player2.right = false; break;case 'Enter': this.keys.player2.jump = false; break;case 'Slash': this.keys.player2.action = false; break;}}handleResize() {const width = window.innerWidth;const height = window.innerHeight;this.camera.aspect = width / height;this.camera.updateProjectionMatrix();this.renderer.setSize(width, height);}updatePlayer(player, controls, deltaTime) {if (!player.model) return;// Movement directionconst moveDir = new THREE.Vector3(0, 0, 0);if (controls.forward) moveDir.z -= 1;if (controls.backward) moveDir.z += 1;if (controls.left) moveDir.x -= 1;if (controls.right) moveDir.x += 1;// Normalize movement directionif (moveDir.length() > 0) {moveDir.normalize();// Calculate movementconst movement = moveDir.multiplyScalar(this.moveSpeed * deltaTime * 60);// Update positionplayer.position.x += movement.x;player.position.z += movement.z;// Update animation stateplayer.model.userData.animationTime += deltaTime * 10;// Animate legs and arms while walkingthis.animateWalking(player.model, player.model.userData.animationTime);// Face direction of movementif (movement.x !== 0 || movement.z !== 0) {player.model.rotation.y = Math.atan2(movement.x, movement.z);}} else {// Reset animation when not movingthis.resetAnimation(player.model);}// Jumpingif (controls.jump && player.onGround) {player.velocity.y = this.jumpForce;player.isJumping = true;player.onGround = false;// Update game statusdocument.getElementById('game-status').textContent = `Player ${player.id} jumped!`;}// Apply gravityplayer.velocity.y -= this.gravity;player.position.y += player.velocity.y;// Ground collision detectionif (player.position.y <= 1) {player.position.y = 1;player.velocity.y = 0;player.onGround = true;player.isJumping = false;}// World boundariesconst boundaryLimit = this.worldSize / 2 - 1;player.position.x = Math.max(-boundaryLimit, Math.min(boundaryLimit, player.position.x));player.position.z = Math.max(-boundaryLimit, Math.min(boundaryLimit, player.position.z));// Update model positionplayer.model.position.copy(player.position);// Perform action if requestedif (controls.action) {this.performAction(player);}}performAction(player) {// Simple action feedbackdocument.getElementById('game-status').textContent = `Player ${player.id} is performing an action!`;// Animate action (e.g. arm swing)if (player.model) {const rightArm = player.model.userData.rightArm;// Create a simple animation for the arm swingconst startRotation = { x: 0 };const endRotation = { x: -Math.PI / 2 };// Animate swing downconst swingDown = new TWEEN.Tween(startRotation).to(endRotation, 200).easing(TWEEN.Easing.Quadratic.Out).onUpdate(() => {rightArm.rotation.x = startRotation.x;});// Animate swing backconst swingBack = new TWEEN.Tween(endRotation).to({ x: 0 }, 200).easing(TWEEN.Easing.Quadratic.In).onUpdate(() => {rightArm.rotation.x = endRotation.x;});// Chain the animationsswingDown.chain(swingBack);swingDown.start();}}animateWalking(model, time) {if (!model || !model.userData) return;const { leftLeg, rightLeg, leftArm, rightArm } = model.userData;// Animate legsif (leftLeg && rightLeg) {leftLeg.rotation.x = Math.sin(time) * 0.5;rightLeg.rotation.x = Math.sin(time + Math.PI) * 0.5;}// Animate armsif (leftArm && rightArm) {leftArm.rotation.x = Math.sin(time + Math.PI) * 0.5;rightArm.rotation.x = Math.sin(time) * 0.5;}}resetAnimation(model) {if (!model || !model.userData) return;const { leftLeg, rightLeg, leftArm, rightArm } = model.userData;// Reset all rotationsif (leftLeg) leftLeg.rotation.set(0, 0, 0);if (rightLeg) rightLeg.rotation.set(0, 0, 0);if (leftArm) leftArm.rotation.set(0, 0, 0);if (rightArm) rightArm.rotation.set(0, 0, 0);}updateCamera() {// Calculate center position between playersconst center = new THREE.Vector3();this.players.forEach(player => {center.add(player.position);});center.divideScalar(this.players.length);// Calculate distance between playerslet maxDistance = 0;this.players.forEach(player => {const distance = player.position.distanceTo(center);maxDistance = Math.max(maxDistance, distance);});// Adjust camera position based on player positionsconst cameraDistance = Math.max(10, maxDistance * 3);const cameraHeight = Math.max(6, maxDistance * 1.5);// Smoothly move camera to new positionconst targetCameraPos = new THREE.Vector3(center.x + cameraDistance * Math.sin(Date.now() * 0.0001),cameraHeight,center.z + cameraDistance * Math.cos(Date.now() * 0.0001));this.camera.position.lerp(targetCameraPos, 0.02);this.camera.lookAt(center);}animate() {requestAnimationFrame(() => this.animate());const deltaTime = this.clock.getDelta();// Update playersthis.updatePlayer(this.players[0], this.keys.player1, deltaTime);this.updatePlayer(this.players[1], this.keys.player2, deltaTime);// Update camera to follow playersthis.updateCamera();// Update animationsTWEEN.update();// Render scenethis.renderer.render(this.scene, this.camera);}}// Initialize the game when page is loadedwindow.addEventListener('load', () => {const game = new MinecraftStyleGame();});</script>
</body>
</html>

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/43041.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

el-radio-group 中 el-radio-button value未能绑定上数值数据

这样绑定到admin后不会随着admin的值显示 在value加上 : 后成功显示

Spring Cloud Gateway详细介绍简单案例

文章目录 1、Spring Cloud Gateway 详细介绍1.1. 统一入口&#xff08;Single Entry Point&#xff09;1.2. 请求路由&#xff08;Request Routing&#xff09;1.3. 负载均衡&#xff08;Load Balancing&#xff09;1.4. 流量控制&#xff08;Rate Limiting&#xff09;1.5. 身…

Msys2安装编译Redis

此处注意文件夹的权限问题&#xff0c;将文件夹的只读属性取消&#xff0c;否则在编译的时候会提示没有权限。首先&#xff0c;进入 msys2 所在目录的 usr/include/ 下&#xff0c;找到 dlfcn.h &#xff0c;复制站贴做个备份。然后打开 dlfcn.h &#xff0c;找到 Dl_info定义的…

SHELL 三剑客

grep awk sed grep grep通常和管道符|一起使用&#xff0c;对管道符前面数据进行对应处理 其命令参数包括 -v 过滤指定内容 -i 不区分大小写 -c 统计匹配行号 -n 带行号可以参考下图数据 awk awk 简单来说awk就是把文件逐行的读入&#xff0c;以空格为默认分隔符将每行切…

【云原生】docker 搭建单机PostgreSQL操作详解

目录 一、前言 二、前置准备 2.1 服务器环境 2.2 docker环境 三、docker安装PostgreSQL过程 3.1 获取PostgreSQL镜像 3.2 启动容器 3.2.1 创建数据卷目录 3.2.2 启动pg容器 3.3 客户端测试连接数据库 四、创建数据库与授权 4.1 进入PG容器 4.2 PG常用操作命令 4.2…

645.错误的集合

import java.util.HashMap; import java.util.Map;/*** program: Test* description: 645 错误的集合* author: gyf* create: 2025-03-23 10:22**/ public class Test {public static void main(String[] args) {}public static int[] findErrorNums(int[] nums) {int[] arr n…

向量数据库学习笔记(2) —— pgvector 用法 与 最佳实践

关于向量的基础概念&#xff0c;可以参考&#xff1a;向量数据库学习笔记&#xff08;1&#xff09; —— 基础概念-CSDN博客 一、 pgvector简介 pgvector 是一款开源的、基于pg的、向量相似性搜索 插件&#xff0c;将您的向量数据与其他数据统一存储在pg中。支持功能包括&…

Unity编辑器功能及拓展(3) —[Attribute]特性

在 Unity 中&#xff0c;[Attribute]格式的特性是用于扩展编辑器功能、控制序列化行为和调整 Inspector 显示,进行编辑器拓展的核心工具。 一.基础编辑器拓展 1.基础序列化控制 1.[SerializeField] 强制显示私有变量到Inspector 2.[HideInInspector] 隐藏该字段在Inspect…

探究 CSS 如何在HTML中工作

2025/3/28 向全栈工程师迈进&#xff01; 一、CSS的作用 简单一句话——美化网页 <p>Lets use:<span>Cascading</span><span>Style</span><span>Sheets</span> </p> 对于如上代码来说&#xff0c;其显示效果如下&#xff1…

【docker】docker-compose安装RabbitMQ

docker-compose安装RabbitMQ 1、配置docker-compose.yml文件&#xff08;docker容器里面的目录请勿修改&#xff09;2、启动mq3、访问mq4、查看服务器映射目录5、踩坑5.1、权限不足 1、配置docker-compose.yml文件&#xff08;docker容器里面的目录请勿修改&#xff09; versi…

小红书xhs逆向算法还原(202503月更新)

今天闲着没事再来看下小红书&#xff0c;发现好像过不去了&#xff0c;解开base64看看 {"signSvn":"56","signType":"x2","appId":"xhs-pc-web","signVersion":"1","payload":&qu…

全国产1U机架式交换机解决方案

规格参数 基本参数信息 基本信息 端口规格 32个10/100/1000Base-T RJ45接口&#xff0c;8个1G/10Gig SFP Console管理端口&#xff0c;RJ45&#xff0c;数量&#xff1a;1 支持1个USB接口&#xff0c;1个复位按键 外形尺寸 482 mm&#xff08;长&#xff09; 300mm &#…

【8】递归之经典题型总结

&#x1f4da;博客主页&#xff1a;代码探秘者 ✨专栏&#xff1a;《JavaSe》 其他更新ing… ❤️感谢大家点赞&#x1f44d;&#x1f3fb;收藏⭐评论✍&#x1f3fb;&#xff0c;您的三连就是我持续更新的动力❤️ &#x1f64f;作者水平有限&#xff0c;欢迎各位大佬指点&…

JC4010快速入门

目录 一、硬件接线二、软件操作2.1、 设置2.2、 零点 校准2.3、闭环控制2.4、调整PI参数2.5、切换控制模式 三、CAN模块操作3.1、使用CANable3.2、发送指令3.3、其它 一、硬件接线 ZH1.5-6P 和 SH1.0-3P 端子定义如下&#xff1a; 红色接电源正极&#xff0c;黑色接电源负极&a…

基于Spring Boot的高校普法系统的设计与实现(LW+源码+讲解)

专注于大学生项目实战开发,讲解,毕业答疑辅导&#xff0c;欢迎高校老师/同行前辈交流合作✌。 技术范围&#xff1a;SpringBoot、Vue、SSM、HLMT、小程序、Jsp、PHP、Nodejs、Python、爬虫、数据可视化、安卓app、大数据、物联网、机器学习等设计与开发。 主要内容&#xff1a;…

从零开始跑通3DGS教程:(三)坐标系与尺度编辑(CloudCompare)

写在前面 本文内容 本文所属《从零开始跑通3DGS教程》系列文章&#xff1b; sfm重建的点云已经丢掉了尺度信息&#xff0c;并且坐标系跟图像数据有关(SFM初始化选择的图像)&#xff0c;所以如果想恢复物理真实尺度&#xff0c;以及在想要的视角下渲染&#xff0c;那么需要对尺度…

代码随想录day31 贪心part05

56.合并区间 以数组 intervals 表示若干个区间的集合&#xff0c;其中单个区间为 intervals[i] [starti, endi] 。请你合并所有重叠的区间&#xff0c;并返回 一个不重叠的区间数组&#xff0c;该数组需恰好覆盖输入中的所有区间 。 示例 1&#xff1a; 输入&#xff1a;in…

【MyBatis】MyBatis 操作数据库(入门)

文章目录 前言一、什么是MyBatis&#xff1f;二、MyBatis入门2.1、准备工作2.1.1 创建工程2.1.2、数据准备 2.2、配置数据库连接字符串2.3、写持久层代码2.4 单元测试 三、MyBatis的基础操作3.1 打印日志3.2、参数传递3.3、增(Insert)3.4、 删(Delete)3.5、改(Update)3.6、查(S…

蓝桥杯备考:多米诺骨牌

这道题要求上下方格子和之差要最小&#xff0c;其实就是算每个上下格子的差求和的最小值 这道题其实是动态规划01背包问题 我们直接按步骤做吧 step1:定义状态表示f[i][j]表示从1到i个编号的差值里选出刚好j个数的最小操作次数 step2:推导状态转移方程 如图这就是我们的状态…

bluecode-20240913_1_数据解码

时间限制&#xff1a;C/C 1000MS&#xff0c;其他语言 2000MS 内存限制&#xff1a;C/C 256MB&#xff0c;其他语言 512MB 难度&#xff1a;困难 数据解码 指定有一段经过编码的二进制数据&#xff0c;数据由0个或多个"编码单元"组成。"编码单元"的编码方式…