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 = 50000;
var petTypes = ['dog', 'cat', 'bird', 'fish', 'hamster'];
// UI Elements
var scoreText = new Text2('Score: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
var timerText = new Text2('Time: 5:00', {
size: 60,
fill: 0xFFFFFF
});
timerText.anchor.set(1, 0);
LK.gui.topRight.addChild(timerText);
var startButton = new Text2('START GAME', {
size: 100,
fill: 0xFFFFFF
});
startButton.anchor.set(0.5, 0.5);
startButton.x = 2048 / 2;
startButton.y = 2732 / 2;
game.addChild(startButton);
// Difficulty buttons
var easyButton = new Text2('EASY (5min)', {
size: 60,
fill: 0x00FF00
});
easyButton.anchor.set(0.5, 0.5);
easyButton.x = 2048 / 2;
easyButton.y = 2732 / 2 - 200;
game.addChild(easyButton);
var mediumButton = new Text2('MEDIUM (3min)', {
size: 60,
fill: 0xFFFF00
});
mediumButton.anchor.set(0.5, 0.5);
mediumButton.x = 2048 / 2;
mediumButton.y = 2732 / 2 - 100;
game.addChild(mediumButton);
var hardButton = new Text2('HARD (2min)', {
size: 60,
fill: 0xFF0000
});
hardButton.anchor.set(0.5, 0.5);
hardButton.x = 2048 / 2;
hardButton.y = 2732 / 2;
game.addChild(hardButton);
// Game timer
var gameTimer = null;
function initializeGrid() {
// Clear existing grid
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 = [];
// 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
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;
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;
createStarEffect(centerX, centerY);
} else if (matchSize === 4) {
matchScore += 3000;
createConfettiEffect(centerX, centerY);
} else if (matchSize >= 5) {
matchScore += 5000;
createFireworkEffect(centerX, centerY);
}
}
LK.setScore(LK.getScore() + matchScore);
scoreText.setText('Score: ' + LK.getScore());
// 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 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);
// Hide menu buttons
startButton.visible = false;
easyButton.visible = false;
mediumButton.visible = false;
hardButton.visible = false;
initializeGrid();
// Start timer
gameTimer = LK.setInterval(function () {
timeLeft--;
timerText.setText('Time: ' + formatTime(timeLeft));
if (timeLeft <= 0) {
endGame();
}
}, 1000);
}
function endGame() {
gameOver = true;
LK.clearInterval(gameTimer);
if (LK.getScore() >= 10000) {
LK.showYouWin();
} else {
LK.showGameOver();
}
}
// Difficulty button handlers
easyButton.down = function (x, y, obj) {
difficulty = 'easy';
timeLeft = 300;
timerText.setText('Time: ' + formatTime(timeLeft));
startGame();
};
mediumButton.down = function (x, y, obj) {
difficulty = 'medium';
timeLeft = 180;
timerText.setText('Time: ' + formatTime(timeLeft));
startGame();
};
hardButton.down = function (x, y, obj) {
difficulty = 'hard';
timeLeft = 120;
timerText.setText('Time: ' + formatTime(timeLeft));
startGame();
};
startButton.down = function (x, y, obj) {
startGame();
};
game.update = function () {
// Game loop runs here
}; ===================================================================
--- original.js
+++ change.js
@@ -97,9 +97,9 @@
var grid = [];
var selectedTile = null;
var gameStarted = false;
var gameOver = false;
-var timeLeft = 60;
+var timeLeft = 300;
var difficulty = 'easy';
var targetScore = 50000;
var petTypes = ['dog', 'cat', 'bird', 'fish', 'hamster'];
// UI Elements
@@ -108,9 +108,9 @@
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
-var timerText = new Text2('Time: 60', {
+var timerText = new Text2('Time: 5:00', {
size: 60,
fill: 0xFFFFFF
});
timerText.anchor.set(1, 0);
@@ -123,25 +123,25 @@
startButton.x = 2048 / 2;
startButton.y = 2732 / 2;
game.addChild(startButton);
// Difficulty buttons
-var easyButton = new Text2('EASY (60s)', {
+var easyButton = new Text2('EASY (5min)', {
size: 60,
fill: 0x00FF00
});
easyButton.anchor.set(0.5, 0.5);
easyButton.x = 2048 / 2;
easyButton.y = 2732 / 2 - 200;
game.addChild(easyButton);
-var mediumButton = new Text2('MEDIUM (45s)', {
+var mediumButton = new Text2('MEDIUM (3min)', {
size: 60,
fill: 0xFFFF00
});
mediumButton.anchor.set(0.5, 0.5);
mediumButton.x = 2048 / 2;
mediumButton.y = 2732 / 2 - 100;
game.addChild(mediumButton);
-var hardButton = new Text2('HARD (30s)', {
+var hardButton = new Text2('HARD (2min)', {
size: 60,
fill: 0xFF0000
});
hardButton.anchor.set(0.5, 0.5);
@@ -292,18 +292,31 @@
function checkForMatches() {
var matches = findMatches();
if (matches.length > 0) {
LK.getSound('match').play();
- // Calculate score based on match size
+ // 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;
+ createStarEffect(centerX, centerY);
} else if (matchSize === 4) {
matchScore += 3000;
+ createConfettiEffect(centerX, centerY);
} else if (matchSize >= 5) {
matchScore += 5000;
+ createFireworkEffect(centerX, centerY);
}
}
LK.setScore(LK.getScore() + matchScore);
scoreText.setText('Score: ' + LK.getScore());
@@ -399,8 +412,92 @@
}
}
}
}
+function formatTime(seconds) {
+ var minutes = Math.floor(seconds / 60);
+ var remainingSeconds = seconds % 60;
+ return minutes + ':' + (remainingSeconds < 10 ? '0' : '') + remainingSeconds;
+}
+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);
@@ -412,40 +509,40 @@
initializeGrid();
// Start timer
gameTimer = LK.setInterval(function () {
timeLeft--;
- timerText.setText('Time: ' + timeLeft);
+ timerText.setText('Time: ' + formatTime(timeLeft));
if (timeLeft <= 0) {
endGame();
}
}, 1000);
}
function endGame() {
gameOver = true;
LK.clearInterval(gameTimer);
- if (LK.getScore() >= 10000 && LK.getScore() <= 100000) {
+ if (LK.getScore() >= 10000) {
LK.showYouWin();
} else {
LK.showGameOver();
}
}
// Difficulty button handlers
easyButton.down = function (x, y, obj) {
difficulty = 'easy';
- timeLeft = 60;
- timerText.setText('Time: ' + timeLeft);
+ timeLeft = 300;
+ timerText.setText('Time: ' + formatTime(timeLeft));
startGame();
};
mediumButton.down = function (x, y, obj) {
difficulty = 'medium';
- timeLeft = 45;
- timerText.setText('Time: ' + timeLeft);
+ timeLeft = 180;
+ timerText.setText('Time: ' + formatTime(timeLeft));
startGame();
};
hardButton.down = function (x, y, obj) {
difficulty = 'hard';
- timeLeft = 30;
- timerText.setText('Time: ' + timeLeft);
+ timeLeft = 120;
+ timerText.setText('Time: ' + formatTime(timeLeft));
startGame();
};
startButton.down = function (x, y, obj) {
startGame();
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