User prompt
Has que la pared sea una línea recta
User prompt
Las partes sin textura ponle el número (1)
User prompt
Has que el piso y el techo sean parte del escenario ósea pseudo-3D
User prompt
Haz que el piso que es el símbolo (8) siempre esté abajo del personaje actuando como piso y poder caminar sobre el
User prompt
Has que el piso siempre esté abajo del personaje
User prompt
Haz que las paredes tengan este símbolo (7) el piso el símbolo (8) y el techo el símbolo (9)
User prompt
Pon que el jugador siempre aparezca en la coordenada ( 0 ) y has que las paredes tengan la altura de ( y 1 )hasta el máximo de( y 5 )
User prompt
Okey, crea una detección automática del piso techo y paredes para evitar confusiones con estas
User prompt
Haz que las paredes tengan colision
User prompt
Haz que las paredes tengan textura del famoso juego Backrooms
User prompt
No mira estas son la regla. 1- vamos a usar toda la pantalla 2- no uses cosas 2D 3- haz y imita lo que te diga pero usando la técnica llamada pseudo-3D
User prompt
Borra todo el código
User prompt
Borra todo compénsenos de nuevo
User prompt
Haz que el jugador tenga la visión en primera persona vamos a usar la isometría para el techo y el piso para dar el efecto 3D que no es 3D para los lados haz paredes y pilares que se puedan colisionar
User prompt
Please fix the bug: 'undefined is not an object (evaluating 'isoFloor.skew.x = -0.3')' in or related to this line: 'isoFloor.skew.x = -0.3;' Line Number: 183
User prompt
Haz espacios isométricos para el piso el techo
User prompt
Haz un sistema de rotación de cámara que deslizando el dedo se vea para una dirección u otra ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: undefined is not an object (evaluating 'sanityText.style.fill = sanityColor')' in or related to this line: 'sanityText.style.fill = sanityColor;' Line Number: 369
Code edit (1 edits merged)
Please save this source code
User prompt
Backrooms Infinite Escape
Initial prompt
Hola Ava, mi juego trata de una temática de juego muy popular llamada Backrooms estuvo de moda en el 2020. Quiero que crees habitaciones infinitas y que allá monstruos que te dire más adelante
/**** * Classes ****/ var Player = Container.expand(function () { var self = Container.call(this); self.x = 1024; self.y = 1366; self.angle = 0; self.speed = 8; self.rotSpeed = 0.1; // Player visual for debugging (will be hidden in first person) var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); playerGraphics.visible = false; // Hide for first person view self.moveForward = function () { var newX = self.x + Math.cos(self.angle) * self.speed; var newY = self.y + Math.sin(self.angle) * self.speed; // Check wall collision using same logic as raycasting if (self.checkCollision(newX, newY)) { return; // Don't move if collision detected } // Simple boundary check if (newX > 100 && newX < 1948 && newY > 100 && newY < 2632) { self.x = newX; self.y = newY; } }; self.moveBackward = function () { var newX = self.x - Math.cos(self.angle) * self.speed; var newY = self.y - Math.sin(self.angle) * self.speed; // Check wall collision using same logic as raycasting if (self.checkCollision(newX, newY)) { return; // Don't move if collision detected } if (newX > 100 && newX < 1948 && newY > 100 && newY < 2632) { self.x = newX; self.y = newY; } }; self.turnLeft = function () { self.angle -= self.rotSpeed; }; self.turnRight = function () { self.angle += self.rotSpeed; }; self.checkCollision = function (x, y) { // Use same collision logic as raycasting for consistency // Check wall boundaries first if (x <= 100 || x >= 1948 || y <= 100 || y >= 2632) { return true; // Boundary wall collision } // Add backrooms maze pattern - more complex wall generation var gridX = Math.floor(x / 150); var gridY = Math.floor(y / 150); // Create backrooms-style maze pattern var cellHash = (gridX * 73 + gridY * 37) % 100; if (cellHash < 30) { return true; // Wall collision } // Add occasional pillars for backrooms feel var pillarX = Math.floor(x / 300) * 300 + 150; var pillarY = Math.floor(y / 300) * 300 + 150; var pillarDist = Math.sqrt((x - pillarX) * (x - pillarX) + (y - pillarY) * (y - pillarY)); if (pillarDist < 40) { // Slightly larger collision radius than visual return true; // Pillar collision } return false; // No collision - clear floor/ceiling space }; return self; }); var Renderer3D = Container.expand(function () { var self = Container.call(this); self.wallColumns = []; self.floorColumns = []; self.ceilingColumns = []; // Create pseudo-3D rendering columns for (var i = 0; i < 512; i++) { var wallCol = self.addChild(LK.getAsset('wall', { anchorX: 0.5, anchorY: 1.0 })); wallCol.x = i * 4; wallCol.y = 1366; self.wallColumns.push(wallCol); var floorCol = self.addChild(LK.getAsset('floorStrip', { anchorX: 0.5, anchorY: 0.5 })); floorCol.x = i * 4; floorCol.y = 2000; self.floorColumns.push(floorCol); var ceilCol = self.addChild(LK.getAsset('ceilingStrip', { anchorX: 0.5, anchorY: 0.5 })); ceilCol.x = i * 4; ceilCol.y = 700; self.ceilingColumns.push(ceilCol); } self.render = function (player) { var fov = Math.PI / 3; // 60 degrees field of view var halfFov = fov / 2; for (var i = 0; i < 512; i++) { var rayAngle = player.angle - halfFov + i / 512 * fov; var rayResult = self.castRay(player.x, player.y, rayAngle); var distance = rayResult.distance; var surfaceType = rayResult.type; // Calculate wall height based on distance var wallHeight = Math.max(50, 20000 / (distance + 1)); var wallY = 1366 - wallHeight / 2; // Update wall column based on surface type if (surfaceType === 'wall') { self.wallColumns[i].visible = true; self.wallColumns[i].height = wallHeight; self.wallColumns[i].y = wallY; // Add backrooms wall texture variation based on distance and position var textureVariation = Math.sin(i * 0.1 + distance * 0.01) * 0.1; var baseColor = 0xf4f4a0; // Backrooms yellow var colorVariation = Math.floor(textureVariation * 20); self.wallColumns[i].tint = baseColor + colorVariation; } else { // Hide wall if not hitting a wall surface self.wallColumns[i].visible = false; } // Auto-detect and render floor var floorY = 1366 + wallHeight / 2 + distance / 10; self.floorColumns[i].y = Math.min(2632, floorY); self.floorColumns[i].height = Math.max(2, distance / 50); self.floorColumns[i].visible = floorY < 2632; // Only show if within screen bounds // Auto-detect and render ceiling var ceilY = 1366 - wallHeight / 2 - distance / 10; self.ceilingColumns[i].y = Math.max(0, ceilY); self.ceilingColumns[i].height = Math.max(2, distance / 50); self.ceilingColumns[i].visible = ceilY > 0; // Only show if within screen bounds } }; self.castRay = function (startX, startY, angle) { var rayX = startX; var rayY = startY; var deltaX = Math.cos(angle) * 2; var deltaY = Math.sin(angle) * 2; var distance = 0; var hitType = 'wall'; // Track what we hit: 'wall', 'floor', 'ceiling' // Simple raycasting - check for boundaries while (distance < 1000) { rayX += deltaX; rayY += deltaY; distance += 2; // Hit wall boundaries if (rayX <= 100 || rayX >= 1948 || rayY <= 100 || rayY >= 2632) { hitType = 'wall'; break; } // Add backrooms maze pattern - more complex wall generation var gridX = Math.floor(rayX / 150); var gridY = Math.floor(rayY / 150); // Create backrooms-style maze pattern var cellHash = (gridX * 73 + gridY * 37) % 100; if (cellHash < 30 && distance > 30) { hitType = 'wall'; break; } // Add occasional pillars for backrooms feel var pillarX = Math.floor(rayX / 300) * 300 + 150; var pillarY = Math.floor(rayY / 300) * 300 + 150; var pillarDist = Math.sqrt((rayX - pillarX) * (rayX - pillarX) + (rayY - pillarY) * (rayY - pillarY)); if (pillarDist < 30 && distance > 20) { hitType = 'wall'; break; } } return { distance: distance, type: hitType }; }; return self; }); /**** * Initialize Game ****/ // Create player var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Create player var player = new Player(); game.addChild(player); // Create 3D renderer var renderer3D = new Renderer3D(); game.addChild(renderer3D); // Create surface type symbols for visual reference var wallSymbol = new Text2('(7)', { size: 60, fill: 0xF4F4A0 }); wallSymbol.anchor.set(0.5, 0.5); wallSymbol.x = 200; wallSymbol.y = 200; LK.gui.topLeft.addChild(wallSymbol); var floorSymbol = new Text2('(8)', { size: 60, fill: 0x808080 }); floorSymbol.anchor.set(0.5, 0.5); floorSymbol.x = 200; floorSymbol.y = 300; LK.gui.topLeft.addChild(floorSymbol); var ceilingSymbol = new Text2('(9)', { size: 60, fill: 0x1A1A15 }); ceilingSymbol.anchor.set(0.5, 0.5); ceilingSymbol.x = 200; ceilingSymbol.y = 400; LK.gui.topLeft.addChild(ceilingSymbol); // Movement flags var moveForward = false; var moveBackward = false; var turnLeft = false; var turnRight = false; // Touch controls for movement var touchStartX = 0; var touchStartY = 0; var touchActive = false; game.down = function (x, y, obj) { touchStartX = x; touchStartY = y; touchActive = true; // Forward movement on touch moveForward = true; }; game.up = function (x, y, obj) { touchActive = false; moveForward = false; moveBackward = false; turnLeft = false; turnRight = false; }; game.move = function (x, y, obj) { if (!touchActive) return; var deltaX = x - touchStartX; var deltaY = y - touchStartY; // Horizontal movement for turning if (Math.abs(deltaX) > 50) { if (deltaX > 0) { turnRight = true; turnLeft = false; } else { turnLeft = true; turnRight = false; } } else { turnLeft = false; turnRight = false; } // Vertical movement for forward/backward if (Math.abs(deltaY) > 50) { if (deltaY < 0) { moveForward = true; moveBackward = false; } else { moveBackward = true; moveForward = false; } } }; game.update = function () { // Handle movement if (moveForward) { player.moveForward(); } if (moveBackward) { player.moveBackward(); } if (turnLeft) { player.turnLeft(); } if (turnRight) { player.turnRight(); } // Render the pseudo-3D view renderer3D.render(player); };
===================================================================
--- original.js
+++ change.js
@@ -2,10 +2,10 @@
* Classes
****/
var Player = Container.expand(function () {
var self = Container.call(this);
- self.x = 0;
- self.y = 0;
+ self.x = 1024;
+ self.y = 1366;
self.angle = 0;
self.speed = 8;
self.rotSpeed = 0.1;
// Player visual for debugging (will be hidden in first person)
@@ -107,10 +107,10 @@
var rayAngle = player.angle - halfFov + i / 512 * fov;
var rayResult = self.castRay(player.x, player.y, rayAngle);
var distance = rayResult.distance;
var surfaceType = rayResult.type;
- // Calculate wall height based on distance - constrain to y=1 to y=5 range
- var wallHeight = Math.max(1, Math.min(5, 20000 / (distance + 1)));
+ // Calculate wall height based on distance
+ var wallHeight = Math.max(50, 20000 / (distance + 1));
var wallY = 1366 - wallHeight / 2;
// Update wall column based on surface type
if (surfaceType === 'wall') {
self.wallColumns[i].visible = true;
@@ -196,8 +196,33 @@
game.addChild(player);
// Create 3D renderer
var renderer3D = new Renderer3D();
game.addChild(renderer3D);
+// Create surface type symbols for visual reference
+var wallSymbol = new Text2('(7)', {
+ size: 60,
+ fill: 0xF4F4A0
+});
+wallSymbol.anchor.set(0.5, 0.5);
+wallSymbol.x = 200;
+wallSymbol.y = 200;
+LK.gui.topLeft.addChild(wallSymbol);
+var floorSymbol = new Text2('(8)', {
+ size: 60,
+ fill: 0x808080
+});
+floorSymbol.anchor.set(0.5, 0.5);
+floorSymbol.x = 200;
+floorSymbol.y = 300;
+LK.gui.topLeft.addChild(floorSymbol);
+var ceilingSymbol = new Text2('(9)', {
+ size: 60,
+ fill: 0x1A1A15
+});
+ceilingSymbol.anchor.set(0.5, 0.5);
+ceilingSymbol.x = 200;
+ceilingSymbol.y = 400;
+LK.gui.topLeft.addChild(ceilingSymbol);
// Movement flags
var moveForward = false;
var moveBackward = false;
var turnLeft = false;