User prompt
Pon musica relajantee
User prompt
Disminuye la probabilidad de la mube amarilla en el nivel cinco y Disminuye aún mas la probabilidad de la nube verde en el nivel cinco también pon nubes rojas y que tengan una frecuencia de aparición parecida a la de la nube amarilla
User prompt
Haz un nivel 5 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
En el modo infinito pon una nube roja que quite vida
User prompt
Haz un sistema de vida
User prompt
Y pon un botón para activar un modo infinito donde pueden aparecer todas las nubes
User prompt
Haz que se pueda acceder al nivel 4 haciendo 600 en el nivel 3 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Haz un nivel 4 con la nube verde y que tenga 1.5 de probabilidad de que salga la nube amarilla comparándolo con el nivel 2 Y un 1.5 de probabilidad de que salga la nube verde comparándolo con el nivel 3 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Haz que en el nivel 3 se genere una nube verde con 2x menos de probabilidad que una nube amarilla pero de 50 puntos
User prompt
Haz un nivel tres que se desbloquee cuando uno llegue a 300 puntos en el nivel 2 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Haz una canción rápida relajante y alegre
User prompt
Haz que se quite el locked en la interfaz del nivel 2 cuando uno lo desbloquee
User prompt
Haz un botón en el que se pueda cambiar de nivel y se pueda cambiar del nivel 1 al nivel 2 pero se debe desbloquear los niveles pasando el nivel anterior ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Haz que se reinicie los puntos cuando uno vaya al nivel 2
User prompt
Haz que cuando uno llegue al nivel 2 el temporizador se reinicie
User prompt
Haz que inmediatamente cuando uno llegue a 250 puntos se vaya a un nivel 2 en el que haya menos probabilidad de que aparezca la nube amarilla
User prompt
Haz que cuando uno toque la nube que tiene el botón de jugar se inicie el juego o cuando uno toque el botón de jugar
User prompt
Haz una interfaz que ponga un boton de jugar
User prompt
Haz un temporizador de un minuto y medio y cuando acabe se acaba el juego poniendo un botón jugar de nuevo ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Haz un sistema de puntuación ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Haz que las nubes amarillas tengan un 2x de menos probabilidad de aparecer
User prompt
Haz unas nubes adicionales con color amarillo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Haz nubes con color amarillo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Haz las nubes mas grandes
User prompt
Haz que las nubes se generen en un lugar donde la bola pueda ir
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Ball = Container.expand(function () {
var self = Container.call(this);
// Attach ball graphics
var ballGraphics = self.attachAsset('ball', {
anchorX: 0.5,
anchorY: 0.5
});
// Physics properties
self.velocityX = 0;
self.velocityY = 0;
self.gravity = 0.3;
self.bounce = 0.8;
// Update physics and bouncing
self.update = function () {
// Apply gravity
self.velocityY += self.gravity;
// Update position
self.x += self.velocityX;
self.y += self.velocityY;
// Bounce off left and right walls
if (self.x <= 40 || self.x >= 2008) {
self.velocityX = -self.velocityX * self.bounce;
self.x = self.x <= 40 ? 40 : 2008;
}
// Define invisible barrier at one-third of screen height
var barrierY = 2732 / 3; // One-third from top
// Bounce off invisible barrier (top third) and bottom wall
if (self.y <= barrierY || self.y >= 2692) {
self.velocityY = -self.velocityY * self.bounce;
self.y = self.y <= barrierY ? barrierY : 2692;
}
// Ensure minimum velocity to keep ball moving
var minVelocity = 2;
if (Math.abs(self.velocityX) < minVelocity && Math.abs(self.velocityY) < minVelocity) {
// Add random velocity if ball is moving too slowly
self.velocityX = (Math.random() - 0.5) * minVelocity * 2;
self.velocityY = Math.random() > 0.5 ? -minVelocity : minVelocity;
}
};
return self;
});
var Cloud = Container.expand(function () {
var self = Container.call(this);
// Attach cloud graphics
var cloudGraphics = self.attachAsset('cloud', {
anchorX: 0.5,
anchorY: 0.5
});
// Movement properties
self.velocityX = (Math.random() - 0.5) * 2; // Random horizontal movement
self.velocityY = 0;
// Update cloud movement
self.update = function () {
// Move cloud
self.x += self.velocityX;
// Wrap around screen horizontally
if (self.x < -150) {
self.x = 2048 + 150;
} else if (self.x > 2048 + 150) {
self.x = -150;
}
};
return self;
});
var YellowCloud = Container.expand(function () {
var self = Container.call(this);
// Attach yellow cloud graphics
var cloudGraphics = self.attachAsset('yellowCloud', {
anchorX: 0.5,
anchorY: 0.5
});
// Movement properties
self.velocityX = (Math.random() - 0.5) * 2; // Random horizontal movement
self.velocityY = 0;
// Update cloud movement
self.update = function () {
// Move cloud
self.x += self.velocityX;
// Wrap around screen horizontally
if (self.x < -150) {
self.x = 2048 + 150;
} else if (self.x > 2048 + 150) {
self.x = -150;
}
};
return self;
});
/****
* Initialize Game
****/
// Create and add the ball to the game
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Create and add the ball to the game
var ball = game.addChild(new Ball());
// Add sun decoration to top-right corner
var sun = game.addChild(LK.getAsset('sun', {
anchorX: 0.5,
anchorY: 0.5
}));
sun.x = 2048 - 150; // Position near right edge
sun.y = 150; // Position near top edge
// Add sun rays around the sun
var sunRays = [];
var numRays = 8;
for (var i = 0; i < numRays; i++) {
var ray = game.addChild(LK.getAsset('sunRay', {
anchorX: 0,
anchorY: 0.5
}));
ray.x = sun.x;
ray.y = sun.y;
ray.rotation = i * Math.PI * 2 / numRays;
sunRays.push(ray);
}
// Position ball at center of screen
ball.x = 2048 / 2;
ball.y = 2732 / 2;
// Initialize scoring system
var currentScore = 0;
var highScore = storage.highScore || 0;
var currentLevel = 1;
// Initialize timer system (90 seconds = 5400 ticks at 60fps)
var gameTimeLeft = 5400; // 90 seconds in ticks
var gameStarted = true;
// Create score display
var scoreText = new Text2('Score: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
// Create high score display
var highScoreText = new Text2('Best: ' + highScore, {
size: 60,
fill: 0xFFFF00
});
highScoreText.anchor.set(0.5, 0);
highScoreText.y = 100;
LK.gui.top.addChild(highScoreText);
// Create timer display
var timerText = new Text2('Time: 1:30', {
size: 70,
fill: 0xFF0000
});
timerText.anchor.set(0.5, 0);
timerText.y = 180;
LK.gui.top.addChild(timerText);
// Create level display
var levelText = new Text2('Level 1', {
size: 60,
fill: 0x00FF00
});
levelText.anchor.set(0.5, 0);
levelText.y = 260;
LK.gui.top.addChild(levelText);
// Function to update score
function updateScore(points) {
currentScore += points;
scoreText.setText('Score: ' + currentScore);
// Check for level transition at 250 points
if (currentLevel === 1 && currentScore >= 250) {
currentLevel = 2;
// Update yellow cloud spawn interval for level 2
yellowCloudSpawnInterval = yellowCloudSpawnIntervalLevel2;
// Reset timer to 90 seconds for level 2
gameTimeLeft = 5400; // Reset to 90 seconds
// Reset score to 0 for level 2
currentScore = 0;
scoreText.setText('Score: 0');
// Flash screen to indicate level change
LK.effects.flashScreen(0xFFD700, 500); // Gold flash for level transition
// Update level display
levelText.setText('Level 2');
levelText.fill = 0xFFD700; // Gold color for level 2
}
// Check and update high score
if (currentScore > highScore) {
highScore = currentScore;
storage.highScore = highScore;
highScoreText.setText('Best: ' + highScore);
// Flash high score text when new record is achieved
tween(highScoreText, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(highScoreText, {
scaleX: 1,
scaleY: 1
}, {
duration: 200,
easing: tween.easeOut
});
}
});
}
}
// Cloud generation and management
var clouds = [];
var yellowClouds = [];
var cloudTimer = 0;
var yellowCloudTimer = 0;
var cloudSpawnInterval = 180; // Spawn cloud every 3 seconds (60fps * 3)
var yellowCloudSpawnInterval = 480; // Spawn yellow cloud every 8 seconds (60fps * 8) - 2x less frequent
var yellowCloudSpawnIntervalLevel2 = 960; // Spawn yellow cloud every 16 seconds in level 2 - 4x less frequent than level 1
// Game update loop
game.update = function () {
// Timer countdown logic
if (gameStarted && gameTimeLeft > 0) {
gameTimeLeft--;
// Update timer display
var minutes = Math.floor(gameTimeLeft / 3600); // 60 ticks per second * 60 seconds per minute
var seconds = Math.floor(gameTimeLeft % 3600 / 60);
var timeString = minutes + ':' + (seconds < 10 ? '0' : '') + seconds;
timerText.setText('Time: ' + timeString);
// Change timer color when time is running low (last 30 seconds)
if (gameTimeLeft <= 1800) {
// 30 seconds
timerText.fill = 0xFF0000; // Red
} else if (gameTimeLeft <= 3600) {
// 1 minute
timerText.fill = 0xFFA500; // Orange
}
}
// End game when timer reaches zero
if (gameTimeLeft <= 0 && gameStarted) {
gameStarted = false;
// Save final score if it's a high score
if (currentScore > highScore) {
storage.highScore = currentScore;
}
// Show game over
LK.showGameOver();
}
// Cloud generation timer
cloudTimer++;
if (cloudTimer >= cloudSpawnInterval) {
cloudTimer = 0;
// Create new cloud at random position
var newCloud = new Cloud();
newCloud.x = Math.random() * 2048;
// Define barrier position (same as in Ball class)
var barrierY = 2732 / 3;
// Spawn clouds only below the barrier where ball can reach
var minY = barrierY + 150; // Add some margin below barrier
var maxY = 2692 - 150; // Add some margin above ground
newCloud.y = Math.random() * (maxY - minY) + minY;
clouds.push(newCloud);
game.addChild(newCloud);
}
// Yellow cloud generation timer
yellowCloudTimer++;
if (yellowCloudTimer >= yellowCloudSpawnInterval) {
yellowCloudTimer = 0;
// Create new yellow cloud at random position
var newYellowCloud = new YellowCloud();
newYellowCloud.x = Math.random() * 2048;
// Define barrier position (same as in Ball class)
var barrierY = 2732 / 3;
// Spawn clouds only below the barrier where ball can reach
var minY = barrierY + 150; // Add some margin below barrier
var maxY = 2692 - 150; // Add some margin above ground
newYellowCloud.y = Math.random() * (maxY - minY) + minY;
yellowClouds.push(newYellowCloud);
game.addChild(newYellowCloud);
}
// Check ball collision with clouds
for (var i = clouds.length - 1; i >= 0; i--) {
var cloud = clouds[i];
if (ball.intersects(cloud)) {
// Ball bounces off cloud
ball.velocityY = -Math.abs(ball.velocityY) * 0.8; // Bounce upward
ball.velocityX += cloud.velocityX * 0.5; // Transfer some cloud momentum
// Add points for hitting regular cloud
updateScore(10);
// Remove cloud on impact
cloud.destroy();
clouds.splice(i, 1);
}
}
// Check ball collision with yellow clouds
for (var i = yellowClouds.length - 1; i >= 0; i--) {
var yellowCloud = yellowClouds[i];
if (ball.intersects(yellowCloud)) {
// Ball bounces off yellow cloud with tween effect
ball.velocityY = -Math.abs(ball.velocityY) * 0.9; // Stronger bounce upward
ball.velocityX += yellowCloud.velocityX * 0.6; // Transfer more cloud momentum
// Add bonus points for hitting yellow cloud
updateScore(25);
// Add tween animation to yellow cloud before destroying
tween(yellowCloud, {
scaleX: 1.5,
scaleY: 1.5,
alpha: 0
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
yellowCloud.destroy();
}
});
yellowClouds.splice(i, 1);
}
}
};
// Touch interaction to set ball position to touch location
game.down = function (x, y, obj) {
// Set ball position to touch location
ball.x = x;
ball.y = y;
// Keep horizontal velocity but reset vertical velocity to maintain bouncing
ball.velocityY = 0;
}; ===================================================================
--- original.js
+++ change.js
@@ -179,8 +179,11 @@
// Update yellow cloud spawn interval for level 2
yellowCloudSpawnInterval = yellowCloudSpawnIntervalLevel2;
// Reset timer to 90 seconds for level 2
gameTimeLeft = 5400; // Reset to 90 seconds
+ // Reset score to 0 for level 2
+ currentScore = 0;
+ scoreText.setText('Score: 0');
// Flash screen to indicate level change
LK.effects.flashScreen(0xFFD700, 500); // Gold flash for level transition
// Update level display
levelText.setText('Level 2');
Una nube . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Haz una nube amarilla . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Una bola con ojos. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Nube verde. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Nube roja. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat