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 = 0.5;
self.bounce = 0.6;
self.friction = 0.98;
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 = 60;
} else if (color === 'purple') {
ballAsset = self.attachAsset('purpleBall', {
anchorX: 0.5,
anchorY: 0.5
});
self.radius = 80;
}
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
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;
var finalVx2 = vx1;
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
var overlap = self.radius + otherBall.radius - distance;
var moveX = overlap * 0.5 * cos;
var moveY = overlap * 0.5 * sin;
self.x += moveX;
self.y += moveY;
otherBall.x -= moveX;
otherBall.y -= moveY;
}
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x222222
});
/****
* Game Code
****/
var balls = [];
var gameLevel = storage.currentLevel || 1;
var gameScore = 0;
var gameTime = 60000; // 60 seconds
var gameStartTime = Date.now();
var targetScore = gameLevel * 100;
var dropCooldown = 0;
var gameLeftWall = 124;
var gameRightWall = 1924;
var gameFloor = 2500;
var nextBallColor = 'green';
// Create game boundaries
var leftWall = game.addChild(LK.getAsset('wall', {
anchorX: 0,
anchorY: 0
}));
leftWall.x = gameLeftWall;
leftWall.y = 200;
var rightWall = game.addChild(LK.getAsset('wall', {
anchorX: 0,
anchorY: 0
}));
rightWall.x = gameRightWall;
rightWall.y = 200;
var floor = game.addChild(LK.getAsset('floor', {
anchorX: 0,
anchorY: 0
}));
floor.x = gameLeftWall + 20;
floor.y = gameFloor;
// Create drop zone
var dropZone = game.addChild(LK.getAsset('dropZone', {
anchorX: 0.5,
anchorY: 0
}));
dropZone.x = 1024;
dropZone.y = 100;
// Create UI
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 timeText = new Text2('Time: 60', {
size: 60,
fill: 0xFFFFFF
});
timeText.anchor.set(1, 0);
LK.gui.topRight.addChild(timeText);
timeText.x = -50;
timeText.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;
function createBall(x, y, color) {
var ball = new Ball(color);
ball.x = x;
ball.y = y;
balls.push(ball);
game.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') {
// Purple balls disappear and give score
gameScore += 50;
LK.getSound('score').play();
LK.effects.flashObject(scoreText, 0xffff00, 500);
}
updateScore();
}
function updateScore() {
scoreText.setText('Score: ' + gameScore);
if (gameScore >= targetScore) {
// Level complete
storage.currentLevel = gameLevel + 1;
LK.showYouWin();
}
}
function updateTimer() {
var elapsed = Date.now() - gameStartTime;
var remaining = Math.max(0, Math.ceil((gameTime - elapsed) / 1000));
timeText.setText('Time: ' + remaining);
if (remaining <= 0 && gameScore < targetScore) {
LK.showGameOver();
}
}
// Touch/click handler
game.down = function (x, y, obj) {
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, nextBallColor);
dropCooldown = 30; // 0.5 second cooldown
};
game.update = function () {
// Update cooldown
if (dropCooldown > 0) {
dropCooldown--;
}
// Update timer
updateTimer();
// 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);
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,275 @@
-/****
+/****
+* 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 = 0.5;
+ self.bounce = 0.6;
+ self.friction = 0.98;
+ 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 = 60;
+ } else if (color === 'purple') {
+ ballAsset = self.attachAsset('purpleBall', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.radius = 80;
+ }
+ 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
+ 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;
+ var finalVx2 = vx1;
+ 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
+ var overlap = self.radius + otherBall.radius - distance;
+ var moveX = overlap * 0.5 * cos;
+ var moveY = overlap * 0.5 * sin;
+ self.x += moveX;
+ self.y += moveY;
+ otherBall.x -= moveX;
+ otherBall.y -= moveY;
+ }
+ }
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x222222
+});
+
+/****
+* Game Code
+****/
+var balls = [];
+var gameLevel = storage.currentLevel || 1;
+var gameScore = 0;
+var gameTime = 60000; // 60 seconds
+var gameStartTime = Date.now();
+var targetScore = gameLevel * 100;
+var dropCooldown = 0;
+var gameLeftWall = 124;
+var gameRightWall = 1924;
+var gameFloor = 2500;
+var nextBallColor = 'green';
+// Create game boundaries
+var leftWall = game.addChild(LK.getAsset('wall', {
+ anchorX: 0,
+ anchorY: 0
+}));
+leftWall.x = gameLeftWall;
+leftWall.y = 200;
+var rightWall = game.addChild(LK.getAsset('wall', {
+ anchorX: 0,
+ anchorY: 0
+}));
+rightWall.x = gameRightWall;
+rightWall.y = 200;
+var floor = game.addChild(LK.getAsset('floor', {
+ anchorX: 0,
+ anchorY: 0
+}));
+floor.x = gameLeftWall + 20;
+floor.y = gameFloor;
+// Create drop zone
+var dropZone = game.addChild(LK.getAsset('dropZone', {
+ anchorX: 0.5,
+ anchorY: 0
+}));
+dropZone.x = 1024;
+dropZone.y = 100;
+// Create UI
+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 timeText = new Text2('Time: 60', {
+ size: 60,
+ fill: 0xFFFFFF
+});
+timeText.anchor.set(1, 0);
+LK.gui.topRight.addChild(timeText);
+timeText.x = -50;
+timeText.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;
+function createBall(x, y, color) {
+ var ball = new Ball(color);
+ ball.x = x;
+ ball.y = y;
+ balls.push(ball);
+ game.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') {
+ // Purple balls disappear and give score
+ gameScore += 50;
+ LK.getSound('score').play();
+ LK.effects.flashObject(scoreText, 0xffff00, 500);
+ }
+ updateScore();
+}
+function updateScore() {
+ scoreText.setText('Score: ' + gameScore);
+ if (gameScore >= targetScore) {
+ // Level complete
+ storage.currentLevel = gameLevel + 1;
+ LK.showYouWin();
+ }
+}
+function updateTimer() {
+ var elapsed = Date.now() - gameStartTime;
+ var remaining = Math.max(0, Math.ceil((gameTime - elapsed) / 1000));
+ timeText.setText('Time: ' + remaining);
+ if (remaining <= 0 && gameScore < targetScore) {
+ LK.showGameOver();
+ }
+}
+// Touch/click handler
+game.down = function (x, y, obj) {
+ 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, nextBallColor);
+ dropCooldown = 30; // 0.5 second cooldown
+};
+game.update = function () {
+ // Update cooldown
+ if (dropCooldown > 0) {
+ dropCooldown--;
+ }
+ // Update timer
+ updateTimer();
+ // 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);
+ }
+ }
+};
\ No newline at end of file
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