User prompt
Please fix the bug: 'Timeout.tick error: scoreText is not defined' in or related to this line: 'scoreText.setText(currentText + ' / ' + targetText);' Line Number: 659
User prompt
elimina el contador de puntos de experiencia y el temporalizador, cambia de posición el botón de volver al inicio al lado opuesto de donde se encuentra el botón de la música. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
acomoda el contador de puntos en la parte superior derecha, y pon el botón para volver al inicio junto con el de la música, has que el contador este con una barra que este haciendo cada vez mas chica con forme se termina el tiempo. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Separa los modos de dificultad de juego, mantén la cuadricula del tablero donde van las figuras solamente dentro del juego pero que no se sobre pongan por encima al volver al inicio para elegir la dificultad, elimina el contador y mejóralo, has que se mantengan los puntos de experiencia requeridos para completar cada modo de dificultad, mejora el aspecto del contador y reloj. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Mejora la interfaz, genera una mejor presentación, que el contador de puntos y el temporalizador aparezcan solo cuando estas jugando y no al inicio en el lobby, elimina los bugs que tenga el juego y mejora la presentación e interfaz. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
quita el botón de menú y remplázalo por un botón de volver con forma circular y de una flecha en forma de vuelta, para indicar que el jugador podrá volver al inicio y escoger otra categoría de juego de las 3 opciones que tiene. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
arregla el código del botón del menú, has que aparezca solamente cuando estés jugando y que al pulsarlo, te regrese al menú de dificultades e inicio de las rondas de juego, agrega una imagen de fondo para el inicio de la partida con forma de tienda de mascotas, y genera los comandos de efectos de sonido para la cuando se hagan combos de 3 figuras, de 4 figuras y de 5 figuras. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
mejora las interfaces de la programación, has que sea mas fluido, con mejor presentación, y que cada botón y objeto pueda cambiar su Sprite de imagen en el editor de imágenes, has que no tenga fallos al usar las funciones de cada botón y tenga un tiempo de respuesta mas rápido, funcional y eficiente, agrega un botón para encender o apagar la música de fondo del juego, colócalo en la parte inferior izquierda de la pantalla junto con el botón de volver al menú. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Mejora los diseños del fondo del menú, el fondo dentro de los tableros de juego, mejora el diseño de la dificultad, añade un botón para volver al menú principal dentro del juego, añade un diseño para el contador de puntos, que inicie de 0 al 250 mil en el modo EASY, del 0 al 150 mil en el modo MEDIUM y del 0 al 100 mil en el modo HARD, crea un diseño de costal de comida para animales para el contador de puntos que se este llenando con forme mas puntos vas a cumulando hasta llegar al objetivo indicado y una vez que se logre el objetivo o se termine el tiempo se acabe la partida, genera la opción de derrota, solo en el caso de que no se llegue al objetivo de puntos y se termine el tiempo. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Aumenta el tiempo de cada dificultad en donde EASY sea de 5 minutos, MEDIA de 3 minutos y HARD de 2 minutos, todos en cuenta regresiva, y has que si el jugador no llega a la meta de puntos necesaria pierda la partida y tenga que reiniciar, también que de fondo se pueda desbloquear una imagen si se completa el objetivo de puntos requerido y mejora el diseño de los patrones para hacer los combos, que al combinar 3 figuras iguales se vean estrellas, al combinar 4 se vean confeti y al combinar 5 se vean fuegos artificiales. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Pet Store Match
Initial prompt
Puedes crear un juego estilo candy crush pero en lugar de dulces sea una tienda de mascotas, donde se pueda hacer combinaciones al juntar de 3 a 5 figuras iguales, entre mayor sea el numero de figuras juntadas, mayor será la puntuación obtenida, agrega una cuadricula que cambie su forma cada partida, para que sea mas dinámica, interesante y entretenida para el jugador, pon un contador en cuenta regresiva del 5 al 0, genera una barra de puntos donde la calificación máxima sea de 100 mil y la mínima de 10 mil, que cada combo generado al juntar 3 figuras iguales te de 1000 puntos, al juntar 4 te de 3000 mil puntos y al juntar 5 te de 5000 mil puntos, agrega los comandos para que funcionen con el cursor de la computadora al mismo tiempo que en una pantalla táctil, genera la dificultad de menor a mayor para poder seleccionarla y pule y mejora lo que consideres necesario.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var PetTile = Container.expand(function (type, gridX, gridY) {
var self = Container.call(this);
self.type = type;
self.gridX = gridX;
self.gridY = gridY;
self.isSelected = false;
self.isMatched = false;
var tileColors = {
'dog': 0xF4A460,
'cat': 0xFF69B4,
'bird': 0x87CEEB,
'fish': 0x40E0D0,
'hamster': 0xFFDAB9
};
var tileAssets = {
'dog': 'dogTile',
'cat': 'catTile',
'bird': 'birdTile',
'fish': 'fishTile',
'hamster': 'hamsterTile'
};
var tileGraphics = self.attachAsset(tileAssets[type], {
anchorX: 0.5,
anchorY: 0.5
});
self.select = function () {
self.isSelected = true;
tween(tileGraphics, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 200
});
};
self.deselect = function () {
self.isSelected = false;
tween(tileGraphics, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200
});
};
self.markMatched = function () {
self.isMatched = true;
tween(tileGraphics, {
alpha: 0,
scaleX: 0.1,
scaleY: 0.1
}, {
duration: 300,
onFinish: function onFinish() {
self.destroy();
}
});
};
self.down = function (x, y, obj) {
if (!gameStarted || gameOver) return;
if (selectedTile === null) {
selectedTile = self;
self.select();
} else if (selectedTile === self) {
selectedTile.deselect();
selectedTile = null;
} else {
if (areAdjacent(selectedTile, self)) {
swapTiles(selectedTile, self);
}
selectedTile.deselect();
selectedTile = null;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x90EE90
});
/****
* Game Code
****/
var gridWidth = 6;
var gridHeight = 8;
var tileSize = 220;
var grid = [];
var selectedTile = null;
var gameStarted = false;
var gameOver = false;
var timeLeft = 300;
var difficulty = 'easy';
var targetScore = 250000;
var petTypes = ['dog', 'cat', 'bird', 'fish', 'hamster'];
// Pet store background for menu with gradient effect
var menuBackground = LK.getAsset('petStoreBackground', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.9,
tint: 0xE1BEE7
});
menuBackground.x = 2048 / 2;
menuBackground.y = 2732 / 2;
game.addChild(menuBackground);
// Add overlay for better text contrast
var menuOverlay = LK.getAsset('petStoreBackground', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.3,
tint: 0x1A1A2E
});
menuOverlay.x = 2048 / 2;
menuOverlay.y = 2732 / 2;
game.addChild(menuOverlay);
// Menu title with improved styling
var titleText = new Text2('PET STORE MATCH', {
size: 140,
fill: 0xFFD700
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 2732 / 2 - 450;
game.addChild(titleText);
// Add shadow effect to title
var titleShadow = new Text2('PET STORE MATCH', {
size: 140,
fill: 0x333333
});
titleShadow.anchor.set(0.5, 0.5);
titleShadow.x = 2048 / 2 + 5;
titleShadow.y = 2732 / 2 - 445;
titleShadow.alpha = 0.8;
game.addChildAt(titleShadow, game.children.length - 1);
// UI Elements - Enhanced Food Bag Progress Tracker
var foodBagContainer = new Container();
foodBagContainer.x = 280;
foodBagContainer.y = 180;
foodBagContainer.visible = false;
LK.gui.topLeft.addChild(foodBagContainer);
// Food bag background with border
var foodBagBorder = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 1,
scaleX: 2.2,
scaleY: 2.5,
tint: 0x654321
});
foodBagBorder.alpha = 0.9;
foodBagContainer.addChild(foodBagBorder);
var foodBagBg = LK.getAsset('hamsterTile', {
anchorX: 0.5,
anchorY: 1,
scaleX: 1.8,
scaleY: 2.2,
tint: 0x8B4513
});
foodBagBg.alpha = 0.85;
foodBagContainer.addChild(foodBagBg);
var foodBagFill = LK.getAsset('hamsterTile', {
anchorX: 0.5,
anchorY: 1,
scaleX: 1.6,
scaleY: 0,
tint: 0xFFD700
});
foodBagFill.alpha = 0.9;
foodBagContainer.addChild(foodBagFill);
// Enhanced score display with background
var scoreContainer = new Container();
scoreContainer.x = 280;
scoreContainer.y = 250;
scoreContainer.visible = false;
LK.gui.topLeft.addChild(scoreContainer);
var scoreBg = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 0,
scaleX: 3,
scaleY: 1.2,
tint: 0x2C3E50
});
scoreBg.alpha = 0.8;
scoreContainer.addChild(scoreBg);
var scoreText = new Text2('0 / 250k', {
size: 48,
fill: 0xFFD700
});
scoreText.anchor.set(0.5, 0);
scoreContainer.addChild(scoreText);
var progressText = new Text2('GOAL PROGRESS', {
size: 32,
fill: 0xECF0F1
});
progressText.anchor.set(0.5, 0);
progressText.y = 40;
scoreContainer.addChild(progressText);
// Enhanced timer with background
var timerContainer = new Container();
timerContainer.x = -20;
timerContainer.y = 20;
timerContainer.visible = false;
LK.gui.topRight.addChild(timerContainer);
var timerBg = LK.getAsset('gridBackground', {
anchorX: 1,
anchorY: 0,
scaleX: 2.8,
scaleY: 1.3,
tint: 0xE74C3C
});
timerBg.alpha = 0.85;
timerContainer.addChild(timerBg);
var timerText = new Text2('Time: 5:00', {
size: 58,
fill: 0xFFFFFF
});
timerText.anchor.set(1, 0);
timerText.y = 5;
timerContainer.addChild(timerText);
// Enhanced circular back button with arrow
var backToMenuBg = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5,
tint: 0x607D8B
});
backToMenuBg.x = -150;
backToMenuBg.y = 150;
backToMenuBg.visible = false;
LK.gui.topRight.addChild(backToMenuBg);
var backToMenuButton = new Text2('↶', {
size: 80,
fill: 0xFFFFFF
});
backToMenuButton.anchor.set(0.5, 0.5);
backToMenuButton.x = -150;
backToMenuButton.y = 150;
backToMenuButton.visible = false;
LK.gui.topRight.addChild(backToMenuButton);
// Music toggle button
var musicButtonBg = LK.getAsset('gridBackground', {
anchorX: 0,
anchorY: 1,
scaleX: 1.8,
scaleY: 1,
tint: 0x9C27B0
});
musicButtonBg.x = 20;
musicButtonBg.y = -100;
LK.gui.bottomLeft.addChild(musicButtonBg);
var musicToggleButton = new Text2('MUSIC ON', {
size: 48,
fill: 0xFFFFFF
});
musicToggleButton.anchor.set(0, 1);
musicToggleButton.x = 20;
musicToggleButton.y = -110;
LK.gui.bottomLeft.addChild(musicToggleButton);
var musicEnabled = true;
// Enhanced start button with background and shadow
var startButtonBg = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 5,
scaleY: 1.5,
tint: 0x2196F3
});
startButtonBg.x = 2048 / 2;
startButtonBg.y = 2732 / 2 + 180;
game.addChild(startButtonBg);
var startButtonShadow = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 5,
scaleY: 1.5,
tint: 0x0D47A1,
alpha: 0.6
});
startButtonShadow.x = 2048 / 2 + 8;
startButtonShadow.y = 2732 / 2 + 188;
game.addChild(startButtonShadow);
var startButton = new Text2('START GAME', {
size: 120,
fill: 0xFFFFFF
});
startButton.anchor.set(0.5, 0.5);
startButton.x = 2048 / 2;
startButton.y = 2732 / 2 + 180;
game.addChild(startButton);
// Enhanced difficulty buttons with better styling
var easyButtonBg = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 4,
scaleY: 1.2,
tint: 0x4CAF50
});
easyButtonBg.x = 2048 / 2;
easyButtonBg.y = 2732 / 2 - 250;
game.addChild(easyButtonBg);
var easyButtonShadow = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 4,
scaleY: 1.2,
tint: 0x2E7D32,
alpha: 0.6
});
easyButtonShadow.x = 2048 / 2 + 8;
easyButtonShadow.y = 2732 / 2 - 242;
game.addChild(easyButtonShadow);
var easyButton = new Text2('EASY - Goal: 250k (5min)', {
size: 58,
fill: 0xFFFFFF
});
easyButton.anchor.set(0.5, 0.5);
easyButton.x = 2048 / 2;
easyButton.y = 2732 / 2 - 250;
game.addChild(easyButton);
var mediumButtonBg = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 4,
scaleY: 1.2,
tint: 0xFF9800
});
mediumButtonBg.x = 2048 / 2;
mediumButtonBg.y = 2732 / 2 - 120;
game.addChild(mediumButtonBg);
var mediumButtonShadow = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 4,
scaleY: 1.2,
tint: 0xE65100,
alpha: 0.6
});
mediumButtonShadow.x = 2048 / 2 + 8;
mediumButtonShadow.y = 2732 / 2 - 112;
game.addChild(mediumButtonShadow);
var mediumButton = new Text2('MEDIUM - Goal: 150k (3min)', {
size: 58,
fill: 0xFFFFFF
});
mediumButton.anchor.set(0.5, 0.5);
mediumButton.x = 2048 / 2;
mediumButton.y = 2732 / 2 - 120;
game.addChild(mediumButton);
var hardButtonBg = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 4,
scaleY: 1.2,
tint: 0xF44336
});
hardButtonBg.x = 2048 / 2;
hardButtonBg.y = 2732 / 2 + 10;
game.addChild(hardButtonBg);
var hardButtonShadow = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 4,
scaleY: 1.2,
tint: 0xC62828,
alpha: 0.6
});
hardButtonShadow.x = 2048 / 2 + 8;
hardButtonShadow.y = 2732 / 2 + 18;
game.addChild(hardButtonShadow);
var hardButton = new Text2('HARD - Goal: 100k (2min)', {
size: 58,
fill: 0xFFFFFF
});
hardButton.anchor.set(0.5, 0.5);
hardButton.x = 2048 / 2;
hardButton.y = 2732 / 2 + 10;
game.addChild(hardButton);
// Game timer
var gameTimer = null;
var gridBackgroundTiles = [];
function clearGrid() {
// Clear existing grid tiles
for (var i = 0; i < grid.length; i++) {
for (var j = 0; j < grid[i].length; j++) {
if (grid[i][j]) {
grid[i][j].destroy();
}
}
}
grid = [];
// Clear grid background tiles
for (var i = 0; i < gridBackgroundTiles.length; i++) {
if (gridBackgroundTiles[i]) {
gridBackgroundTiles[i].destroy();
}
}
gridBackgroundTiles = [];
}
function initializeGrid() {
clearGrid();
// Random grid layout
var layouts = [{
width: 6,
height: 8
}, {
width: 7,
height: 7
}, {
width: 8,
height: 6
}];
var layout = layouts[Math.floor(Math.random() * layouts.length)];
gridWidth = layout.width;
gridHeight = layout.height;
// Initialize grid array
for (var i = 0; i < gridWidth; i++) {
grid[i] = [];
for (var j = 0; j < gridHeight; j++) {
grid[i][j] = null;
}
}
// Calculate grid position to center it
var gridPixelWidth = gridWidth * tileSize;
var gridPixelHeight = gridHeight * tileSize;
var startX = (2048 - gridPixelWidth) / 2 + tileSize / 2;
var startY = (2732 - gridPixelHeight) / 2 + tileSize / 2;
// Create background tiles only when game starts
for (var i = 0; i < gridWidth; i++) {
for (var j = 0; j < gridHeight; j++) {
var bg = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 0.5
});
bg.x = startX + i * tileSize;
bg.y = startY + j * tileSize;
bg.alpha = 0.8;
gridBackgroundTiles.push(bg);
game.addChild(bg);
}
}
// Fill grid with random tiles
fillGrid();
}
function fillGrid() {
var gridPixelWidth = gridWidth * tileSize;
var gridPixelHeight = gridHeight * tileSize;
var startX = (2048 - gridPixelWidth) / 2 + tileSize / 2;
var startY = (2732 - gridPixelHeight) / 2 + tileSize / 2;
for (var i = 0; i < gridWidth; i++) {
for (var j = 0; j < gridHeight; j++) {
if (grid[i][j] === null) {
var type = getRandomPetType(i, j);
var tile = new PetTile(type, i, j);
tile.x = startX + i * tileSize;
tile.y = startY + j * tileSize;
grid[i][j] = tile;
game.addChild(tile);
}
}
}
}
function getRandomPetType(x, y) {
var attempts = 0;
var type;
do {
type = petTypes[Math.floor(Math.random() * petTypes.length)];
attempts++;
} while (attempts < 10 && wouldCreateMatch(x, y, type));
return type;
}
function wouldCreateMatch(x, y, type) {
// Check horizontal
var horizontalCount = 1;
// Check left
for (var i = x - 1; i >= 0 && grid[i][y] && grid[i][y].type === type; i--) {
horizontalCount++;
}
// Check right
for (var i = x + 1; i < gridWidth && grid[i][y] && grid[i][y].type === type; i++) {
horizontalCount++;
}
// Check vertical
var verticalCount = 1;
// Check up
for (var j = y - 1; j >= 0 && grid[x][j] && grid[x][j].type === type; j--) {
verticalCount++;
}
// Check down
for (var j = y + 1; j < gridHeight && grid[x][j] && grid[x][j].type === type; j++) {
verticalCount++;
}
return horizontalCount >= 3 || verticalCount >= 3;
}
function areAdjacent(tile1, tile2) {
var dx = Math.abs(tile1.gridX - tile2.gridX);
var dy = Math.abs(tile1.gridY - tile2.gridY);
return dx === 1 && dy === 0 || dx === 0 && dy === 1;
}
function swapTiles(tile1, tile2) {
LK.getSound('swap').play();
// Swap grid positions
var tempX = tile1.gridX;
var tempY = tile1.gridY;
tile1.gridX = tile2.gridX;
tile1.gridY = tile2.gridY;
tile2.gridX = tempX;
tile2.gridY = tempY;
// Swap in grid array
grid[tile1.gridX][tile1.gridY] = tile1;
grid[tile2.gridX][tile2.gridY] = tile2;
// Animate swap
var tile1TargetX = tile1.x;
var tile1TargetY = tile1.y;
var tile2TargetX = tile2.x;
var tile2TargetY = tile2.y;
tween(tile1, {
x: tile2TargetX,
y: tile2TargetY
}, {
duration: 300
});
tween(tile2, {
x: tile1TargetX,
y: tile1TargetY
}, {
duration: 300,
onFinish: function onFinish() {
checkForMatches();
}
});
}
function checkForMatches() {
var matches = findMatches();
if (matches.length > 0) {
LK.getSound('match').play();
// Calculate score and create effects based on match size
var matchScore = 0;
for (var i = 0; i < matches.length; i++) {
var matchSize = matches[i].length;
var match = matches[i];
// Calculate center position of match for effects
var centerX = 0;
var centerY = 0;
for (var k = 0; k < match.length; k++) {
centerX += match[k].x;
centerY += match[k].y;
}
centerX /= match.length;
centerY /= match.length;
if (matchSize === 3) {
matchScore += 1000;
LK.getSound('match3').play();
createStarEffect(centerX, centerY);
} else if (matchSize === 4) {
matchScore += 3000;
LK.getSound('match4').play();
createConfettiEffect(centerX, centerY);
} else if (matchSize >= 5) {
matchScore += 5000;
LK.getSound('match5').play();
createFireworkEffect(centerX, centerY);
}
}
LK.setScore(LK.getScore() + matchScore);
updateFoodBagDisplay();
// Mark matched tiles
for (var i = 0; i < matches.length; i++) {
for (var j = 0; j < matches[i].length; j++) {
var tile = matches[i][j];
tile.markMatched();
grid[tile.gridX][tile.gridY] = null;
}
}
// Wait for animation then refill
LK.setTimeout(function () {
dropTiles();
fillGrid();
LK.setTimeout(function () {
checkForMatches();
}, 300);
}, 300);
}
}
function findMatches() {
var matches = [];
var checked = [];
// Initialize checked array
for (var i = 0; i < gridWidth; i++) {
checked[i] = [];
for (var j = 0; j < gridHeight; j++) {
checked[i][j] = false;
}
}
// Find horizontal matches
for (var j = 0; j < gridHeight; j++) {
for (var i = 0; i < gridWidth - 2; i++) {
if (grid[i][j] && grid[i + 1][j] && grid[i + 2][j] && grid[i][j].type === grid[i + 1][j].type && grid[i][j].type === grid[i + 2][j].type) {
var match = [];
var k = i;
while (k < gridWidth && grid[k][j] && grid[k][j].type === grid[i][j].type) {
if (!checked[k][j]) {
match.push(grid[k][j]);
checked[k][j] = true;
}
k++;
}
if (match.length >= 3) {
matches.push(match);
}
}
}
}
// Find vertical matches
for (var i = 0; i < gridWidth; i++) {
for (var j = 0; j < gridHeight - 2; j++) {
if (grid[i][j] && grid[i][j + 1] && grid[i][j + 2] && grid[i][j].type === grid[i][j + 1].type && grid[i][j].type === grid[i][j + 2].type) {
var match = [];
var k = j;
while (k < gridHeight && grid[i][k] && grid[i][k].type === grid[i][j].type) {
if (!checked[i][k]) {
match.push(grid[i][k]);
checked[i][k] = true;
}
k++;
}
if (match.length >= 3) {
matches.push(match);
}
}
}
}
return matches;
}
function dropTiles() {
for (var i = 0; i < gridWidth; i++) {
var writeIndex = gridHeight - 1;
for (var j = gridHeight - 1; j >= 0; j--) {
if (grid[i][j] !== null) {
if (j !== writeIndex) {
grid[i][writeIndex] = grid[i][j];
grid[i][j] = null;
grid[i][writeIndex].gridY = writeIndex;
var gridPixelWidth = gridWidth * tileSize;
var gridPixelHeight = gridHeight * tileSize;
var startX = (2048 - gridPixelWidth) / 2 + tileSize / 2;
var startY = (2732 - gridPixelHeight) / 2 + tileSize / 2;
var targetY = startY + writeIndex * tileSize;
tween(grid[i][writeIndex], {
y: targetY
}, {
duration: 200
});
}
writeIndex--;
}
}
}
}
function formatTime(seconds) {
var minutes = Math.floor(seconds / 60);
var remainingSeconds = seconds % 60;
return minutes + ':' + (remainingSeconds < 10 ? '0' : '') + remainingSeconds;
}
function updateFoodBagDisplay() {
var currentScore = LK.getScore();
var progress = Math.min(currentScore / targetScore, 1);
// Update food bag fill with smooth animation
tween(foodBagFill, {
scaleY: progress * 2.0
}, {
duration: 500,
easing: tween.easeOut
});
// Update score text with better formatting
var targetText = targetScore >= 1000000 ? (targetScore / 1000000).toFixed(1) + 'M' : targetScore >= 1000 ? targetScore / 1000 + 'k' : targetScore;
var currentText = currentScore >= 1000000 ? (currentScore / 1000000).toFixed(1) + 'M' : currentScore >= 1000 ? Math.floor(currentScore / 1000) + 'k' : currentScore;
scoreText.setText(currentText + ' / ' + targetText);
// Enhanced progress indicator with color transitions
if (progress < 0.3) {
foodBagFill.tint = 0xFF4444;
progressText.setText('NEED MORE FOOD!');
progressText.tint = 0xFF6B6B;
} else if (progress < 0.7) {
foodBagFill.tint = 0xFFAA00;
progressText.setText('GETTING THERE!');
progressText.tint = 0xFFD93D;
} else if (progress < 0.95) {
foodBagFill.tint = 0x44FF44;
progressText.setText('ALMOST FULL!');
progressText.tint = 0x6BCF7F;
} else {
foodBagFill.tint = 0x00FF00;
progressText.setText('GOAL ACHIEVED!');
progressText.tint = 0x4ECDC4;
}
// Pulse effect when close to goal
if (progress > 0.9) {
tween(foodBagContainer, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 200,
onFinish: function onFinish() {
tween(foodBagContainer, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200
});
}
});
}
}
function createStarEffect(x, y) {
for (var i = 0; i < 6; i++) {
var star = LK.getAsset('star', {
anchorX: 0.5,
anchorY: 0.5
});
star.x = x + (Math.random() - 0.5) * 200;
star.y = y + (Math.random() - 0.5) * 200;
star.alpha = 0.8;
game.addChild(star);
tween(star, {
scaleX: 2,
scaleY: 2,
alpha: 0,
rotation: Math.PI * 2
}, {
duration: 1000,
easing: tween.easeOut,
onFinish: function onFinish() {
star.destroy();
}
});
}
}
function createConfettiEffect(x, y) {
for (var i = 0; i < 12; i++) {
var confetti = LK.getAsset('confetti', {
anchorX: 0.5,
anchorY: 0.5
});
confetti.x = x + (Math.random() - 0.5) * 300;
confetti.y = y + (Math.random() - 0.5) * 300;
confetti.tint = Math.random() * 0xFFFFFF;
confetti.rotation = Math.random() * Math.PI * 2;
game.addChild(confetti);
tween(confetti, {
scaleX: 1.5,
scaleY: 1.5,
alpha: 0,
y: confetti.y + 400,
rotation: confetti.rotation + Math.PI * 4
}, {
duration: 1500,
easing: tween.easeOut,
onFinish: function onFinish() {
confetti.destroy();
}
});
}
}
function createFireworkEffect(x, y) {
for (var i = 0; i < 20; i++) {
var firework = LK.getAsset('firework', {
anchorX: 0.5,
anchorY: 0.5
});
var angle = i / 20 * Math.PI * 2;
var distance = 300;
firework.x = x;
firework.y = y;
firework.tint = Math.random() * 0xFFFFFF;
firework.scaleX = 0.3;
firework.scaleY = 0.3;
game.addChild(firework);
tween(firework, {
x: x + Math.cos(angle) * distance,
y: y + Math.sin(angle) * distance,
scaleX: 1.2,
scaleY: 1.2,
alpha: 0
}, {
duration: 2000,
easing: tween.easeOut,
onFinish: function onFinish() {
firework.destroy();
}
});
}
}
function startGame() {
gameStarted = true;
gameOver = false;
LK.setScore(0);
// Start background music if enabled
if (musicEnabled) {
LK.playMusic('mascotas');
}
// Animate menu elements disappearing
tween(menuBackground, {
alpha: 0
}, {
duration: 500
});
tween(titleText, {
alpha: 0,
y: 2732 / 2 - 500
}, {
duration: 500
});
// Hide menu elements
startButton.visible = false;
startButtonBg.visible = false;
startButtonShadow.visible = false;
easyButton.visible = false;
mediumButton.visible = false;
hardButton.visible = false;
easyButtonBg.visible = false;
easyButtonShadow.visible = false;
mediumButtonBg.visible = false;
mediumButtonShadow.visible = false;
hardButtonBg.visible = false;
hardButtonShadow.visible = false;
titleText.visible = false;
titleShadow.visible = false;
menuBackground.visible = false;
menuOverlay.visible = false;
// Show game elements with animation
backToMenuButton.visible = true;
backToMenuBg.visible = true;
foodBagContainer.visible = true;
scoreContainer.visible = true;
timerContainer.visible = true;
tween(backToMenuButton, {
alpha: 1
}, {
duration: 500
});
tween(backToMenuBg, {
alpha: 1
}, {
duration: 500
});
// Animate in UI containers
tween(foodBagContainer, {
alpha: 1,
scaleX: 1,
scaleY: 1
}, {
duration: 600,
easing: tween.easeOut
});
tween(scoreContainer, {
alpha: 1,
y: 250
}, {
duration: 600,
easing: tween.easeOut
});
tween(timerContainer, {
alpha: 1,
scaleX: 1,
scaleY: 1
}, {
duration: 600,
easing: tween.easeOut
});
// Add enhanced game background
var gameBackground = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 12,
scaleY: 18,
alpha: 0.15,
tint: 0x2E7D32
});
gameBackground.x = 2048 / 2;
gameBackground.y = 2732 / 2;
game.addChildAt(gameBackground, 0);
initializeGrid();
updateFoodBagDisplay();
// Start timer with smooth countdown
gameTimer = LK.setInterval(function () {
timeLeft--;
timerText.setText('Time: ' + formatTime(timeLeft));
if (timeLeft <= 10 && timeLeft > 0) {
// Flash timer red when time is running out
tween(timerBg, {
tint: 0xFF4444
}, {
duration: 250,
onFinish: function onFinish() {
tween(timerBg, {
tint: 0xE74C3C
}, {
duration: 250
});
}
});
}
if (timeLeft <= 0) {
endGame();
}
}, 1000);
}
// Enhanced back to menu functionality with animations
backToMenuButton.down = function (x, y, obj) {
if (!gameStarted || gameOver) return;
tween(backToMenuBg, {
scaleX: 1.3,
scaleY: 1.3
}, {
duration: 150,
onFinish: function onFinish() {
tween(backToMenuBg, {
scaleX: 1.5,
scaleY: 1.5
}, {
duration: 150
});
}
});
tween(backToMenuButton, {
rotation: -0.5
}, {
duration: 150,
onFinish: function onFinish() {
tween(backToMenuButton, {
rotation: 0
}, {
duration: 150
});
}
});
LK.setTimeout(function () {
gameOver = true;
gameStarted = false;
if (gameTimer) LK.clearInterval(gameTimer);
// Clear the entire game grid and backgrounds
clearGrid();
// Animate menu elements appearing
tween(menuBackground, {
alpha: 0.9
}, {
duration: 500
});
tween(menuOverlay, {
alpha: 0.3
}, {
duration: 500
});
tween(titleText, {
alpha: 1,
y: 2732 / 2 - 450
}, {
duration: 500
});
tween(titleShadow, {
alpha: 0.8,
y: 2732 / 2 - 445
}, {
duration: 500
});
// Show menu elements
startButton.visible = true;
startButtonBg.visible = true;
startButtonShadow.visible = true;
easyButton.visible = true;
mediumButton.visible = true;
hardButton.visible = true;
easyButtonBg.visible = true;
easyButtonShadow.visible = true;
mediumButtonBg.visible = true;
mediumButtonShadow.visible = true;
hardButtonBg.visible = true;
hardButtonShadow.visible = true;
titleText.visible = true;
titleShadow.visible = true;
menuBackground.visible = true;
menuOverlay.visible = true;
// Hide game elements
backToMenuButton.visible = false;
backToMenuBg.visible = false;
// Hide UI containers with animation
tween(foodBagContainer, {
alpha: 0,
scaleX: 0.5,
scaleY: 0.5
}, {
duration: 400,
easing: tween.easeIn,
onFinish: function onFinish() {
foodBagContainer.visible = false;
}
});
tween(scoreContainer, {
alpha: 0,
y: 200
}, {
duration: 400,
easing: tween.easeIn,
onFinish: function onFinish() {
scoreContainer.visible = false;
}
});
tween(timerContainer, {
alpha: 0,
scaleX: 0.8,
scaleY: 0.8
}, {
duration: 400,
easing: tween.easeIn,
onFinish: function onFinish() {
timerContainer.visible = false;
}
});
// Reset game state
LK.setScore(0);
timeLeft = 300;
timerText.setText('Time: ' + formatTime(timeLeft));
updateFoodBagDisplay();
}, 150);
};
function endGame() {
gameOver = true;
LK.clearInterval(gameTimer);
if (LK.getScore() >= targetScore) {
LK.showYouWin();
} else {
LK.showGameOver();
}
}
// Enhanced difficulty button handlers with animations
easyButton.down = function (x, y, obj) {
// Immediate visual feedback
tween(easyButtonBg, {
scaleX: 3.6,
scaleY: 1.0,
tint: 0x66BB6A
}, {
duration: 100
});
tween(easyButton, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
onFinish: function onFinish() {
tween(easyButton, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
tween(easyButtonBg, {
scaleX: 4,
scaleY: 1.2,
tint: 0x4CAF50
}, {
duration: 100
});
}
});
// Faster response time
LK.setTimeout(function () {
difficulty = 'easy';
targetScore = 250000;
timeLeft = 300;
timerText.setText('Time: ' + formatTime(timeLeft));
updateFoodBagDisplay();
startGame();
}, 120);
};
mediumButton.down = function (x, y, obj) {
// Immediate visual feedback
tween(mediumButtonBg, {
scaleX: 3.6,
scaleY: 1.0,
tint: 0xFFB74D
}, {
duration: 100
});
tween(mediumButton, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
onFinish: function onFinish() {
tween(mediumButton, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
tween(mediumButtonBg, {
scaleX: 4,
scaleY: 1.2,
tint: 0xFF9800
}, {
duration: 100
});
}
});
// Faster response time
LK.setTimeout(function () {
difficulty = 'medium';
targetScore = 150000;
timeLeft = 180;
timerText.setText('Time: ' + formatTime(timeLeft));
updateFoodBagDisplay();
startGame();
}, 120);
};
hardButton.down = function (x, y, obj) {
// Immediate visual feedback
tween(hardButtonBg, {
scaleX: 3.6,
scaleY: 1.0,
tint: 0xEF5350
}, {
duration: 100
});
tween(hardButton, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
onFinish: function onFinish() {
tween(hardButton, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
tween(hardButtonBg, {
scaleX: 4,
scaleY: 1.2,
tint: 0xF44336
}, {
duration: 100
});
}
});
// Faster response time
LK.setTimeout(function () {
difficulty = 'hard';
targetScore = 100000;
timeLeft = 120;
timerText.setText('Time: ' + formatTime(timeLeft));
updateFoodBagDisplay();
startGame();
}, 120);
};
startButton.down = function (x, y, obj) {
// Immediate visual feedback
tween(startButtonBg, {
scaleX: 4.6,
scaleY: 1.3,
tint: 0x1976D2
}, {
duration: 100
});
tween(startButton, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
onFinish: function onFinish() {
tween(startButton, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
tween(startButtonBg, {
scaleX: 5,
scaleY: 1.5,
tint: 0x2196F3
}, {
duration: 100
});
}
});
// Faster response time
LK.setTimeout(function () {
startGame();
}, 120);
};
// Music toggle functionality
musicToggleButton.down = function (x, y, obj) {
tween(musicButtonBg, {
scaleX: 1.6,
scaleY: 0.9
}, {
duration: 150,
onFinish: function onFinish() {
tween(musicButtonBg, {
scaleX: 1.8,
scaleY: 1
}, {
duration: 150
});
}
});
if (musicEnabled) {
LK.stopMusic();
musicToggleButton.setText('MUSIC OFF');
musicEnabled = false;
} else {
LK.playMusic('mascotas');
musicToggleButton.setText('MUSIC ON');
musicEnabled = true;
}
};
// Add subtle pulse animations to menu buttons
var pulseTimer = 0;
game.update = function () {
// Game loop runs here
if (!gameStarted && !gameOver) {
pulseTimer += 0.02;
// Pulse effect for buttons
var pulseScale = 1 + Math.sin(pulseTimer) * 0.03;
if (startButton.visible) {
startButton.scaleX = pulseScale;
startButton.scaleY = pulseScale;
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -140,56 +140,92 @@
titleShadow.x = 2048 / 2 + 5;
titleShadow.y = 2732 / 2 - 445;
titleShadow.alpha = 0.8;
game.addChildAt(titleShadow, game.children.length - 1);
-// UI Elements - Food Bag Progress Tracker
+// UI Elements - Enhanced Food Bag Progress Tracker
+var foodBagContainer = new Container();
+foodBagContainer.x = 280;
+foodBagContainer.y = 180;
+foodBagContainer.visible = false;
+LK.gui.topLeft.addChild(foodBagContainer);
+// Food bag background with border
+var foodBagBorder = LK.getAsset('gridBackground', {
+ anchorX: 0.5,
+ anchorY: 1,
+ scaleX: 2.2,
+ scaleY: 2.5,
+ tint: 0x654321
+});
+foodBagBorder.alpha = 0.9;
+foodBagContainer.addChild(foodBagBorder);
var foodBagBg = LK.getAsset('hamsterTile', {
anchorX: 0.5,
anchorY: 1,
- scaleX: 1.5,
- scaleY: 2,
+ scaleX: 1.8,
+ scaleY: 2.2,
tint: 0x8B4513
});
-foodBagBg.x = 300;
-foodBagBg.y = 200;
-foodBagBg.visible = false;
-LK.gui.topLeft.addChild(foodBagBg);
+foodBagBg.alpha = 0.85;
+foodBagContainer.addChild(foodBagBg);
var foodBagFill = LK.getAsset('hamsterTile', {
anchorX: 0.5,
anchorY: 1,
- scaleX: 1.4,
+ scaleX: 1.6,
scaleY: 0,
tint: 0xFFD700
});
-foodBagFill.x = 300;
-foodBagFill.y = 200;
-foodBagFill.visible = false;
-LK.gui.topLeft.addChild(foodBagFill);
+foodBagFill.alpha = 0.9;
+foodBagContainer.addChild(foodBagFill);
+// Enhanced score display with background
+var scoreContainer = new Container();
+scoreContainer.x = 280;
+scoreContainer.y = 250;
+scoreContainer.visible = false;
+LK.gui.topLeft.addChild(scoreContainer);
+var scoreBg = LK.getAsset('gridBackground', {
+ anchorX: 0.5,
+ anchorY: 0,
+ scaleX: 3,
+ scaleY: 1.2,
+ tint: 0x2C3E50
+});
+scoreBg.alpha = 0.8;
+scoreContainer.addChild(scoreBg);
var scoreText = new Text2('0 / 250k', {
- size: 50,
- fill: 0xFFFFFF
+ size: 48,
+ fill: 0xFFD700
});
scoreText.anchor.set(0.5, 0);
-scoreText.x = 300;
-scoreText.y = 220;
-scoreText.visible = false;
-LK.gui.topLeft.addChild(scoreText);
-var progressText = new Text2('Food Bag Progress', {
- size: 35,
- fill: 0xFFFFFF
+scoreContainer.addChild(scoreText);
+var progressText = new Text2('GOAL PROGRESS', {
+ size: 32,
+ fill: 0xECF0F1
});
progressText.anchor.set(0.5, 0);
-progressText.x = 300;
-progressText.y = 250;
-progressText.visible = false;
-LK.gui.topLeft.addChild(progressText);
+progressText.y = 40;
+scoreContainer.addChild(progressText);
+// Enhanced timer with background
+var timerContainer = new Container();
+timerContainer.x = -20;
+timerContainer.y = 20;
+timerContainer.visible = false;
+LK.gui.topRight.addChild(timerContainer);
+var timerBg = LK.getAsset('gridBackground', {
+ anchorX: 1,
+ anchorY: 0,
+ scaleX: 2.8,
+ scaleY: 1.3,
+ tint: 0xE74C3C
+});
+timerBg.alpha = 0.85;
+timerContainer.addChild(timerBg);
var timerText = new Text2('Time: 5:00', {
- size: 60,
+ size: 58,
fill: 0xFFFFFF
});
timerText.anchor.set(1, 0);
-timerText.visible = false;
-LK.gui.topRight.addChild(timerText);
+timerText.y = 5;
+timerContainer.addChild(timerText);
// Enhanced circular back button with arrow
var backToMenuBg = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 0.5,
@@ -349,18 +385,29 @@
hardButton.y = 2732 / 2 + 10;
game.addChild(hardButton);
// Game timer
var gameTimer = null;
-function initializeGrid() {
- // Clear existing grid
+var gridBackgroundTiles = [];
+function clearGrid() {
+ // Clear existing grid tiles
for (var i = 0; i < grid.length; i++) {
for (var j = 0; j < grid[i].length; j++) {
if (grid[i][j]) {
grid[i][j].destroy();
}
}
}
grid = [];
+ // Clear grid background tiles
+ for (var i = 0; i < gridBackgroundTiles.length; i++) {
+ if (gridBackgroundTiles[i]) {
+ gridBackgroundTiles[i].destroy();
+ }
+ }
+ gridBackgroundTiles = [];
+}
+function initializeGrid() {
+ clearGrid();
// Random grid layout
var layouts = [{
width: 6,
height: 8
@@ -385,17 +432,19 @@
var gridPixelWidth = gridWidth * tileSize;
var gridPixelHeight = gridHeight * tileSize;
var startX = (2048 - gridPixelWidth) / 2 + tileSize / 2;
var startY = (2732 - gridPixelHeight) / 2 + tileSize / 2;
- // Create background tiles
+ // Create background tiles only when game starts
for (var i = 0; i < gridWidth; i++) {
for (var j = 0; j < gridHeight; j++) {
var bg = LK.getAsset('gridBackground', {
anchorX: 0.5,
anchorY: 0.5
});
bg.x = startX + i * tileSize;
bg.y = startY + j * tileSize;
+ bg.alpha = 0.8;
+ gridBackgroundTiles.push(bg);
game.addChild(bg);
}
}
// Fill grid with random tiles
@@ -623,27 +672,54 @@
}
function updateFoodBagDisplay() {
var currentScore = LK.getScore();
var progress = Math.min(currentScore / targetScore, 1);
- // Update food bag fill
+ // Update food bag fill with smooth animation
tween(foodBagFill, {
- scaleY: progress * 1.8
+ scaleY: progress * 2.0
}, {
duration: 500,
easing: tween.easeOut
});
- // Update score text
+ // Update score text with better formatting
var targetText = targetScore >= 1000000 ? (targetScore / 1000000).toFixed(1) + 'M' : targetScore >= 1000 ? targetScore / 1000 + 'k' : targetScore;
- var currentText = currentScore >= 1000000 ? (currentScore / 1000000).toFixed(1) + 'M' : currentScore >= 1000 ? currentScore / 1000 + 'k' : currentScore;
+ var currentText = currentScore >= 1000000 ? (currentScore / 1000000).toFixed(1) + 'M' : currentScore >= 1000 ? Math.floor(currentScore / 1000) + 'k' : currentScore;
scoreText.setText(currentText + ' / ' + targetText);
- // Change bag color based on progress
+ // Enhanced progress indicator with color transitions
if (progress < 0.3) {
foodBagFill.tint = 0xFF4444;
+ progressText.setText('NEED MORE FOOD!');
+ progressText.tint = 0xFF6B6B;
} else if (progress < 0.7) {
foodBagFill.tint = 0xFFAA00;
- } else {
+ progressText.setText('GETTING THERE!');
+ progressText.tint = 0xFFD93D;
+ } else if (progress < 0.95) {
foodBagFill.tint = 0x44FF44;
+ progressText.setText('ALMOST FULL!');
+ progressText.tint = 0x6BCF7F;
+ } else {
+ foodBagFill.tint = 0x00FF00;
+ progressText.setText('GOAL ACHIEVED!');
+ progressText.tint = 0x4ECDC4;
}
+ // Pulse effect when close to goal
+ if (progress > 0.9) {
+ tween(foodBagContainer, {
+ scaleX: 1.1,
+ scaleY: 1.1
+ }, {
+ duration: 200,
+ onFinish: function onFinish() {
+ tween(foodBagContainer, {
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 200
+ });
+ }
+ });
+ }
}
function createStarEffect(x, y) {
for (var i = 0; i < 6; i++) {
var star = LK.getAsset('star', {
@@ -758,16 +834,15 @@
hardButtonShadow.visible = false;
titleText.visible = false;
titleShadow.visible = false;
menuBackground.visible = false;
+ menuOverlay.visible = false;
// Show game elements with animation
backToMenuButton.visible = true;
backToMenuBg.visible = true;
- foodBagBg.visible = true;
- foodBagFill.visible = true;
- scoreText.visible = true;
- progressText.visible = true;
- timerText.visible = true;
+ foodBagContainer.visible = true;
+ scoreContainer.visible = true;
+ timerContainer.visible = true;
tween(backToMenuButton, {
alpha: 1
}, {
duration: 500
@@ -776,32 +851,25 @@
alpha: 1
}, {
duration: 500
});
- // Animate in score elements
- tween(foodBagBg, {
+ // Animate in UI containers
+ tween(foodBagContainer, {
alpha: 1,
- scaleX: 1.5,
- scaleY: 2
+ scaleX: 1,
+ scaleY: 1
}, {
duration: 600,
easing: tween.easeOut
});
- tween(scoreText, {
+ tween(scoreContainer, {
alpha: 1,
- y: 220
- }, {
- duration: 600,
- easing: tween.easeOut
- });
- tween(progressText, {
- alpha: 1,
y: 250
}, {
duration: 600,
easing: tween.easeOut
});
- tween(timerText, {
+ tween(timerContainer, {
alpha: 1,
scaleX: 1,
scaleY: 1
}, {
@@ -827,15 +895,15 @@
timeLeft--;
timerText.setText('Time: ' + formatTime(timeLeft));
if (timeLeft <= 10 && timeLeft > 0) {
// Flash timer red when time is running out
- tween(timerText, {
- tint: 0xFF0000
+ tween(timerBg, {
+ tint: 0xFF4444
}, {
duration: 250,
onFinish: function onFinish() {
- tween(timerText, {
- tint: 0xFFFFFF
+ tween(timerBg, {
+ tint: 0xE74C3C
}, {
duration: 250
});
}
@@ -878,14 +946,21 @@
LK.setTimeout(function () {
gameOver = true;
gameStarted = false;
if (gameTimer) LK.clearInterval(gameTimer);
+ // Clear the entire game grid and backgrounds
+ clearGrid();
// Animate menu elements appearing
tween(menuBackground, {
- alpha: 0.8
+ alpha: 0.9
}, {
duration: 500
});
+ tween(menuOverlay, {
+ alpha: 0.3
+ }, {
+ duration: 500
+ });
tween(titleText, {
alpha: 1,
y: 2732 / 2 - 450
}, {
@@ -912,80 +987,45 @@
hardButtonShadow.visible = true;
titleText.visible = true;
titleShadow.visible = true;
menuBackground.visible = true;
+ menuOverlay.visible = true;
// Hide game elements
backToMenuButton.visible = false;
backToMenuBg.visible = false;
- // Hide score elements with animation
- tween(foodBagBg, {
+ // Hide UI containers with animation
+ tween(foodBagContainer, {
alpha: 0,
scaleX: 0.5,
scaleY: 0.5
}, {
duration: 400,
easing: tween.easeIn,
onFinish: function onFinish() {
- foodBagBg.visible = false;
+ foodBagContainer.visible = false;
}
});
- tween(foodBagFill, {
- alpha: 0
- }, {
- duration: 400,
- easing: tween.easeIn,
- onFinish: function onFinish() {
- foodBagFill.visible = false;
- }
- });
- tween(scoreText, {
+ tween(scoreContainer, {
alpha: 0,
y: 200
}, {
duration: 400,
easing: tween.easeIn,
onFinish: function onFinish() {
- scoreText.visible = false;
+ scoreContainer.visible = false;
}
});
- tween(progressText, {
+ tween(timerContainer, {
alpha: 0,
- y: 230
- }, {
- duration: 400,
- easing: tween.easeIn,
- onFinish: function onFinish() {
- progressText.visible = false;
- }
- });
- tween(timerText, {
- alpha: 0,
scaleX: 0.8,
scaleY: 0.8
}, {
duration: 400,
easing: tween.easeIn,
onFinish: function onFinish() {
- timerText.visible = false;
+ timerContainer.visible = false;
}
});
- // Clear grid with animation
- for (var i = 0; i < grid.length; i++) {
- for (var j = 0; j < grid[i].length; j++) {
- if (grid[i][j]) {
- tween(grid[i][j], {
- alpha: 0,
- scaleX: 0,
- scaleY: 0
- }, {
- duration: 300,
- onFinish: function onFinish() {
- if (this.destroy) this.destroy();
- }
- });
- }
- }
- }
// Reset game state
LK.setScore(0);
timeLeft = 300;
timerText.setText('Time: ' + formatTime(timeLeft));
Mantén este estilo de diseño, pero en lugar de ser el rostro de un gato, que sea el de un perico verde de pico amarillo.
Mantén este mismo estilo, pero has que el perro sea de color azul con manchas blancas.
Mejora este diseño de hámster
Crea un patrón de estampado de comida de anímale, como pescado, huesos, semillas, con un color rojo y blanco