User prompt
elimina el apartado: "Collected" y que para ganar el nivel primero deberemos acabar con las panterasque me muestren en pantalla ("en este caso son solo 2") y despues agarrar 10 pastafrolas, y solo ahi la puerta se abra, y que despues de ir hacia ella podamos terminar el nivel
User prompt
que hayan muchas mas pastafrolas, hay lugares donde no podemos movernos no me gustan... elimina eso.
User prompt
porque no puedo pasar por ciertas zonas? quiero que el tamaño del laberinto se reduzca y que se vea mas abajo, asi dejamos la zona de la pantalla arriba para los textos y que sea marron el fondo pero que los textos sean blancos.
User prompt
el boton de pausa esta evitando que de click donde quiero... por lo que quiero que el lado de arriba de la pantalla sea para los textos de arriba como el de pastafrolas colectadas tambien panteras y el boton de pausa
User prompt
en el lugar donde ya no podemos pasar que se muestre de color morado, no cualquier zona, y que en esas zonas hayan pastafrolas, porque si no no podremos derrotar a los enemigos y desbloquear el camino a la siguiente zona.
User prompt
que las barreras invisibles por las que no podemos pasar sean de color morado, en cambio las barreras del laberinto sean del color que eran antes, Y QUE EL BOTON DE PAUSA ESTE ABAJO
User prompt
que las barreras sean de color morados para poder verlas y que al llegar nos muestre un texto que diga que para seguir avanzando debemos derrotar a el enemigo de esa zona, y que el boton de pausa este abajo (porque si no interrumpe al click del mouse al intentar pasar por ciertas zonas)
User prompt
que no podamos atravezar las barreras del laberinto, ademas que nuestro lugar para avanzar sea limitado y solo podamos avanzar mas cuando derrotemos a los enemigos
User prompt
Generate the first version of the source code of my game: Mouse Maze Adventure.
User prompt
Mouse Maze Adventure
Initial prompt
juego 2d de plataformas estilo mario, sobre un personaje el cual es un raton, este tiene que llegar a la puerta final, para eso tiene que caminar sobre un mapa (para llegar a un lugar tienes que hacerlo dando un click en ese lugar), tiene que recoger 10 objetos en el mapa,para recogerlos tienes que llegar al lugar donde estan, tienes que ir hacia donde esta cada uno y recogerlo, al llegar a uno de esos objetos que les diremos "pastafrola" tienes que pasar sobre ellos y asi los recolectaremos (apareceran en lugaresaleatorios del mapa) , el mapa es un laberinto donde nos encontraremos a los enemigos: los "panteras" cuando te los encuentres tienes que enfrentarte lanzandole las pastafrolas que anteriormente encontraste (dando click en el enemigo, asi se muestra una animacion de la pastafrola siendo lanzada hacia el mismo) , cuando los derrotes (tienen 100% de vida, cada pastafrola quita un 20% de vida) las pastafrolas apareceran cada una en un lugar random del mapa explorable (solo apareceran en donde podamos caminar, no sobre ningun lugar del laberinto donde no podamos acceder) en el laberinto abran 6 panteras (enemigos) en total, y al recolectar las 10 pastafrolas podremos abrir la puerta que da final al nivel, cuando lleguemos a la puerta el nivel termina y nos mostrara una pantalla de: "GANASTE"
/**** * Classes ****/ var Door = Container.expand(function () { var self = Container.call(this); var doorGraphics = self.attachAsset('door', { anchorX: 0.5, anchorY: 0.5 }); self.locked = true; self.update = function () { if (self.locked && pastafrolarCollas >= 10) { self.locked = false; doorGraphics.tint = 0x90EE90; // Light green when unlocked } if (!self.locked && self.intersects(mouse)) { LK.showYouWin(); } }; return self; }); // Game constants var Mouse = Container.expand(function () { var self = Container.call(this); var mouseGraphics = self.attachAsset('mouse', { anchorX: 0.5, anchorY: 0.5 }); self.isMoving = false; self.targetX = 0; self.targetY = 0; self.speed = 8; self.pastafrolas = 0; self.moveTo = function (x, y) { if (isWalkable(Math.floor(x / CELL_SIZE), Math.floor(y / CELL_SIZE))) { self.targetX = x; self.targetY = y; self.isMoving = true; } }; self.update = function () { if (self.isMoving) { var dx = self.targetX - self.x; var dy = self.targetY - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < self.speed) { self.x = self.targetX; self.y = self.targetY; self.isMoving = false; } else { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } } }; return self; }); var Pantera = Container.expand(function () { var self = Container.call(this); var panteraGraphics = self.attachAsset('pantera', { anchorX: 0.5, anchorY: 0.5 }); self.health = 100; self.maxHealth = 100; self.defeated = false; self.takeDamage = function (damage) { if (!self.defeated) { self.health -= damage; LK.getSound('hit').play(); if (self.health <= 0) { self.health = 0; self.defeated = true; self.visible = false; panterasDefeated++; // Spawn new pastafrola when pantera is defeated spawnPastafrola(); } // Visual feedback LK.effects.flashObject(self, 0xFF0000, 300); } }; self.down = function (x, y, obj) { if (!self.defeated && mouse.pastafrolas > 0) { mouse.pastafrolas--; self.takeDamage(20); LK.getSound('attack').play(); updateUI(); } }; return self; }); var Pastafrola = Container.expand(function () { var self = Container.call(this); var pastaGraphics = self.attachAsset('pastafrola', { anchorX: 0.5, anchorY: 0.5 }); self.collected = false; self.update = function () { if (!self.collected && self.intersects(mouse)) { self.collected = true; mouse.pastafrolas++; pastafrolarCollas++; LK.getSound('collect').play(); self.visible = false; updateUI(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2F4F2F }); /**** * Game Code ****/ // Game constants var CELL_SIZE = 100; var MAZE_WIDTH = 20; var MAZE_HEIGHT = 27; // Game variables var mouse; var door; var pastafrolas = []; var panteras = []; var pastafrolarCollas = 0; var panterasDefeated = 0; // UI elements var pastafrolarText; var instructionText; // Simple maze layout (1 = wall, 0 = walkable) var mazeData = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]; function isWalkable(gridX, gridY) { if (gridX < 0 || gridX >= MAZE_WIDTH || gridY < 0 || gridY >= MAZE_HEIGHT) { return false; } return mazeData[gridY][gridX] === 0; } function getRandomWalkablePosition() { var attempts = 0; while (attempts < 100) { var x = Math.floor(Math.random() * MAZE_WIDTH); var y = Math.floor(Math.random() * MAZE_HEIGHT); if (isWalkable(x, y)) { return { x: x * CELL_SIZE + CELL_SIZE / 2, y: y * CELL_SIZE + CELL_SIZE / 2 }; } attempts++; } return { x: 150, y: 150 }; // Fallback position } function spawnPastafrola() { var position = getRandomWalkablePosition(); var pastafrola = new Pastafrola(); pastafrola.x = position.x; pastafrola.y = position.y; pastafrolas.push(pastafrola); game.addChild(pastafrola); } function updateUI() { pastafrolarText.setText('Pastafrolas: ' + mouse.pastafrolas + ' | Collected: ' + pastafrolarCollas + '/10'); if (pastafrolarCollas >= 10) { instructionText.setText('All pastafrolas collected! Head to the green door!'); } else { instructionText.setText('Click to move. Collect pastafrolas and defeat panteras!'); } } // Build the maze for (var y = 0; y < MAZE_HEIGHT; y++) { for (var x = 0; x < MAZE_WIDTH; x++) { if (mazeData[y][x] === 1) { var wall = LK.getAsset('wall', { anchorX: 0.5, anchorY: 0.5, x: x * CELL_SIZE + CELL_SIZE / 2, y: y * CELL_SIZE + CELL_SIZE / 2 }); game.addChild(wall); } else { var floor = LK.getAsset('floor', { anchorX: 0.5, anchorY: 0.5, x: x * CELL_SIZE + CELL_SIZE / 2, y: y * CELL_SIZE + CELL_SIZE / 2 }); game.addChild(floor); } } } // Create mouse mouse = new Mouse(); mouse.x = 150; mouse.y = 150; game.addChild(mouse); // Create door at the bottom right door = new Door(); door.x = 18 * CELL_SIZE + CELL_SIZE / 2; door.y = 25 * CELL_SIZE + CELL_SIZE / 2; game.addChild(door); // Spawn initial pastafrolas for (var i = 0; i < 5; i++) { spawnPastafrola(); } // Spawn 6 panteras in strategic positions var panteraPositions = [{ x: 5, y: 5 }, { x: 15, y: 8 }, { x: 8, y: 12 }, { x: 12, y: 18 }, { x: 6, y: 22 }, { x: 16, y: 20 }]; for (var i = 0; i < panteraPositions.length; i++) { var pos = panteraPositions[i]; if (isWalkable(pos.x, pos.y)) { var pantera = new Pantera(); pantera.x = pos.x * CELL_SIZE + CELL_SIZE / 2; pantera.y = pos.y * CELL_SIZE + CELL_SIZE / 2; panteras.push(pantera); game.addChild(pantera); } } // Setup UI pastafrolarText = new Text2('Pastafrolas: 0 | Collected: 0/10', { size: 60, fill: 0xFFFFFF }); pastafrolarText.anchor.set(0.5, 0); LK.gui.top.addChild(pastafrolarText); instructionText = new Text2('Click to move. Collect pastafrolas and defeat panteras!', { size: 40, fill: 0xFFFF00 }); instructionText.anchor.set(0.5, 1); LK.gui.bottom.addChild(instructionText); updateUI(); // Game controls game.down = function (x, y, obj) { mouse.moveTo(x, y); }; // Main game loop game.update = function () { // Update mouse mouse.update(); // Update pastafrolas for (var i = 0; i < pastafrolas.length; i++) { pastafrolas[i].update(); } // Update panteras for (var i = 0; i < panteras.length; i++) { if (!panteras[i].defeated) { // Simple AI: panteras don't move but can be clicked for combat } } // Update door door.update(); // Spawn more pastafrolas if needed and not all collected if (pastafrolarCollas < 10 && pastafrolas.filter(function (p) { return !p.collected; }).length < 3) { if (Math.random() < 0.01) { // 1% chance per frame spawnPastafrola(); } } };
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,288 @@
-/****
+/****
+* Classes
+****/
+var Door = Container.expand(function () {
+ var self = Container.call(this);
+ var doorGraphics = self.attachAsset('door', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.locked = true;
+ self.update = function () {
+ if (self.locked && pastafrolarCollas >= 10) {
+ self.locked = false;
+ doorGraphics.tint = 0x90EE90; // Light green when unlocked
+ }
+ if (!self.locked && self.intersects(mouse)) {
+ LK.showYouWin();
+ }
+ };
+ return self;
+});
+// Game constants
+var Mouse = Container.expand(function () {
+ var self = Container.call(this);
+ var mouseGraphics = self.attachAsset('mouse', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.isMoving = false;
+ self.targetX = 0;
+ self.targetY = 0;
+ self.speed = 8;
+ self.pastafrolas = 0;
+ self.moveTo = function (x, y) {
+ if (isWalkable(Math.floor(x / CELL_SIZE), Math.floor(y / CELL_SIZE))) {
+ self.targetX = x;
+ self.targetY = y;
+ self.isMoving = true;
+ }
+ };
+ self.update = function () {
+ if (self.isMoving) {
+ var dx = self.targetX - self.x;
+ var dy = self.targetY - self.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance < self.speed) {
+ self.x = self.targetX;
+ self.y = self.targetY;
+ self.isMoving = false;
+ } else {
+ self.x += dx / distance * self.speed;
+ self.y += dy / distance * self.speed;
+ }
+ }
+ };
+ return self;
+});
+var Pantera = Container.expand(function () {
+ var self = Container.call(this);
+ var panteraGraphics = self.attachAsset('pantera', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.health = 100;
+ self.maxHealth = 100;
+ self.defeated = false;
+ self.takeDamage = function (damage) {
+ if (!self.defeated) {
+ self.health -= damage;
+ LK.getSound('hit').play();
+ if (self.health <= 0) {
+ self.health = 0;
+ self.defeated = true;
+ self.visible = false;
+ panterasDefeated++;
+ // Spawn new pastafrola when pantera is defeated
+ spawnPastafrola();
+ }
+ // Visual feedback
+ LK.effects.flashObject(self, 0xFF0000, 300);
+ }
+ };
+ self.down = function (x, y, obj) {
+ if (!self.defeated && mouse.pastafrolas > 0) {
+ mouse.pastafrolas--;
+ self.takeDamage(20);
+ LK.getSound('attack').play();
+ updateUI();
+ }
+ };
+ return self;
+});
+var Pastafrola = Container.expand(function () {
+ var self = Container.call(this);
+ var pastaGraphics = self.attachAsset('pastafrola', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.collected = false;
+ self.update = function () {
+ if (!self.collected && self.intersects(mouse)) {
+ self.collected = true;
+ mouse.pastafrolas++;
+ pastafrolarCollas++;
+ LK.getSound('collect').play();
+ self.visible = false;
+ updateUI();
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x2F4F2F
+});
+
+/****
+* Game Code
+****/
+// Game constants
+var CELL_SIZE = 100;
+var MAZE_WIDTH = 20;
+var MAZE_HEIGHT = 27;
+// Game variables
+var mouse;
+var door;
+var pastafrolas = [];
+var panteras = [];
+var pastafrolarCollas = 0;
+var panterasDefeated = 0;
+// UI elements
+var pastafrolarText;
+var instructionText;
+// Simple maze layout (1 = wall, 0 = walkable)
+var mazeData = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1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gridY < 0 || gridY >= MAZE_HEIGHT) {
+ return false;
+ }
+ return mazeData[gridY][gridX] === 0;
+}
+function getRandomWalkablePosition() {
+ var attempts = 0;
+ while (attempts < 100) {
+ var x = Math.floor(Math.random() * MAZE_WIDTH);
+ var y = Math.floor(Math.random() * MAZE_HEIGHT);
+ if (isWalkable(x, y)) {
+ return {
+ x: x * CELL_SIZE + CELL_SIZE / 2,
+ y: y * CELL_SIZE + CELL_SIZE / 2
+ };
+ }
+ attempts++;
+ }
+ return {
+ x: 150,
+ y: 150
+ }; // Fallback position
+}
+function spawnPastafrola() {
+ var position = getRandomWalkablePosition();
+ var pastafrola = new Pastafrola();
+ pastafrola.x = position.x;
+ pastafrola.y = position.y;
+ pastafrolas.push(pastafrola);
+ game.addChild(pastafrola);
+}
+function updateUI() {
+ pastafrolarText.setText('Pastafrolas: ' + mouse.pastafrolas + ' | Collected: ' + pastafrolarCollas + '/10');
+ if (pastafrolarCollas >= 10) {
+ instructionText.setText('All pastafrolas collected! Head to the green door!');
+ } else {
+ instructionText.setText('Click to move. Collect pastafrolas and defeat panteras!');
+ }
+}
+// Build the maze
+for (var y = 0; y < MAZE_HEIGHT; y++) {
+ for (var x = 0; x < MAZE_WIDTH; x++) {
+ if (mazeData[y][x] === 1) {
+ var wall = LK.getAsset('wall', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: x * CELL_SIZE + CELL_SIZE / 2,
+ y: y * CELL_SIZE + CELL_SIZE / 2
+ });
+ game.addChild(wall);
+ } else {
+ var floor = LK.getAsset('floor', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: x * CELL_SIZE + CELL_SIZE / 2,
+ y: y * CELL_SIZE + CELL_SIZE / 2
+ });
+ game.addChild(floor);
+ }
+ }
+}
+// Create mouse
+mouse = new Mouse();
+mouse.x = 150;
+mouse.y = 150;
+game.addChild(mouse);
+// Create door at the bottom right
+door = new Door();
+door.x = 18 * CELL_SIZE + CELL_SIZE / 2;
+door.y = 25 * CELL_SIZE + CELL_SIZE / 2;
+game.addChild(door);
+// Spawn initial pastafrolas
+for (var i = 0; i < 5; i++) {
+ spawnPastafrola();
+}
+// Spawn 6 panteras in strategic positions
+var panteraPositions = [{
+ x: 5,
+ y: 5
+}, {
+ x: 15,
+ y: 8
+}, {
+ x: 8,
+ y: 12
+}, {
+ x: 12,
+ y: 18
+}, {
+ x: 6,
+ y: 22
+}, {
+ x: 16,
+ y: 20
+}];
+for (var i = 0; i < panteraPositions.length; i++) {
+ var pos = panteraPositions[i];
+ if (isWalkable(pos.x, pos.y)) {
+ var pantera = new Pantera();
+ pantera.x = pos.x * CELL_SIZE + CELL_SIZE / 2;
+ pantera.y = pos.y * CELL_SIZE + CELL_SIZE / 2;
+ panteras.push(pantera);
+ game.addChild(pantera);
+ }
+}
+// Setup UI
+pastafrolarText = new Text2('Pastafrolas: 0 | Collected: 0/10', {
+ size: 60,
+ fill: 0xFFFFFF
+});
+pastafrolarText.anchor.set(0.5, 0);
+LK.gui.top.addChild(pastafrolarText);
+instructionText = new Text2('Click to move. Collect pastafrolas and defeat panteras!', {
+ size: 40,
+ fill: 0xFFFF00
+});
+instructionText.anchor.set(0.5, 1);
+LK.gui.bottom.addChild(instructionText);
+updateUI();
+// Game controls
+game.down = function (x, y, obj) {
+ mouse.moveTo(x, y);
+};
+// Main game loop
+game.update = function () {
+ // Update mouse
+ mouse.update();
+ // Update pastafrolas
+ for (var i = 0; i < pastafrolas.length; i++) {
+ pastafrolas[i].update();
+ }
+ // Update panteras
+ for (var i = 0; i < panteras.length; i++) {
+ if (!panteras[i].defeated) {
+ // Simple AI: panteras don't move but can be clicked for combat
+ }
+ }
+ // Update door
+ door.update();
+ // Spawn more pastafrolas if needed and not all collected
+ if (pastafrolarCollas < 10 && pastafrolas.filter(function (p) {
+ return !p.collected;
+ }).length < 3) {
+ if (Math.random() < 0.01) {
+ // 1% chance per frame
+ spawnPastafrola();
+ }
+ }
+};
\ No newline at end of file