User prompt
agrega una nueva pelotita la de color negro esta solo aparece cuando la pelotita roja toca a otra roja y añade mas dificultad dependiendo del nivel
User prompt
pierdes cuando apenas tiras una pelotita solo debes de perder cuando se detecte una pelotita fuera del cubo por 3 segundos
User prompt
pierdes cuando apenas tiras una pelotita
User prompt
ahora el nivel terminara cuando el cuadrado se llene de pelotitas y no puedan caber mas y añade mas dificultad dependiendo del nivel
User prompt
quita el temporizador y las pelotitas que te tocara ya no deben de ser aleatoreas deben de aparecer dependiendo de las pelotitas que hay en pantalla para hacer que el jugador se le dificulte
User prompt
ponle fisicas ligeramente exageradas para evitar que las pelotitas se apilen
User prompt
el indicador de las pelotitas deben de mostrarlas pequeñas para evitar que tape toda la pantalla
User prompt
ahora cuando tires pelotitas te aparecera una pelotita diferente un poco aleatoreo y arriba ala derecha te indicara la siguiente pelotita que te tocara y en medio de la parte de arriba te indicara la pelotita que tienes
User prompt
la pelotita azul debe de ser mas grande y la pelotita morada debe de ser el doble de grande y agrega una nueva pelotita la roja esta aparece cuando la pelotita morada toca otra morada
User prompt
el selector de nivel no desaparece al seleccionar un nivel
User prompt
te falto el menu principal y la lista de niveles
User prompt
te falto el menu principal
Code edit (1 edits merged)
Please save this source code
User prompt
Color Merge Drop
Initial prompt
creemos un jurgo simple y el juego trata de dejar caer pelotitas de colores cada pelota tendra un color diferente y al tocar una pelotita del mismo color se transformara en otra ligeramente mas grande un ejemplo cuando la pelotita verde toca a otra verde las dos se eliminan y crean una pelotita azul un poco mas grande y la pelotita azul al tocar otra azul se volvera uno morado y sera un poco mas grande y la pelotita morada al tocar a otra morada simplemente desaparecera y marcara puntaje en total hay 3 pelotitas y todas tendran gravedad y colisiones y las pelotias donde se dejaran caer seria desde arriba y para que no se salgan de la camara abra una especie de cuadrado que evitara que se salgan y antes de empezar el juego entraras al menu principal en medio estara un boton sin nombre solo color que te dejara entrar ala lista de niveles cada nivel se desbloqueara por cada nivel jugado y en el gameplay estara un contador de puntaje y el tiempo
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Ball = Container.expand(function (color, size) {
var self = Container.call(this);
self.ballColor = color;
self.ballSize = size;
self.velocityX = 0;
self.velocityY = 0;
self.gravity = 1.2;
self.bounce = 0.8;
self.friction = 0.95;
self.merged = false;
var ballAsset;
if (color === 'green') {
ballAsset = self.attachAsset('greenBall', {
anchorX: 0.5,
anchorY: 0.5
});
self.radius = 40;
} else if (color === 'blue') {
ballAsset = self.attachAsset('blueBall', {
anchorX: 0.5,
anchorY: 0.5
});
self.radius = 80;
} else if (color === 'purple') {
ballAsset = self.attachAsset('purpleBall', {
anchorX: 0.5,
anchorY: 0.5
});
self.radius = 160;
} else if (color === 'red') {
ballAsset = self.attachAsset('redBall', {
anchorX: 0.5,
anchorY: 0.5
});
self.radius = 320;
} else if (color === 'black') {
ballAsset = self.attachAsset('blackBall', {
anchorX: 0.5,
anchorY: 0.5
});
self.radius = 640;
}
self.update = function () {
if (self.merged) return;
// Apply gravity
self.velocityY += self.gravity;
// Apply friction
self.velocityX *= self.friction;
self.velocityY *= self.friction;
// Update position
self.x += self.velocityX;
self.y += self.velocityY;
// Floor collision
if (self.y + self.radius > gameFloor) {
self.y = gameFloor - self.radius;
self.velocityY *= -self.bounce;
if (Math.abs(self.velocityY) < 1) {
self.velocityY = 0;
}
}
// Wall collisions
if (self.x - self.radius < gameLeftWall + 20) {
self.x = gameLeftWall + 20 + self.radius;
self.velocityX *= -self.bounce;
}
if (self.x + self.radius > gameRightWall - 20) {
self.x = gameRightWall - 20 - self.radius;
self.velocityX *= -self.bounce;
}
// Check for merges with other balls
for (var i = 0; i < balls.length; i++) {
var otherBall = balls[i];
if (otherBall === self || otherBall.merged) continue;
var dx = self.x - otherBall.x;
var dy = self.y - otherBall.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < self.radius + otherBall.radius) {
// Collision detected
if (self.ballColor === otherBall.ballColor && !self.merging && !otherBall.merging) {
// Same color - merge
self.merging = true;
otherBall.merging = true;
mergeBalls(self, otherBall);
} else {
// Different colors - bounce with enhanced physics
var angle = Math.atan2(dy, dx);
var sin = Math.sin(angle);
var cos = Math.cos(angle);
var vx1 = self.velocityX * cos + self.velocityY * sin;
var vy1 = self.velocityY * cos - self.velocityX * sin;
var vx2 = otherBall.velocityX * cos + otherBall.velocityY * sin;
var vy2 = otherBall.velocityY * cos - otherBall.velocityX * sin;
var finalVx1 = vx2 * 1.2; // Enhanced bounce
var finalVx2 = vx1 * 1.2; // Enhanced bounce
self.velocityX = finalVx1 * cos - vy1 * sin;
self.velocityY = vy1 * cos + finalVx1 * sin;
otherBall.velocityX = finalVx2 * cos - vy2 * sin;
otherBall.velocityY = vy2 * cos + finalVx2 * sin;
// Separate balls with stronger force
var overlap = self.radius + otherBall.radius - distance;
var separationForce = 1.5; // Stronger separation
var moveX = overlap * separationForce * cos;
var moveY = overlap * separationForce * sin;
self.x += moveX;
self.y += moveY;
otherBall.x -= moveX;
otherBall.y -= moveY;
// Add slight repulsion to prevent stacking
var repulsionForce = 0.3;
self.velocityX += repulsionForce * cos;
self.velocityY += repulsionForce * sin;
otherBall.velocityX -= repulsionForce * cos;
otherBall.velocityY -= repulsionForce * sin;
}
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x222222
});
/****
* Game Code
****/
// Game state management
var gameState = 'menu'; // 'menu', 'levelSelect', 'playing'
var balls = [];
var gameLevel = storage.currentLevel || 1;
var maxUnlockedLevel = storage.maxUnlockedLevel || 1;
var gameScore = 0;
var targetScore = gameLevel * 100;
var dropCooldown = 0;
var gameOverThreshold = 300; // Y position where game over occurs
var levelCompleted = false;
var ballsOutsideArea = []; // Track balls outside play area
var gameOverTimer = 0; // Timer for game over condition
var gameOverDelay = 180; // 3 seconds at 60 FPS
var gameLeftWall = 124;
var gameRightWall = 1924;
var gameFloor = 2500;
var ballColors = ['green', 'blue', 'purple', 'red'];
var currentBallColor = ballColors[Math.floor(Math.random() * ballColors.length)];
var nextBallColor = ballColors[Math.floor(Math.random() * ballColors.length)];
// UI containers
var menuContainer = new Container();
var levelSelectContainer = new Container();
var gameContainer = new Container();
var uiContainer = new Container();
// Add containers to game
game.addChild(menuContainer);
game.addChild(levelSelectContainer);
game.addChild(gameContainer);
game.addChild(uiContainer);
// Hide level select and game containers initially
levelSelectContainer.visible = false;
gameContainer.visible = false;
// Create main menu
var menuButton = menuContainer.addChild(LK.getAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5
}));
menuButton.x = 1024;
menuButton.y = 1366;
var menuTitle = new Text2('Color Merge Drop', {
size: 120,
fill: 0xFFFFFF
});
menuTitle.anchor.set(0.5, 0.5);
menuTitle.x = 1024;
menuTitle.y = 800;
menuContainer.addChild(menuTitle);
var menuInstruction = new Text2('Tap to Start', {
size: 60,
fill: 0xAAAAAA
});
menuInstruction.anchor.set(0.5, 0.5);
menuInstruction.x = 1024;
menuInstruction.y = 1600;
menuContainer.addChild(menuInstruction);
// Create game boundaries (moved to game container)
var leftWall = gameContainer.addChild(LK.getAsset('wall', {
anchorX: 0,
anchorY: 0
}));
leftWall.x = gameLeftWall;
leftWall.y = 200;
var rightWall = gameContainer.addChild(LK.getAsset('wall', {
anchorX: 0,
anchorY: 0
}));
rightWall.x = gameRightWall;
rightWall.y = 200;
var floor = gameContainer.addChild(LK.getAsset('floor', {
anchorX: 0,
anchorY: 0
}));
floor.x = gameLeftWall + 20;
floor.y = gameFloor;
// Create drop zone
var dropZone = gameContainer.addChild(LK.getAsset('dropZone', {
anchorX: 0.5,
anchorY: 0
}));
dropZone.x = 1024;
dropZone.y = 100;
// Create level selection screen
var levelSelectTitle = new Text2('Select Level', {
size: 100,
fill: 0xFFFFFF
});
levelSelectTitle.anchor.set(0.5, 0.5);
levelSelectTitle.x = 1024;
levelSelectTitle.y = 400;
levelSelectContainer.addChild(levelSelectTitle);
var levelButtons = [];
var levelsPerRow = 4;
var totalLevels = 12;
var buttonSpacing = 200;
var startX = 1024 - (levelsPerRow - 1) * buttonSpacing / 2;
var startY = 800;
for (var i = 1; i <= totalLevels; i++) {
var row = Math.floor((i - 1) / levelsPerRow);
var col = (i - 1) % levelsPerRow;
var buttonX = startX + col * buttonSpacing;
var buttonY = startY + row * buttonSpacing;
var isUnlocked = i <= maxUnlockedLevel;
var levelButton = levelSelectContainer.addChild(LK.getAsset(isUnlocked ? 'levelButton' : 'lockedButton', {
anchorX: 0.5,
anchorY: 0.5
}));
levelButton.x = buttonX;
levelButton.y = buttonY;
levelButton.levelNumber = i;
levelButton.isUnlocked = isUnlocked;
levelButtons.push(levelButton);
if (isUnlocked) {
var levelLabel = new Text2(i.toString(), {
size: 60,
fill: 0xFFFFFF
});
levelLabel.anchor.set(0.5, 0.5);
levelLabel.x = buttonX;
levelLabel.y = buttonY;
levelSelectContainer.addChild(levelLabel);
}
}
// Back button for level select
var backButton = levelSelectContainer.addChild(LK.getAsset('backButton', {
anchorX: 0.5,
anchorY: 0.5
}));
backButton.x = 200;
backButton.y = 200;
var backLabel = new Text2('Back', {
size: 40,
fill: 0xFFFFFF
});
backLabel.anchor.set(0.5, 0.5);
backLabel.x = 200;
backLabel.y = 200;
levelSelectContainer.addChild(backLabel);
// Create UI (moved to UI container)
var scoreText = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0, 0);
LK.gui.topLeft.addChild(scoreText);
scoreText.x = 150;
scoreText.y = 50;
var targetText = new Text2('Target: ' + targetScore, {
size: 50,
fill: 0xFFFF00
});
targetText.anchor.set(0, 0);
LK.gui.topLeft.addChild(targetText);
targetText.x = 150;
targetText.y = 120;
var levelText = new Text2('Level ' + gameLevel, {
size: 70,
fill: 0x00FF00
});
levelText.anchor.set(0.5, 0);
LK.gui.top.addChild(levelText);
levelText.y = 50;
// Current ball display
var currentBallDisplay = LK.getAsset('currentBallDisplay', {
anchorX: 0.5,
anchorY: 0.5
});
currentBallDisplay.x = 0;
currentBallDisplay.y = 150;
LK.gui.top.addChild(currentBallDisplay);
// Next ball display
var nextBallDisplay = LK.getAsset('nextBallDisplay', {
anchorX: 0.5,
anchorY: 0.5
});
nextBallDisplay.x = 0;
nextBallDisplay.y = 150;
LK.gui.topRight.addChild(nextBallDisplay);
nextBallDisplay.x = -100;
// Labels for ball displays
var currentBallLabel = new Text2('Current', {
size: 30,
fill: 0xFFFFFF
});
currentBallLabel.anchor.set(0.5, 0.5);
currentBallLabel.x = 0;
currentBallLabel.y = 240;
LK.gui.top.addChild(currentBallLabel);
var nextBallLabel = new Text2('Next', {
size: 30,
fill: 0xFFFFFF
});
nextBallLabel.anchor.set(0.5, 0.5);
nextBallLabel.x = -100;
nextBallLabel.y = 240;
LK.gui.topRight.addChild(nextBallLabel);
function showMenu() {
gameState = 'menu';
menuContainer.visible = true;
levelSelectContainer.visible = false;
gameContainer.visible = false;
// Hide UI elements
scoreText.visible = false;
targetText.visible = false;
levelText.visible = false;
currentBallDisplay.visible = false;
nextBallDisplay.visible = false;
currentBallLabel.visible = false;
nextBallLabel.visible = false;
}
function showLevelSelect() {
gameState = 'levelSelect';
menuContainer.visible = false;
levelSelectContainer.visible = true;
gameContainer.visible = false;
// Update level buttons based on current unlocked levels
maxUnlockedLevel = storage.maxUnlockedLevel || 1;
for (var i = 0; i < levelButtons.length; i++) {
var button = levelButtons[i];
var isUnlocked = button.levelNumber <= maxUnlockedLevel;
button.isUnlocked = isUnlocked;
// Note: We can't change the asset type dynamically, so we'll handle this in the click handler
}
}
function startGame(level) {
gameState = 'playing';
gameLevel = level;
gameScore = 0;
gameStartTime = Date.now();
targetScore = gameLevel * 100;
levelCompleted = false;
gameOverThreshold = 300 - gameLevel * 10; // Gets harder each level
gameOverTimer = 0; // Reset game over timer
ballsOutsideArea = []; // Clear balls outside tracking
// Clear existing balls
for (var i = balls.length - 1; i >= 0; i--) {
balls[i].destroy();
}
balls = [];
// Show game UI
menuContainer.visible = false;
levelSelectContainer.visible = false;
gameContainer.visible = true;
// Show UI elements
scoreText.visible = true;
targetText.visible = true;
levelText.visible = true;
currentBallDisplay.visible = true;
nextBallDisplay.visible = true;
currentBallLabel.visible = true;
nextBallLabel.visible = true;
// Update UI texts
updateScore();
targetText.setText('Target: ' + targetScore);
levelText.setText('Level ' + gameLevel);
// Initialize ball colors for this level
currentBallColor = getStrategicBallColor();
nextBallColor = getStrategicBallColor();
updateBallDisplays();
}
function createBall(x, y, color) {
var ball = new Ball(color);
ball.x = x;
ball.y = y;
// Add random horizontal velocity for more dynamic physics
ball.velocityX = (Math.random() - 0.5) * 4;
ball.velocityY = Math.random() * 2;
balls.push(ball);
gameContainer.addChild(ball);
LK.getSound('drop').play();
return ball;
}
function mergeBalls(ball1, ball2) {
LK.getSound('merge').play();
var mergeX = (ball1.x + ball2.x) / 2;
var mergeY = (ball1.y + ball2.y) / 2;
// Mark balls as merged
ball1.merged = true;
ball2.merged = true;
// Remove from balls array
var index1 = balls.indexOf(ball1);
var index2 = balls.indexOf(ball2);
if (index1 > -1) balls.splice(index1, 1);
if (index2 > -1) balls.splice(index2, 1);
// Remove from display
ball1.destroy();
ball2.destroy();
// Create next color ball or add score
if (ball1.ballColor === 'green') {
var newBall = createBall(mergeX, mergeY, 'blue');
newBall.velocityX = (ball1.velocityX + ball2.velocityX) / 2;
newBall.velocityY = (ball1.velocityY + ball2.velocityY) / 2;
} else if (ball1.ballColor === 'blue') {
var newBall = createBall(mergeX, mergeY, 'purple');
newBall.velocityX = (ball1.velocityX + ball2.velocityX) / 2;
newBall.velocityY = (ball1.velocityY + ball2.velocityY) / 2;
} else if (ball1.ballColor === 'purple') {
var newBall = createBall(mergeX, mergeY, 'red');
newBall.velocityX = (ball1.velocityX + ball2.velocityX) / 2;
newBall.velocityY = (ball1.velocityY + ball2.velocityY) / 2;
} else if (ball1.ballColor === 'red') {
var newBall = createBall(mergeX, mergeY, 'black');
newBall.velocityX = (ball1.velocityX + ball2.velocityX) / 2;
newBall.velocityY = (ball1.velocityY + ball2.velocityY) / 2;
} else if (ball1.ballColor === 'black') {
// Black balls disappear and give high score
gameScore += 200;
LK.getSound('score').play();
LK.effects.flashObject(scoreText, 0xffff00, 500);
}
updateScore();
}
function updateScore() {
scoreText.setText('Score: ' + gameScore);
if (gameScore >= targetScore) {
// Level complete
if (gameLevel >= maxUnlockedLevel) {
maxUnlockedLevel = gameLevel + 1;
storage.maxUnlockedLevel = maxUnlockedLevel;
}
storage.currentLevel = gameLevel + 1;
LK.showYouWin();
}
}
function getStrategicBallColor() {
// Count existing balls by color
var colorCounts = {
green: 0,
blue: 0,
purple: 0,
red: 0,
black: 0
};
for (var i = 0; i < balls.length; i++) {
var ball = balls[i];
if (!ball.merged) {
colorCounts[ball.ballColor]++;
}
}
// Increase difficulty based on level - higher levels have lower thresholds (more difficulty)
var difficultyThreshold = Math.max(1, 3 - Math.floor(gameLevel / 2));
// Find the most common color to make merging harder
var maxCount = 0;
var mostCommonColor = 'green';
for (var color in colorCounts) {
if (colorCounts[color] > maxCount) {
maxCount = colorCounts[color];
mostCommonColor = color;
}
}
// If there are many balls of one color, give a different color to make it harder
if (maxCount >= difficultyThreshold) {
var availableColors = ballColors.filter(function (color) {
return color !== mostCommonColor;
});
if (availableColors.length > 0) {
return availableColors[Math.floor(Math.random() * availableColors.length)];
}
}
// If there are pairs of the same color, give a different color (harder on higher levels)
var pairThreshold = Math.max(1, 3 - Math.floor(gameLevel / 4));
for (var color in colorCounts) {
if (colorCounts[color] >= pairThreshold) {
var availableColors = ballColors.filter(function (c) {
return c !== color;
});
if (availableColors.length > 0) {
return availableColors[Math.floor(Math.random() * availableColors.length)];
}
}
}
// Default to giving the least common color
var minCount = Infinity;
var leastCommonColor = 'green';
for (var color in colorCounts) {
if (colorCounts[color] < minCount) {
minCount = colorCounts[color];
leastCommonColor = color;
}
}
return leastCommonColor;
}
function updateBallDisplays() {
// Update current ball display
currentBallDisplay.removeChildren();
var currentAsset;
if (currentBallColor === 'green') {
currentAsset = LK.getAsset('greenBall', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (currentBallColor === 'blue') {
currentAsset = LK.getAsset('blueBall', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (currentBallColor === 'purple') {
currentAsset = LK.getAsset('purpleBall', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (currentBallColor === 'red') {
currentAsset = LK.getAsset('redBall', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (currentBallColor === 'black') {
currentAsset = LK.getAsset('blackBall', {
anchorX: 0.5,
anchorY: 0.5
});
}
currentAsset.scale.x = 0.3;
currentAsset.scale.y = 0.3;
currentBallDisplay.addChild(currentAsset);
// Update next ball display
nextBallDisplay.removeChildren();
var nextAsset;
if (nextBallColor === 'green') {
nextAsset = LK.getAsset('greenBall', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (nextBallColor === 'blue') {
nextAsset = LK.getAsset('blueBall', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (nextBallColor === 'purple') {
nextAsset = LK.getAsset('purpleBall', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (nextBallColor === 'red') {
nextAsset = LK.getAsset('redBall', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (nextBallColor === 'black') {
nextAsset = LK.getAsset('blackBall', {
anchorX: 0.5,
anchorY: 0.5
});
}
nextAsset.scale.x = 0.25;
nextAsset.scale.y = 0.25;
nextBallDisplay.addChild(nextAsset);
}
// Touch/click handler
game.down = function (x, y, obj) {
if (gameState === 'menu') {
// Check if menu button was clicked
var dx = x - menuButton.x;
var dy = y - menuButton.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 100) {
LK.getSound('button').play();
showLevelSelect();
}
} else if (gameState === 'levelSelect') {
// Check if back button was clicked
var dx = x - backButton.x;
var dy = y - backButton.y;
if (Math.abs(dx) < 60 && Math.abs(dy) < 40) {
LK.getSound('button').play();
showMenu();
return;
}
// Check if level button was clicked
for (var i = 0; i < levelButtons.length; i++) {
var button = levelButtons[i];
var dx = x - button.x;
var dy = y - button.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 75 && button.isUnlocked) {
LK.getSound('button').play();
startGame(button.levelNumber);
return;
}
}
} else if (gameState === 'playing') {
if (dropCooldown > 0) return;
// Drop ball at x position within drop zone
var dropX = Math.max(gameLeftWall + 60, Math.min(gameRightWall - 60, x));
createBall(dropX, 200, currentBallColor);
// Advance to next ball
currentBallColor = nextBallColor;
nextBallColor = getStrategicBallColor();
updateBallDisplays();
dropCooldown = 30; // 0.5 second cooldown
}
};
game.update = function () {
// Only run game logic when playing
if (gameState !== 'playing') return;
// Update cooldown
if (dropCooldown > 0) {
dropCooldown--;
}
// Clean up merged balls
for (var i = balls.length - 1; i >= 0; i--) {
if (balls[i].merged) {
balls.splice(i, 1);
}
}
// Check for balls that fell off screen
for (var i = balls.length - 1; i >= 0; i--) {
if (balls[i].y > 2732) {
balls[i].destroy();
balls.splice(i, 1);
}
}
// Check for balls outside play area (above threshold)
if (!levelCompleted) {
var ballsCurrentlyOutside = [];
for (var i = 0; i < balls.length; i++) {
var ball = balls[i];
if (ball.y - ball.radius <= gameOverThreshold) {
ballsCurrentlyOutside.push(ball);
}
}
// If there are balls outside, start/continue timer
if (ballsCurrentlyOutside.length > 0) {
gameOverTimer++;
if (gameOverTimer >= gameOverDelay) {
// 3 seconds have passed with balls outside play area
levelCompleted = true;
LK.showGameOver();
return;
}
} else {
// No balls outside, reset timer
gameOverTimer = 0;
}
}
};
// Initialize game in menu state
showMenu(); ===================================================================
--- original.js
+++ change.js
@@ -41,8 +41,14 @@
anchorX: 0.5,
anchorY: 0.5
});
self.radius = 320;
+ } else if (color === 'black') {
+ ballAsset = self.attachAsset('blackBall', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.radius = 640;
}
self.update = function () {
if (self.merged) return;
// Apply gravity
@@ -146,9 +152,9 @@
var gameOverDelay = 180; // 3 seconds at 60 FPS
var gameLeftWall = 124;
var gameRightWall = 1924;
var gameFloor = 2500;
-var ballColors = ['green', 'blue', 'purple'];
+var ballColors = ['green', 'blue', 'purple', 'red'];
var currentBallColor = ballColors[Math.floor(Math.random() * ballColors.length)];
var nextBallColor = ballColors[Math.floor(Math.random() * ballColors.length)];
// UI containers
var menuContainer = new Container();
@@ -430,10 +436,14 @@
var newBall = createBall(mergeX, mergeY, 'red');
newBall.velocityX = (ball1.velocityX + ball2.velocityX) / 2;
newBall.velocityY = (ball1.velocityY + ball2.velocityY) / 2;
} else if (ball1.ballColor === 'red') {
- // Red balls disappear and give score
- gameScore += 100;
+ var newBall = createBall(mergeX, mergeY, 'black');
+ newBall.velocityX = (ball1.velocityX + ball2.velocityX) / 2;
+ newBall.velocityY = (ball1.velocityY + ball2.velocityY) / 2;
+ } else if (ball1.ballColor === 'black') {
+ // Black balls disappear and give high score
+ gameScore += 200;
LK.getSound('score').play();
LK.effects.flashObject(scoreText, 0xffff00, 500);
}
updateScore();
@@ -455,18 +465,19 @@
var colorCounts = {
green: 0,
blue: 0,
purple: 0,
- red: 0
+ red: 0,
+ black: 0
};
for (var i = 0; i < balls.length; i++) {
var ball = balls[i];
if (!ball.merged) {
colorCounts[ball.ballColor]++;
}
}
- // Increase difficulty based on level
- var difficultyThreshold = Math.max(2, 4 - Math.floor(gameLevel / 3));
+ // Increase difficulty based on level - higher levels have lower thresholds (more difficulty)
+ var difficultyThreshold = Math.max(1, 3 - Math.floor(gameLevel / 2));
// Find the most common color to make merging harder
var maxCount = 0;
var mostCommonColor = 'green';
for (var color in colorCounts) {
@@ -525,8 +536,18 @@
currentAsset = LK.getAsset('purpleBall', {
anchorX: 0.5,
anchorY: 0.5
});
+ } else if (currentBallColor === 'red') {
+ currentAsset = LK.getAsset('redBall', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ } else if (currentBallColor === 'black') {
+ currentAsset = LK.getAsset('blackBall', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
}
currentAsset.scale.x = 0.3;
currentAsset.scale.y = 0.3;
currentBallDisplay.addChild(currentAsset);
@@ -547,8 +568,18 @@
nextAsset = LK.getAsset('purpleBall', {
anchorX: 0.5,
anchorY: 0.5
});
+ } else if (nextBallColor === 'red') {
+ nextAsset = LK.getAsset('redBall', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ } else if (nextBallColor === 'black') {
+ nextAsset = LK.getAsset('blackBall', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
}
nextAsset.scale.x = 0.25;
nextAsset.scale.y = 0.25;
nextBallDisplay.addChild(nextAsset);
crea la imagen de un circulo azul simple y contorno azul fuerte. In-Game asset. 2d. High contrast. No shadows
crea la imagen de un circulo azul grisaseo simple y contorno azul fuerte.
crea la imagen de un rectangulo verde con borde verde oscuro y en medio que tenga la palabra play. In-Game asset. 2d. High contrast. No shadows
crea un fondo bonito que tenga pelotitas de colores. In-Game asset. 2d. High contrast. No shadows
crea la imagen de una pelotita simple con una carita kawai verde. In-Game asset. 2d. High contrast. No shadows
crea la imagen de una pelotita blanca simple kawai. In-Game asset. 2d. High contrast. No shadows
crea la imagen de una pelotita negra simple kawai y nerviosa. In-Game asset. 2d. High contrast. No shadows
crea la imagen de una pelotita azul kawai con lentes y simple. In-Game asset. 2d. High contrast. No shadows
crea una estrella dorada kawai y simple. In-Game asset. 2d. High contrast. No shadows
crea una estrella kawai deprimida y de color gris simple. In-Game asset. 2d. High contrast. No shadows
crea la imagen de una pelotita morada algo preocupada kawai y simple. In-Game asset. 2d. High contrast. No shadows
crea la imagen de una pelotita roja enojada y kawai simple. In-Game asset. 2d. High contrast. No shadows
crea un paisaje kawai. In-Game asset. 2d. High contrast. No shadows
crea la imagen de un rectangulo azul simple. In-Game asset. 2d. High contrast. No shadows
crea la imagen de un circulo naranja kawai enojada y simple. In-Game asset. 2d. High contrast. No shadows
crea ua pelotita kawai dorada simple y con lentes oscuros. In-Game asset. 2d. High contrast. No shadows
crea un rectangulo rojo que diga salir, simple. In-Game asset. 2d. High contrast. No shadows
crea un rectangulo verde que diga pausar. In-Game asset. 2d. High contrast. No shadows