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(1800 / CELL_SIZE); // Make maze smaller var MAZE_HEIGHT = Math.floor(2582 / CELL_SIZE); // Reach bottom of screen (2732 - 150 offset) // Simple maze generation that ensures connectivity 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 L-shaped wall patterns for realistic maze structure else if ((x % 6 === 2 || x % 6 === 3) && (y % 6 === 2 || y % 6 === 3) && Math.random() < 0.7) { maze[y][x] = 1; // L-shaped walls } // Add some random walls but keep paths open else if (x % 3 === 0 && y % 3 === 0 && Math.random() < 0.4) { maze[y][x] = 1; // sparse additional walls } else { maze[y][x] = 0; // floor } } } // Ensure starting position and surrounding area is clear (larger area) for (var sy = 1; sy <= 4; sy++) { for (var sx = 1; sx <= 4; sx++) { maze[sy][sx] = 0; } } // Ensure exit area is clear (larger area) for (var ey = MAZE_HEIGHT - 5; ey < MAZE_HEIGHT - 1; ey++) { for (var ex = MAZE_WIDTH - 5; ex < MAZE_WIDTH - 1; ex++) { maze[ey][ex] = 0; } } // Create guaranteed horizontal paths every 6 rows for (var py = 3; py < MAZE_HEIGHT - 1; py += 6) { for (var px = 1; px < MAZE_WIDTH - 1; px++) { maze[py][px] = 0; } } // Create guaranteed vertical paths every 6 columns for (var px = 3; px < MAZE_WIDTH - 1; px += 6) { for (var py = 1; py < MAZE_HEIGHT - 1; py++) { maze[py][px] = 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 inside maze at bottom-right walkable area var door = LK.getAsset('door', { x: (MAZE_WIDTH - 3) * CELL_SIZE, y: (MAZE_HEIGHT - 3) * CELL_SIZE, anchorX: 0, anchorY: 0 }); mazeContainer.addChild(door); // Create player at guaranteed walkable position var player = game.addChild(new Player()); // Find first walkable position starting from top-left var playerStartX = CELL_SIZE + CELL_SIZE / 2; // Grid position 1,1 center var playerStartY = CELL_SIZE + CELL_SIZE / 2; // Grid position 1,1 center player.x = playerStartX; player.y = playerStartY + 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 check if path between two points is clear function hasPathTo(fromX, fromY, toX, toY) { var fromGridX = Math.floor(fromX / CELL_SIZE); var fromGridY = Math.floor(fromY / CELL_SIZE); var toGridX = Math.floor(toX / CELL_SIZE); var toGridY = Math.floor(toY / CELL_SIZE); // Simple line-of-sight check var dx = Math.abs(toGridX - fromGridX); var dy = Math.abs(toGridY - fromGridY); var stepX = fromGridX < toGridX ? 1 : -1; var stepY = fromGridY < toGridY ? 1 : -1; var err = dx - dy; var currentX = fromGridX; var currentY = fromGridY; while (true) { if (currentX < 0 || currentX >= MAZE_WIDTH || currentY < 0 || currentY >= MAZE_HEIGHT) { return false; } if (maze[currentY][currentX] === 1) { return false; } if (currentX === toGridX && currentY === toGridY) { return true; } var e2 = 2 * err; if (e2 > -dy) { err -= dy; currentX += stepX; } if (e2 < dx) { err += dx; currentY += stepY; } } } // 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; var adjustedPlayerY = player.y - 150; // Check if target position is walkable and path is clear if (isWalkable(x, adjustedY) && hasPathTo(player.x, adjustedPlayerY, 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 - 3) * CELL_SIZE, y: (MAZE_HEIGHT - 3) * 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
@@ -60,9 +60,9 @@
* Game Code
****/
var CELL_SIZE = 64;
var MAZE_WIDTH = Math.floor(1800 / CELL_SIZE); // Make maze smaller
-var MAZE_HEIGHT = Math.floor(2200 / CELL_SIZE); // Make maze smaller
+var MAZE_HEIGHT = Math.floor(2582 / CELL_SIZE); // Reach bottom of screen (2732 - 150 offset)
// Simple maze generation that ensures connectivity
var maze = [];
for (var y = 0; y < MAZE_HEIGHT; y++) {
maze[y] = [];
@@ -70,40 +70,41 @@
// Create outer walls
if (x === 0 || y === 0 || x === MAZE_WIDTH - 1 || y === MAZE_HEIGHT - 1) {
maze[y][x] = 1; // wall
}
- // Create simple internal maze structure with guaranteed paths
- else if (x % 4 === 2 && y % 4 === 2) {
- maze[y][x] = 1; // wall pillars with more spacing
+ // Create L-shaped wall patterns for realistic maze structure
+ else if ((x % 6 === 2 || x % 6 === 3) && (y % 6 === 2 || y % 6 === 3) && Math.random() < 0.7) {
+ maze[y][x] = 1; // L-shaped walls
}
- // Create occasional walls but ensure paths remain
- else if ((x % 4 === 0 || y % 4 === 0) && Math.random() < 0.3) {
- maze[y][x] = 1; // sparse walls
+ // Add some random walls but keep paths open
+ else if (x % 3 === 0 && y % 3 === 0 && Math.random() < 0.4) {
+ maze[y][x] = 1; // sparse additional walls
} else {
maze[y][x] = 0; // floor
}
}
}
-// Ensure starting position and surrounding area is clear
-for (var sy = 1; sy <= 3; sy++) {
- for (var sx = 1; sx <= 3; sx++) {
+// Ensure starting position and surrounding area is clear (larger area)
+for (var sy = 1; sy <= 4; sy++) {
+ for (var sx = 1; sx <= 4; sx++) {
maze[sy][sx] = 0;
}
}
-// Ensure exit area is clear
-for (var ey = MAZE_HEIGHT - 4; ey < MAZE_HEIGHT - 1; ey++) {
- for (var ex = MAZE_WIDTH - 4; ex < MAZE_WIDTH - 1; ex++) {
+// Ensure exit area is clear (larger area)
+for (var ey = MAZE_HEIGHT - 5; ey < MAZE_HEIGHT - 1; ey++) {
+ for (var ex = MAZE_WIDTH - 5; ex < MAZE_WIDTH - 1; ex++) {
maze[ey][ex] = 0;
}
}
-// Create clear paths to ensure connectivity
-for (var px = 1; px < MAZE_WIDTH - 1; px += 4) {
- for (var py = 1; py < MAZE_HEIGHT - 1; py++) {
+// Create guaranteed horizontal paths every 6 rows
+for (var py = 3; py < MAZE_HEIGHT - 1; py += 6) {
+ for (var px = 1; px < MAZE_WIDTH - 1; px++) {
maze[py][px] = 0;
}
}
-for (var py = 1; py < MAZE_HEIGHT - 1; py += 4) {
- for (var px = 1; px < MAZE_WIDTH - 1; px++) {
+// Create guaranteed vertical paths every 6 columns
+for (var px = 3; px < MAZE_WIDTH - 1; px += 6) {
+ for (var py = 1; py < MAZE_HEIGHT - 1; py++) {
maze[py][px] = 0;
}
}
// Create maze visuals
@@ -129,21 +130,23 @@
mazeContainer.addChild(floor);
}
}
}
-// Create door at bottom-right corner
+// Create door inside maze at bottom-right walkable area
var door = LK.getAsset('door', {
- x: (MAZE_WIDTH - 2) * CELL_SIZE,
- y: (MAZE_HEIGHT - 2) * CELL_SIZE + 150,
- // Adjust for maze container offset
+ x: (MAZE_WIDTH - 3) * CELL_SIZE,
+ y: (MAZE_HEIGHT - 3) * CELL_SIZE,
anchorX: 0,
anchorY: 0
});
mazeContainer.addChild(door);
-// Create player
+// Create player at guaranteed walkable position
var player = game.addChild(new Player());
-player.x = CELL_SIZE / 2;
-player.y = CELL_SIZE / 2 + 150; // Adjust for maze container offset
+// Find first walkable position starting from top-left
+var playerStartX = CELL_SIZE + CELL_SIZE / 2; // Grid position 1,1 center
+var playerStartY = CELL_SIZE + CELL_SIZE / 2; // Grid position 1,1 center
+player.x = playerStartX;
+player.y = playerStartY + 150; // Adjust for maze container offset
// Pills array and counter
var pills = [];
var pillsCollected = 0;
var totalPills = 10;
@@ -262,10 +265,10 @@
}
// 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,
+ x: (MAZE_WIDTH - 3) * CELL_SIZE,
+ y: (MAZE_HEIGHT - 3) * 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) {