User prompt
Que el profesor sea lento
User prompt
Elimina los muebles
User prompt
Que el jugador se mueva
User prompt
que los muebles tengan colision
User prompt
Que en la puerta haiga una pregunta con varias obsiones la pregunta es 7×2 cuanto es obciones 13 obcion 2 14 obsion correcta 2
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'var dx = student.x - self.x;' Line Number: 32
User prompt
Que el profesor bregue matar al alumno
User prompt
Please fix the bug: 'Student is not defined' in or related to this line: 'var student = new Student();' Line Number: 154
User prompt
Que el profesor brege matar a el alumno
User prompt
Please fix the bug: 'Student is not defined' in or related to this line: 'var student = new Student();' Line Number: 154
User prompt
Please fix the bug: 'Student is not defined' in or related to this line: 'var student = new Student();' Line Number: 154
User prompt
que el profesor brege matar a el jugador
User prompt
Que por cuarto haiga una puerta
User prompt
Que haiga un colegio como el de baldi
User prompt
Que la camara este atras del personaje
User prompt
Que el mapa sea de un colegio que sea muy grande cancha y de todo
User prompt
Pero has un juego en 3 persona
User prompt
Please fix the bug: 'Maximum call stack size exceeded' in or related to this line: 'return {' Line Number: 76
User prompt
Please fix the bug: 'Maximum call stack size exceeded' in or related to this line: 'return {' Line Number: 75
User prompt
Please fix the bug: 'RangeError: Maximum call stack size exceeded' in or related to this line: 'return {' Line Number: 155
Code edit (1 edits merged)
Please save this source code
User prompt
San Luis: El Monstruo del Colegio
User prompt
Juego de un colegio escondite de un profesor monstruoso y que este basado en el sanluis yarumal
User prompt
Basado en el colegio sanluis de yarumal
User prompt
Un juego de supervivencia esconderse de un monstruo en un colegio
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Door class (exit) var Door = Container.expand(function () { var self = Container.call(this); var sprite = self.attachAsset('door', { anchorX: 0.5, anchorY: 0.5 }); return self; }); // Furniture class var Furniture = Container.expand(function () { var self = Container.call(this); var sprite = self.attachAsset('furniture', { anchorX: 0.5, anchorY: 0.5 }); return self; }); // Profesor class var Profesor = Container.expand(function () { var self = Container.call(this); var sprite = self.attachAsset('profesor', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; // Movement speed per tick self.visionRange = 500; // px self.visionAngle = Math.PI / 3; // 60 deg cone self.patrolPoints = []; self.currentPatrol = 0; self.state = 'patrol'; // 'patrol', 'chase' self.chaseCooldown = 0; self.update = function () {}; return self; }); // Student class var Student = Container.expand(function () { var self = Container.call(this); var sprite = self.attachAsset('student', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 18; // Movement speed per tick self.isHiding = false; self.update = function () {}; return self; }); // Wall class var Wall = Container.expand(function () { var self = Container.call(this); var sprite = self.attachAsset('wall', { anchorX: 0, anchorY: 0 }); // Provide a non-recursive getBounds implementation self.getBounds = function () { // Use the current width/height and position, do not call self.getBounds recursively! return { x: self.x, y: self.y, width: self.width, height: self.height }; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xe0e0e0 }); /**** * Game Code ****/ /* We use simple shapes for MVP: - 'student': box, blue - 'profesor': box, red - 'furniture': box, brown - 'door': box, green - 'floor': box, light gray - 'wall': box, dark gray */ // --- Level Layout (MVP: 1 corridor, 2 classrooms, 1 exit) --- // Walls (top, bottom, left, right) var walls = []; function createWall(x, y, w, h) { var wall = new Wall(); wall.width = w; wall.height = h; wall.x = x; wall.y = y; wall.getBounds = function () { return { x: wall.x, y: wall.y, width: wall.width, height: wall.height }; }; game.addChild(wall); walls.push(wall); } createWall(0, 0, 2048, 40); // Top createWall(0, 2732 - 40, 2048, 40); // Bottom createWall(0, 0, 40, 2732); // Left createWall(2048 - 40, 0, 40, 2732); // Right // Classrooms (rectangular rooms at left and right) var classroomA = { x: 200, y: 400, w: 600, h: 800 }; var classroomB = { x: 1248, y: 1500, w: 600, h: 800 }; // Classroom walls createWall(classroomA.x, classroomA.y, classroomA.w, 40); // Top createWall(classroomA.x, classroomA.y + classroomA.h - 40, classroomA.w, 40); // Bottom createWall(classroomA.x, classroomA.y, 40, classroomA.h); // Left createWall(classroomA.x + classroomA.w - 40, classroomA.y, 40, classroomA.h); // Right createWall(classroomB.x, classroomB.y, classroomB.w, 40); // Top createWall(classroomB.x, classroomB.y + classroomB.h - 40, classroomB.w, 40); // Bottom createWall(classroomB.x, classroomB.y, 40, classroomB.h); // Left createWall(classroomB.x + classroomB.w - 40, classroomB.y, 40, classroomB.h); // Right // Corridor (between classrooms) var corridor = { x: 800, y: 0, w: 448, h: 2732 }; // Furniture (MVP: 2 per classroom) var furnitures = []; function addFurniture(x, y) { var f = new Furniture(); f.x = x; f.y = y; f.getBounds = function () { return { x: f.x - f.width / 2, y: f.y - f.height / 2, width: f.width, height: f.height }; }; game.addChild(f); furnitures.push(f); } addFurniture(classroomA.x + 200, classroomA.y + 200); addFurniture(classroomA.x + 400, classroomA.y + 600); addFurniture(classroomB.x + 200, classroomB.y + 200); addFurniture(classroomB.x + 400, classroomB.y + 600); // Door (exit) var door = new Door(); door.x = corridor.x + corridor.w / 2; door.y = 120; door.getBounds = function () { return { x: door.x - door.width / 2, y: door.y - door.height / 2, width: door.width, height: door.height }; }; game.addChild(door); // --- Player (Student) --- var student = new Student(); student.x = classroomA.x + classroomA.w / 2; student.y = classroomA.y + classroomA.h / 2; game.addChild(student); // --- Profesor (Monster) --- var profesor = new Profesor(); profesor.x = corridor.x + corridor.w / 2; profesor.y = 1000; game.addChild(profesor); // Patrol points for profesor (corridor and classrooms) profesor.patrolPoints = [{ x: corridor.x + corridor.w / 2, y: 400 }, { x: corridor.x + corridor.w / 2, y: 2000 }, { x: classroomB.x + classroomB.w / 2, y: classroomB.y + classroomB.h / 2 }, { x: corridor.x + corridor.w / 2, y: 400 }, { x: classroomA.x + classroomA.w / 2, y: classroomA.y + classroomA.h / 2 }]; profesor.currentPatrol = 0; // --- GUI: Instructions --- var instructions = new Text2("¡Escapa del colegio sin que te atrape el profesor monstruoso!\nArrastra para moverte. Escóndete tras muebles.", { size: 70, fill: 0x222222 }); instructions.anchor.set(0.5, 0); LK.gui.top.addChild(instructions); // --- GUI: Hide indicator --- var hideTxt = new Text2("", { size: 90, fill: 0x27AE60 }); hideTxt.anchor.set(0.5, 0); LK.gui.bottom.addChild(hideTxt); // --- Dragging logic --- var dragNode = null; var lastMoveX = 0, lastMoveY = 0; // --- Helper: Rectangle collision --- function rectsIntersect(a, b) { return !(a.x + a.width < b.x || a.x > b.x + b.width || a.y + a.height < b.y || a.y > b.y + b.height); } // --- Helper: Check if student is hiding --- function isStudentHiding() { for (var i = 0; i < furnitures.length; ++i) { var f = furnitures[i]; // If student is "behind" furniture (overlapping at least 60%) var sRect = { x: student.x - student.width / 2, y: student.y - student.height / 2, width: student.width, height: student.height }; var fRect = f.getBounds(); var overlapX = Math.max(0, Math.min(sRect.x + sRect.width, fRect.x + fRect.width) - Math.max(sRect.x, fRect.x)); var overlapY = Math.max(0, Math.min(sRect.y + sRect.height, fRect.y + fRect.height) - Math.max(sRect.y, fRect.y)); var overlapArea = overlapX * overlapY; var studentArea = student.width * student.height; if (overlapArea > 0.6 * studentArea) { return true; } } return false; } // --- Helper: Check wall collision for student --- function canMoveTo(x, y) { var sRect = { x: x - student.width / 2, y: y - student.height / 2, width: student.width, height: student.height }; for (var i = 0; i < walls.length; ++i) { var w = walls[i]; var wRect = w.getBounds ? w.getBounds() : { x: w.x, y: w.y, width: w.width, height: w.height }; if (rectsIntersect(sRect, wRect)) return false; } return true; } // --- Game move handler (drag to move) --- game.move = function (x, y, obj) { if (dragNode === student) { // Clamp to inside game area var nx = Math.max(student.width / 2 + 10, Math.min(2048 - student.width / 2 - 10, x)); var ny = Math.max(student.height / 2 + 10, Math.min(2732 - student.height / 2 - 10, y)); // Only move if not colliding with wall if (canMoveTo(nx, ny)) { student.x = nx; student.y = ny; lastMoveX = nx; lastMoveY = ny; } } }; // Start drag game.down = function (x, y, obj) { // Only allow drag if touch is on student or near var dx = x - student.x, dy = y - student.y; if (dx * dx + dy * dy < 200 * 200) { dragNode = student; lastMoveX = student.x; lastMoveY = student.y; } }; // End drag game.up = function (x, y, obj) { dragNode = null; }; // --- Profesor AI update --- profesor.update = function () { // If chasing, move toward student if (profesor.state === 'chase') { var dx = student.x - profesor.x; var dy = student.y - profesor.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist > 10) { profesor.x += profesor.speed * dx / dist; profesor.y += profesor.speed * dy / dist; } // If lost sight for a while, return to patrol if (profesor.chaseCooldown > 0) { profesor.chaseCooldown--; } else { profesor.state = 'patrol'; } } else { // Patrol: move to next patrol point var pt = profesor.patrolPoints[profesor.currentPatrol]; var dx = pt.x - profesor.x; var dy = pt.y - profesor.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist > 10) { profesor.x += profesor.speed * dx / dist; profesor.y += profesor.speed * dy / dist; } else { // Next patrol point profesor.currentPatrol = (profesor.currentPatrol + 1) % profesor.patrolPoints.length; } } }; // --- Profesor vision logic --- function profesorCanSeeStudent() { // If student is hiding, cannot see if (student.isHiding) return false; // If student is too far, cannot see var dx = student.x - profesor.x; var dy = student.y - profesor.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist > profesor.visionRange) return false; // Angle check (cone) var angleToStudent = Math.atan2(dy, dx); // Profesor facing direction: toward next patrol point or student var facingAngle; if (profesor.state === 'chase') { facingAngle = angleToStudent; } else { var pt = profesor.patrolPoints[profesor.currentPatrol]; facingAngle = Math.atan2(pt.y - profesor.y, pt.x - profesor.x); } var diff = Math.abs(angleToStudent - facingAngle); if (diff > Math.PI) diff = 2 * Math.PI - diff; if (diff > profesor.visionAngle / 2) return false; // Raycast: check if wall blocks view var steps = Math.floor(dist / 40); for (var i = 1; i < steps; ++i) { var tx = profesor.x + dx * i / steps; var ty = profesor.y + dy * i / steps; var probe = { x: tx - 20, y: ty - 20, width: 40, height: 40 }; for (var w = 0; w < walls.length; ++w) { var wRect = walls[w].getBounds ? walls[w].getBounds() : { x: walls[w].x, y: walls[w].y, width: walls[w].width, height: walls[w].height }; if (rectsIntersect(probe, wRect)) return false; } } return true; } // --- Main game update --- var lastHiding = false; var lastProfesorSee = false; game.update = function () { // Update hiding state student.isHiding = isStudentHiding(); if (student.isHiding && !lastHiding) { hideTxt.setText("¡Estás escondido!"); } else if (!student.isHiding && lastHiding) { hideTxt.setText(""); } lastHiding = student.isHiding; // Profesor AI profesor.update(); // Profesor vision var canSee = profesorCanSeeStudent(); if (canSee && !lastProfesorSee) { // Start chase profesor.state = 'chase'; profesor.chaseCooldown = 120; // 2 seconds // Flash warning LK.effects.flashObject(student, 0xff0000, 500); } if (canSee) { profesor.chaseCooldown = 120; // Reset chase timer if still visible } lastProfesorSee = canSee; // Check lose: profesor touches student if (student.intersects(profesor)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } // Check win: student reaches door if (student.intersects(door)) { LK.effects.flashScreen(0x27ae60, 1000); LK.showYouWin(); return; } };
===================================================================
--- original.js
+++ change.js
@@ -61,8 +61,9 @@
anchorY: 0
});
// Provide a non-recursive getBounds implementation
self.getBounds = function () {
+ // Use the current width/height and position, do not call self.getBounds recursively!
return {
x: self.x,
y: self.y,
width: self.width,
Modern App Store icon, high definition, square with rounded corners, for a game titled "San Luis: El Monstruo del Colegio" and with the description "Juego de escondite en el colegio San Luis de Yarumal, donde debes evitar a un profesor monstruoso y escapar del colegio.". No text on icon!
Puerta. In-Game asset. 2d. High contrast. No shadows
Piso liso. In-Game asset. 2d. High contrast. No shadows
Un solo pupitre. In-Game asset. 2d. High contrast. No shadows
Niño pequeño con uniforme blanco y sudadera azul. In-Game asset. 2d. High contrast. No shadows
Suelo de concreto. In-Game asset. 2d. High contrast. No shadows