User prompt
Reduce un poco el tamaño de los diálogos porque se salen de la pantalla, y has que el asset "pinkcraiyon" sea más grande.
User prompt
Haz un menu para el juego donde esté el título: "Strange creatures" Y haya un botón de JUGAR y al presionarlo que se muestre poco a poco el asset "Pinkcraiyon" y que cuando se muestre aparezcan los siguientes diálogos (los cuales para pasar al siguiente diálogo tenemos que hacer CLICK en cualquier lugar de la pantalla, y abajo de todos los diálogos dice: haz CLICK en cualquier lugar para continuar") estos son los diálogos de "Pinkcraiyon": Pinkcraiyon: “Ahhh... qué sorpresa... un pequeño perdido en este lugar sin alma. Mmm... qué olor más extraño tienes... ya sé de dónde vienes.” Pinkcraiyon: “¿Quieres salir, verdad? ¿Quieres encontrar la puerta que te lleve lejos de aquí? Je, je, je... Yo sé dónde está. Sí... yo siempre lo sé.” Pinkcraiyon: “Pero nada es gratis, pequeño. Yo también necesito algo... unas píldoras. Mis dulces, mis tesoros... Las perdí, y sin ellas me siento... vacía. ¿Me ayudarás?” --- Ahora aparece un botón que dice "SI" y solo pasamos al siguiente diálogo cuando presionamos este botón. Después de presionarlo se muestran los siguientes diálogos: Pinkcraiyon: “Eso está mejor... sabía que no me dirías que no, pequeño. Mis píldoras... están dentro de la mansión que se levanta allá... la de cinco pisos que araña el cielo.” Pinkcraiyon: “No tengas miedo... no necesitas recorrerla toda. Mis píldoras están en el primer piso, todas escondidas como pequeños ratones traviesos.” Pinkcraiyon: “Son diez en total. Diez. Ni una menos... ni una más. Cuando las tengas todas... busca la puerta roja. Solo por ahí podrás salir... si es que todavía quieres hacerlo.” Pinkcraiyon: “Ve, pequeño... la mansión te espera. Y yo... yo estaré observando.” Y ahora pasamos al laberinto (que fue el que ya programamos) --- ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
has que las paredes del laberinto sean mas largas
User prompt
que al comenzar el jugador no pueda aparecer en ninguna pared (porque sino no podriamos movernos y no quiero eso) has que la puerta siga en la esquina pero que este adentro del laberinto, y que el mapa (laberinto) llegue hasta la parte de abajo de la pantalla y que las paredes del laberinto sean en forma de "L" para que sean mas similares a las de los laberintos reales
User prompt
aun podemos atravesar las paredes y eso esta mal, NO QUIERO QUE PASEMOS POR LAS PAREDES QUE ACTUAN DE BARRERAS EN EL LABERINTO, ademas asi es practicamente imposible pues las paredes a veces estasn cerradas lo que hace que sea imposible avanzar hasta el final, corrige eso y has que el laberinto sea un poquito mas chico (no mucho) y que la puerta se distinga en algun color.
User prompt
quiero que las paredes del laberinto no puedan ser atravesadas es decir que el jugador no pueda pasar a través de ellasademas que el laberinto y demás cosas en la pantalla estén in poco mas abajo (para que no interfieran con el botón de pausa) y que lo único que se conserve en la parte de arriba sea el contador de "PASTILLAS" y que las paredes del laberinto sean mas extensas es decir mas similares a los laberintos reales, y que en la esquina inferior derecha haya una puerta y despues de juntar las 10 pastillas que tengamos que ir a la ouerta para ahora si terminar el nivel.
Code edit (1 edits merged)
Please save this source code
User prompt
Maze Pill Collector
User prompt
genera una laberinto (pantalla completa) en el cual aparezcamos en la esquina superior izquierda, para movernos debemos clickear con el mouse a donde queremos ir, el laberinto tiene varias paredes que funcionan como barreras (el jugador no puede atravesarlas) que solo podamos avanzar si clickeamos un lugar el cual esta dentro de los limites de movimiento del jugador, básicamente si presionamos una de las paredes/barreras del laberinto no podemos para ahí, que en el mapa haya en lugares aleatorios (en donde podemos ir, no en las paredes del laberinto ya que no podemos acceder a esa zona) items los cuales spawnearan aleatoriamente, y que deberemos pasar por encima de ellos para recolectarlos, arriba de muestra un contador que dice "PASTILLAS" y cada que pasamos por arriba de uno de los objetos que spawnean aleatoriamente en el mapa (les diremos "pastillas") se suma un numero al contador de "PASTILLAS" el cual también muestra el numero __/10 (los __ son la cantidad de "pastillas" que hemos recolectado) y que cuando consigamos las 10 pastillas ganemos.
Initial prompt
este juego sera otra entrega de mi saca de juegos "BLACK SAGA" el primer juego que eh hecho de esta saga fue "BLACK PAINT" y este juego sera el segundo, es un juego narrativo con una jugabilidad interactiva en la cual deberemos escuchar a la personaje: "Pinkcraiyon" y completar las misiones que ella nos vaya dando.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Pill = Container.expand(function () { var self = Container.call(this); var pillGraphics = self.attachAsset('pill', { anchorX: 0.5, anchorY: 0.5 }); self.collected = false; self.collect = function () { if (self.collected) return; self.collected = true; self.visible = false; LK.getSound('collect').play(); }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.targetX = 0; self.targetY = 0; self.isMoving = false; self.moveToTarget = function (targetX, targetY) { if (self.isMoving) return; self.targetX = targetX; self.targetY = targetY; self.isMoving = true; tween(self, { x: targetX, y: targetY }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { self.isMoving = false; } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a1a }); /**** * Game Code ****/ var CELL_SIZE = 64; var MAZE_WIDTH = Math.floor(2048 / CELL_SIZE); var MAZE_HEIGHT = Math.floor(2732 / CELL_SIZE); // Maze generation - more realistic maze pattern var maze = []; for (var y = 0; y < MAZE_HEIGHT; y++) { maze[y] = []; for (var x = 0; x < MAZE_WIDTH; x++) { // Create outer walls if (x === 0 || y === 0 || x === MAZE_WIDTH - 1 || y === MAZE_HEIGHT - 1) { maze[y][x] = 1; // wall } // Create internal maze structure else if (x % 2 === 0 && y % 2 === 0) { maze[y][x] = 1; // wall pillars } // Create wall extensions from pillars else if (x % 2 === 0) { maze[y][x] = Math.random() < 0.7 ? 1 : 0; // vertical walls } else if (y % 2 === 0) { maze[y][x] = Math.random() < 0.7 ? 1 : 0; // horizontal walls } // Create additional random walls for complexity else if (Math.random() < 0.15) { maze[y][x] = 1; // random internal walls } else { maze[y][x] = 0; // floor } } } // Ensure starting position and path is clear maze[1][1] = 0; maze[1][2] = 0; maze[2][1] = 0; maze[2][2] = 0; // Ensure exit area is clear maze[MAZE_HEIGHT - 2][MAZE_WIDTH - 2] = 0; maze[MAZE_HEIGHT - 2][MAZE_WIDTH - 3] = 0; maze[MAZE_HEIGHT - 3][MAZE_WIDTH - 2] = 0; // Create maze visuals var mazeContainer = game.addChild(new Container()); mazeContainer.y = 150; // Move maze down to avoid pause button for (var y = 0; y < MAZE_HEIGHT; y++) { for (var x = 0; x < MAZE_WIDTH; x++) { var cellX = x * CELL_SIZE; var cellY = y * CELL_SIZE; if (maze[y][x] === 1) { // Wall var wall = LK.getAsset('wall', { x: cellX, y: cellY }); mazeContainer.addChild(wall); } else { // Floor var floor = LK.getAsset('floor', { x: cellX, y: cellY }); mazeContainer.addChild(floor); } } } // Create door at bottom-right corner var door = LK.getAsset('door', { x: (MAZE_WIDTH - 2) * CELL_SIZE, y: (MAZE_HEIGHT - 2) * CELL_SIZE + 150, // Adjust for maze container offset anchorX: 0, anchorY: 0 }); mazeContainer.addChild(door); // Create player var player = game.addChild(new Player()); player.x = CELL_SIZE / 2; player.y = CELL_SIZE / 2 + 150; // Adjust for maze container offset // Pills array and counter var pills = []; var pillsCollected = 0; var totalPills = 10; // UI Counter var counterText = new Text2('PASTILLAS 0/10', { size: 80, fill: 0xFFFFFF }); counterText.anchor.set(0.5, 0); LK.gui.top.addChild(counterText); // Function to check if a position is walkable function isWalkable(x, y) { var gridX = Math.floor(x / CELL_SIZE); var gridY = Math.floor(y / CELL_SIZE); if (gridX < 0 || gridX >= MAZE_WIDTH || gridY < 0 || gridY >= MAZE_HEIGHT) { return false; } return maze[gridY][gridX] === 0; } // Function to get random walkable position 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 (maze[y][x] === 0) { return { x: x * CELL_SIZE + CELL_SIZE / 2, y: y * CELL_SIZE + CELL_SIZE / 2 }; } attempts++; } // Fallback to player starting position return { x: CELL_SIZE / 2, y: CELL_SIZE / 2 }; } // Spawn initial pills for (var i = 0; i < totalPills; i++) { var pillPos = getRandomWalkablePosition(); // Make sure pill is not too close to player start while (Math.abs(pillPos.x - CELL_SIZE / 2) < 128 && Math.abs(pillPos.y - CELL_SIZE / 2) < 128) { pillPos = getRandomWalkablePosition(); } var pill = game.addChild(new Pill()); pill.x = pillPos.x; pill.y = pillPos.y + 150; // Adjust for maze container offset pills.push(pill); } // Game click handler game.down = function (x, y, obj) { if (player.isMoving) return; // Adjust for maze container offset var adjustedY = y - 150; // Check if target position is walkable if (isWalkable(x, adjustedY)) { // Snap to grid center var gridX = Math.floor(x / CELL_SIZE); var gridY = Math.floor(adjustedY / CELL_SIZE); var targetX = gridX * CELL_SIZE + CELL_SIZE / 2; var targetY = gridY * CELL_SIZE + CELL_SIZE / 2 + 150; // Add offset back player.moveToTarget(targetX, targetY); } }; // Game update loop game.update = function () { // Check pill collection for (var i = pills.length - 1; i >= 0; i--) { var pill = pills[i]; if (!pill.collected && player.intersects(pill)) { pill.collect(); pillsCollected++; // Update counter counterText.setText('PASTILLAS ' + pillsCollected + '/' + totalPills); // Remove from array pills.splice(i, 1); } } // Check door collision only after collecting all pills if (pillsCollected >= totalPills) { var doorBounds = { x: (MAZE_WIDTH - 2) * CELL_SIZE, y: (MAZE_HEIGHT - 2) * CELL_SIZE + 150, width: CELL_SIZE, height: CELL_SIZE }; if (player.x >= doorBounds.x && player.x <= doorBounds.x + doorBounds.width && player.y >= doorBounds.y && player.y <= doorBounds.y + doorBounds.height) { LK.showYouWin(); return; } } };
===================================================================
--- original.js
+++ change.js
@@ -61,31 +61,47 @@
****/
var CELL_SIZE = 64;
var MAZE_WIDTH = Math.floor(2048 / CELL_SIZE);
var MAZE_HEIGHT = Math.floor(2732 / CELL_SIZE);
-// Maze generation - simple maze pattern
+// Maze generation - more realistic maze pattern
var maze = [];
for (var y = 0; y < MAZE_HEIGHT; y++) {
maze[y] = [];
for (var x = 0; x < MAZE_WIDTH; x++) {
- // Create a maze pattern with corridors
+ // Create outer walls
if (x === 0 || y === 0 || x === MAZE_WIDTH - 1 || y === MAZE_HEIGHT - 1) {
maze[y][x] = 1; // wall
- } else if (x % 4 === 0 && y % 4 === 0) {
- maze[y][x] = 1; // wall
- } else if (x % 4 === 0 || y % 4 === 0) {
- maze[y][x] = Math.random() < 0.3 ? 1 : 0; // random walls in corridors
+ }
+ // Create internal maze structure
+ else if (x % 2 === 0 && y % 2 === 0) {
+ maze[y][x] = 1; // wall pillars
+ }
+ // Create wall extensions from pillars
+ else if (x % 2 === 0) {
+ maze[y][x] = Math.random() < 0.7 ? 1 : 0; // vertical walls
+ } else if (y % 2 === 0) {
+ maze[y][x] = Math.random() < 0.7 ? 1 : 0; // horizontal walls
+ }
+ // Create additional random walls for complexity
+ else if (Math.random() < 0.15) {
+ maze[y][x] = 1; // random internal walls
} else {
maze[y][x] = 0; // floor
}
}
}
-// Ensure starting position is clear
-maze[0][0] = 0;
-maze[0][1] = 0;
-maze[1][0] = 0;
+// Ensure starting position and path is clear
+maze[1][1] = 0;
+maze[1][2] = 0;
+maze[2][1] = 0;
+maze[2][2] = 0;
+// Ensure exit area is clear
+maze[MAZE_HEIGHT - 2][MAZE_WIDTH - 2] = 0;
+maze[MAZE_HEIGHT - 2][MAZE_WIDTH - 3] = 0;
+maze[MAZE_HEIGHT - 3][MAZE_WIDTH - 2] = 0;
// Create maze visuals
var mazeContainer = game.addChild(new Container());
+mazeContainer.y = 150; // Move maze down to avoid pause button
for (var y = 0; y < MAZE_HEIGHT; y++) {
for (var x = 0; x < MAZE_WIDTH; x++) {
var cellX = x * CELL_SIZE;
var cellY = y * CELL_SIZE;
@@ -105,12 +121,21 @@
mazeContainer.addChild(floor);
}
}
}
+// Create door at bottom-right corner
+var door = LK.getAsset('door', {
+ x: (MAZE_WIDTH - 2) * CELL_SIZE,
+ y: (MAZE_HEIGHT - 2) * CELL_SIZE + 150,
+ // Adjust for maze container offset
+ anchorX: 0,
+ anchorY: 0
+});
+mazeContainer.addChild(door);
// Create player
var player = game.addChild(new Player());
player.x = CELL_SIZE / 2;
-player.y = CELL_SIZE / 2;
+player.y = CELL_SIZE / 2 + 150; // Adjust for maze container offset
// Pills array and counter
var pills = [];
var pillsCollected = 0;
var totalPills = 10;
@@ -153,26 +178,28 @@
// Spawn initial pills
for (var i = 0; i < totalPills; i++) {
var pillPos = getRandomWalkablePosition();
// Make sure pill is not too close to player start
- while (Math.abs(pillPos.x - player.x) < 128 && Math.abs(pillPos.y - player.y) < 128) {
+ while (Math.abs(pillPos.x - CELL_SIZE / 2) < 128 && Math.abs(pillPos.y - CELL_SIZE / 2) < 128) {
pillPos = getRandomWalkablePosition();
}
var pill = game.addChild(new Pill());
pill.x = pillPos.x;
- pill.y = pillPos.y;
+ pill.y = pillPos.y + 150; // Adjust for maze container offset
pills.push(pill);
}
// Game click handler
game.down = function (x, y, obj) {
if (player.isMoving) return;
+ // Adjust for maze container offset
+ var adjustedY = y - 150;
// Check if target position is walkable
- if (isWalkable(x, y)) {
+ if (isWalkable(x, adjustedY)) {
// Snap to grid center
var gridX = Math.floor(x / CELL_SIZE);
- var gridY = Math.floor(y / CELL_SIZE);
+ var gridY = Math.floor(adjustedY / CELL_SIZE);
var targetX = gridX * CELL_SIZE + CELL_SIZE / 2;
- var targetY = gridY * CELL_SIZE + CELL_SIZE / 2;
+ var targetY = gridY * CELL_SIZE + CELL_SIZE / 2 + 150; // Add offset back
player.moveToTarget(targetX, targetY);
}
};
// Game update loop
@@ -186,12 +213,20 @@
// Update counter
counterText.setText('PASTILLAS ' + pillsCollected + '/' + totalPills);
// Remove from array
pills.splice(i, 1);
- // Check win condition
- if (pillsCollected >= totalPills) {
- LK.showYouWin();
- return;
- }
}
}
+ // Check door collision only after collecting all pills
+ if (pillsCollected >= totalPills) {
+ var doorBounds = {
+ x: (MAZE_WIDTH - 2) * CELL_SIZE,
+ y: (MAZE_HEIGHT - 2) * CELL_SIZE + 150,
+ width: CELL_SIZE,
+ height: CELL_SIZE
+ };
+ if (player.x >= doorBounds.x && player.x <= doorBounds.x + doorBounds.width && player.y >= doorBounds.y && player.y <= doorBounds.y + doorBounds.height) {
+ LK.showYouWin();
+ return;
+ }
+ }
};
\ No newline at end of file