User prompt
Haz que el pollo ya no pueda hacer dash
User prompt
Que solo puedas usar el dash cada 10 segundos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que caiga cada 50 segundos un ladrillo y si el ladrillo le cae al pollo le quita 2 corazones ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que el dash del pollo sea en línea recta ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que el dahs solo sea en línea recta y solo se pueda ejecutar en el aire ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Cada vez que se da doble toque a la pantalla rápidamente, la gallina inicia un dash corto ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Quita el menu
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'visible')' in or related to this line: 'pauseButton.visible = false;' Line Number: 291
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'visible')' in or related to this line: 'pauseButton.visible = false;' Line Number: 291
User prompt
Añade un menú para comenzar qué diga "jugar"
User prompt
Cuando el pollo pierda una vida lo mande para atrás mientras se destruye el cactus qué le quito la vida ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que abajo de la puntuación aparezca cuantos toques le dio el jugador a la pantalla como "cp:puntuación)"
User prompt
Que el power up te muestre cuantos segundo faltan para que se acabe en el medio con letras amarillas, también haga que el pollo valla 0.70 más rápido de su velocidad mientras dure el power up, el power up envés de aparecer cada 30 segundos aparezca cada tiempo aleatorio no menos de 20 segundos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que los corazones del pollo envés de estar arriba de el esten al lado del botón de pausa
User prompt
Please fix the bug: 'Uncaught TypeError: pauseButton.getChildByName is not a function' in or related to this line: 'var playTriangle = pauseButton.getChildByName('playTriangle');' Line Number: 359
User prompt
Que la gallina tenga 3 vidas y que se muestre cuantas vidas te quedan arriba de la cabeza de la gallina
User prompt
Agrega un botón de pausa en la parte superior izquierda
User prompt
Cuando la gallina agarra el power up suelta partículas atrás suyo de colores ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que el power up tenga la hitbox más grande
User prompt
La gallina tiene doble salto y cuando hace el segundo salto suelta partículas de air abajo de sus patas ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
El juego empieza a volverse más rápido cada 50 puntos y no cada segundo
User prompt
Crea un power up que haga que la gallina sea invencible (cuando toca un cactus se rompe) mientras tienen velocidad (el power up solo dura 25 segundos y aparece cada 30 segundos) ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Cactus = Container.expand(function (type) {
var self = Container.call(this);
var assetName = type === 'tall' ? 'tallCactus' : 'smallCactus';
var cactusGraphics = self.attachAsset(assetName, {
anchorX: 0.5,
anchorY: 1.0
});
self.type = type;
self.speed = gameSpeed;
self.passed = false;
self.update = function () {
self.x -= self.speed;
};
return self;
});
var Chicken = Container.expand(function () {
var self = Container.call(this);
var chickenGraphics = self.attachAsset('chicken', {
anchorX: 0.5,
anchorY: 1.0
});
self.groundY = 2732 - 200;
self.jumpStartY = self.groundY;
self.isJumping = false;
self.jumpVelocity = 0;
self.gravity = 1.2;
self.maxJumpVelocity = -45;
self.jumpChargeTime = 0;
self.isCharging = false;
self.canDoubleJump = false;
self.hasDoubleJumped = false;
self.update = function () {
if (self.isJumping) {
self.y += self.jumpVelocity;
self.jumpVelocity += self.gravity;
if (self.y >= self.groundY) {
self.y = self.groundY;
self.isJumping = false;
self.jumpVelocity = 0;
self.canDoubleJump = false;
self.hasDoubleJumped = false;
}
}
if (self.isCharging && self.jumpChargeTime < 30) {
self.jumpChargeTime++;
}
};
self.startJump = function () {
if (!self.isJumping) {
self.isCharging = true;
self.jumpChargeTime = 0;
}
};
self.executeJump = function () {
if (!self.isJumping && self.isCharging) {
var jumpPower = Math.min(self.jumpChargeTime / 30, 1);
self.jumpVelocity = self.maxJumpVelocity * (0.4 + jumpPower * 0.6);
self.isJumping = true;
self.isCharging = false;
self.jumpChargeTime = 0;
self.canDoubleJump = true;
LK.getSound('jump').play();
} else if (self.isJumping && self.canDoubleJump && !self.hasDoubleJumped) {
// Double jump
self.jumpVelocity = self.maxJumpVelocity * 0.8;
self.hasDoubleJumped = true;
self.canDoubleJump = false;
LK.getSound('jump').play();
// Create particles below chicken's feet
for (var i = 0; i < 8; i++) {
var particle = new Particle();
particle.x = self.x + (Math.random() - 0.5) * 40;
particle.y = self.y + 30; // Below chicken's feet
particles.push(particle);
game.addChild(particle);
}
}
};
return self;
});
var Cloud = Container.expand(function () {
var self = Container.call(this);
var cloudGraphics = self.attachAsset('cloud', {
anchorX: 0.5,
anchorY: 0.5
});
cloudGraphics.alpha = 0.7;
self.speed = 1;
self.update = function () {
self.x -= self.speed;
};
return self;
});
var Particle = Container.expand(function () {
var self = Container.call(this);
var particleGraphics = self.attachAsset('particle', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = (Math.random() - 0.5) * 8;
self.velocityY = Math.random() * -4 - 2;
self.life = 30;
self.maxLife = 30;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.velocityY += 0.2; // gravity
self.life--;
// Fade out over time
var alpha = self.life / self.maxLife;
particleGraphics.alpha = alpha;
if (self.life <= 0) {
self.markForDestroy = true;
}
};
return self;
});
var PowerUp = Container.expand(function () {
var self = Container.call(this);
var powerUpGraphics = self.attachAsset('powerUp', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = gameSpeed;
self.floatOffset = 0;
self.collected = false;
self.update = function () {
self.x -= self.speed;
// Floating animation
self.floatOffset += 0.2;
self.y += Math.sin(self.floatOffset) * 2;
};
return self;
});
var TrailParticle = Container.expand(function () {
var self = Container.call(this);
var particleGraphics = self.attachAsset('trailParticle', {
anchorX: 0.5,
anchorY: 0.5
});
// Random color for trail particles
var colors = [0xff4500, 0xff6347, 0xffd700, 0xff1493, 0x00ff00, 0x00bfff];
particleGraphics.tint = colors[Math.floor(Math.random() * colors.length)];
self.velocityX = (Math.random() - 0.5) * 6;
self.velocityY = Math.random() * -3 - 1;
self.life = 40;
self.maxLife = 40;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.velocityY += 0.15; // gravity
self.life--;
// Fade out over time
var alpha = self.life / self.maxLife;
particleGraphics.alpha = alpha;
if (self.life <= 0) {
self.markForDestroy = true;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var gameSpeed = 8;
var maxGameSpeed = 20;
var speedIncrement = 0.02;
var cactusSpawnTimer = 0;
var cactusSpawnInterval = 90;
var minSpawnInterval = 45;
var cloudSpawnTimer = 0;
var distanceTraveled = 0;
var lastScoreSound = 0;
var jumpScore = 0;
var chicken;
var cacti = [];
var clouds = [];
var powerUps = [];
var particles = [];
var trailParticles = [];
var ground;
var isGameRunning = true;
var isJumpPressed = false;
// Power-up system
var powerUpSpawnTimer = 0;
var powerUpSpawnInterval = 1800; // 30 seconds at 60fps
var isInvincible = false;
var invincibilityTimer = 0;
var invincibilityDuration = 1500; // 25 seconds at 60fps
// Pause system
var isPaused = false;
var pauseButton;
// Create ground
ground = game.addChild(LK.getAsset('ground', {
anchorX: 0,
anchorY: 1.0
}));
ground.x = 0;
ground.y = 2732 - 140;
// Create chicken
chicken = game.addChild(new Chicken());
chicken.x = 300;
chicken.y = chicken.groundY;
// Score display for cactus jumps
var jumpScoreText = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
jumpScoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(jumpScoreText);
jumpScoreText.y = 20;
// Distance display
var scoreText = new Text2('Distance: 0m', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0, 0);
LK.gui.topRight.addChild(scoreText);
scoreText.x = -20;
scoreText.y = 20;
// Instructions
var instructionText = new Text2('TAP & HOLD TO JUMP HIGHER', {
size: 45,
fill: 0xFFFFFF
});
instructionText.anchor.set(0.5, 0);
LK.gui.top.addChild(instructionText);
instructionText.y = 100;
// Create pause button in top left (avoiding the 100x100 platform menu area)
pauseButton = LK.getAsset('pauseButton', {
anchorX: 0,
anchorY: 0
});
LK.gui.topLeft.addChild(pauseButton);
pauseButton.x = 120; // Offset from very top left to avoid platform menu
pauseButton.y = 20;
// Add pause symbol (two vertical lines)
var pauseLine1 = LK.getAsset('pauseButton', {
anchorX: 0.5,
anchorY: 0.5,
width: 8,
height: 40,
color: 0xffffff
});
var pauseLine2 = LK.getAsset('pauseButton', {
anchorX: 0.5,
anchorY: 0.5,
width: 8,
height: 40,
color: 0xffffff
});
pauseButton.addChild(pauseLine1);
pauseButton.addChild(pauseLine2);
pauseLine1.x = 25;
pauseLine1.y = 40;
pauseLine2.x = 55;
pauseLine2.y = 40;
// Pause button functionality
pauseButton.down = function (x, y, obj) {
isPaused = !isPaused;
if (isPaused) {
// Show paused state - make lines into play triangle
pauseLine1.visible = false;
pauseLine2.visible = false;
// Create play triangle
var playTriangle = LK.getAsset('pauseButton', {
anchorX: 0.5,
anchorY: 0.5,
width: 0,
height: 0,
color: 0xffffff
});
pauseButton.addChild(playTriangle);
playTriangle.x = 45;
playTriangle.y = 40;
playTriangle.name = 'playTriangle';
// Create triangle using three lines (simple approach)
var tri1 = LK.getAsset('pauseButton', {
width: 30,
height: 4,
color: 0xffffff,
anchorX: 0,
anchorY: 0.5
});
var tri2 = LK.getAsset('pauseButton', {
width: 30,
height: 4,
color: 0xffffff,
anchorX: 0,
anchorY: 0.5
});
var tri3 = LK.getAsset('pauseButton', {
width: 30,
height: 4,
color: 0xffffff,
anchorX: 0,
anchorY: 0.5
});
playTriangle.addChild(tri1);
playTriangle.addChild(tri2);
playTriangle.addChild(tri3);
tri1.x = -15;
tri1.y = -15;
tri1.rotation = 0.5;
tri2.x = -15;
tri2.y = 15;
tri2.rotation = -0.5;
tri3.x = -15;
tri3.y = 0;
tri3.rotation = 0;
} else {
// Show pause state - remove play triangle and show pause lines
var playTriangle = pauseButton.getChildByName('playTriangle');
if (playTriangle) {
pauseButton.removeChild(playTriangle);
}
pauseLine1.visible = true;
pauseLine2.visible = true;
}
};
// Game controls
game.down = function (x, y, obj) {
if (isGameRunning) {
isJumpPressed = true;
chicken.startJump();
}
};
game.up = function (x, y, obj) {
if (isGameRunning && isJumpPressed) {
isJumpPressed = false;
chicken.executeJump();
}
};
function spawnCactus() {
var cactusType = Math.random() < 0.6 ? 'small' : 'tall';
var newCactus = new Cactus(cactusType);
newCactus.x = 2048 + 100;
newCactus.y = 2732 - 200;
newCactus.speed = gameSpeed;
cacti.push(newCactus);
game.addChild(newCactus);
}
function spawnCloud() {
var newCloud = new Cloud();
newCloud.x = 2048 + 200;
newCloud.y = 200 + Math.random() * 400;
clouds.push(newCloud);
game.addChild(newCloud);
}
function spawnPowerUp() {
var newPowerUp = new PowerUp();
newPowerUp.x = 2048 + 100;
newPowerUp.y = 2732 - 400 - Math.random() * 200; // Spawn in air
newPowerUp.speed = gameSpeed;
powerUps.push(newPowerUp);
game.addChild(newPowerUp);
}
function checkCollisions() {
for (var i = cacti.length - 1; i >= 0; i--) {
var cactus = cacti[i];
if (chicken.intersects(cactus)) {
if (isInvincible) {
// Destroy cactus with visual effect
tween(cactus, {
alpha: 0,
scaleX: 2,
scaleY: 2
}, {
duration: 200,
onFinish: function onFinish() {
cactus.destroy();
}
});
cacti.splice(i, 1);
} else {
isGameRunning = false;
LK.effects.flashScreen(0xFF0000, 800);
LK.setTimeout(function () {
LK.showGameOver();
}, 400);
return;
}
}
}
}
function updateScore() {
distanceTraveled = Math.floor(LK.ticks / 6);
scoreText.setText('Distance: ' + distanceTraveled + 'm');
// Play score sound every 100 meters
if (distanceTraveled > 0 && distanceTraveled % 100 === 0 && distanceTraveled !== lastScoreSound) {
LK.getSound('score').play();
lastScoreSound = distanceTraveled;
}
}
function checkCactusJumps() {
for (var i = 0; i < cacti.length; i++) {
var cactus = cacti[i];
// Check if chicken has passed the cactus (chicken is to the right of cactus)
if (!cactus.passed && chicken.x > cactus.x + 30) {
cactus.passed = true;
jumpScore++;
LK.setScore(jumpScore);
jumpScoreText.setText('Score: ' + jumpScore);
LK.getSound('score').play();
increaseDifficulty();
}
}
}
function checkPowerUpCollisions() {
for (var i = powerUps.length - 1; i >= 0; i--) {
var powerUp = powerUps[i];
if (chicken.intersects(powerUp) && !powerUp.collected) {
powerUp.collected = true;
// Activate invincibility
isInvincible = true;
invincibilityTimer = 0;
LK.getSound('powerup').play();
// Create colorful trail particles behind chicken
for (var j = 0; j < 12; j++) {
var trailParticle = new TrailParticle();
trailParticle.x = chicken.x - 50 - Math.random() * 30; // Behind chicken
trailParticle.y = chicken.y - Math.random() * 40;
trailParticles.push(trailParticle);
game.addChild(trailParticle);
}
// Visual feedback - make chicken glow
tween(chicken, {
tint: 0xffff00
}, {
duration: 300
});
// Remove power-up with effect
tween(powerUp, {
alpha: 0,
scaleX: 2,
scaleY: 2
}, {
duration: 300,
onFinish: function onFinish() {
powerUp.destroy();
}
});
powerUps.splice(i, 1);
}
}
}
function increaseDifficulty() {
// Increase speed every 50 points
var targetSpeed = 8 + Math.floor(jumpScore / 50) * 2;
if (targetSpeed > maxGameSpeed) {
targetSpeed = maxGameSpeed;
}
gameSpeed = targetSpeed;
// Decrease spawn interval based on score
var targetInterval = 90 - Math.floor(jumpScore / 50) * 10;
if (targetInterval < minSpawnInterval) {
targetInterval = minSpawnInterval;
}
cactusSpawnInterval = targetInterval;
}
function updateInvincibility() {
if (isInvincible) {
invincibilityTimer++;
// Make chicken flash during invincibility
if (invincibilityTimer % 10 === 0) {
var currentTint = chicken.tint === 0xffff00 ? 0xffffff : 0xffff00;
chicken.tint = currentTint;
}
// End invincibility after duration
if (invincibilityTimer >= invincibilityDuration) {
isInvincible = false;
invincibilityTimer = 0;
// Reset chicken appearance
tween(chicken, {
tint: 0xffffff
}, {
duration: 500
});
}
}
}
game.update = function () {
if (!isGameRunning || isPaused) return;
updateScore();
// Spawn cacti
cactusSpawnTimer++;
if (cactusSpawnTimer >= cactusSpawnInterval) {
spawnCactus();
cactusSpawnTimer = 0;
}
// Spawn clouds
cloudSpawnTimer++;
if (cloudSpawnTimer >= 180) {
spawnCloud();
cloudSpawnTimer = 0;
}
// Spawn power-ups
powerUpSpawnTimer++;
if (powerUpSpawnTimer >= powerUpSpawnInterval) {
spawnPowerUp();
powerUpSpawnTimer = 0;
}
// Update and clean up cacti
for (var i = cacti.length - 1; i >= 0; i--) {
var cactus = cacti[i];
cactus.speed = gameSpeed;
if (cactus.x < -100) {
cactus.destroy();
cacti.splice(i, 1);
}
}
// Update and clean up clouds
for (var i = clouds.length - 1; i >= 0; i--) {
var cloud = clouds[i];
if (cloud.x < -200) {
cloud.destroy();
clouds.splice(i, 1);
}
}
// Update and clean up power-ups
for (var i = powerUps.length - 1; i >= 0; i--) {
var powerUp = powerUps[i];
powerUp.speed = gameSpeed;
if (powerUp.x < -100) {
powerUp.destroy();
powerUps.splice(i, 1);
}
}
// Update and clean up particles
for (var i = particles.length - 1; i >= 0; i--) {
var particle = particles[i];
if (particle.markForDestroy) {
particle.destroy();
particles.splice(i, 1);
}
}
// Update and clean up trail particles
for (var i = trailParticles.length - 1; i >= 0; i--) {
var trailParticle = trailParticles[i];
if (trailParticle.markForDestroy) {
trailParticle.destroy();
trailParticles.splice(i, 1);
}
}
updateInvincibility();
checkCollisions();
checkCactusJumps();
checkPowerUpCollisions();
// Hide instructions after first jump
if (chicken.isJumping && instructionText.alpha > 0) {
tween(instructionText, {
alpha: 0
}, {
duration: 1000
});
}
}; ===================================================================
--- original.js
+++ change.js
@@ -202,8 +202,11 @@
var powerUpSpawnInterval = 1800; // 30 seconds at 60fps
var isInvincible = false;
var invincibilityTimer = 0;
var invincibilityDuration = 1500; // 25 seconds at 60fps
+// Pause system
+var isPaused = false;
+var pauseButton;
// Create ground
ground = game.addChild(LK.getAsset('ground', {
anchorX: 0,
anchorY: 1.0
@@ -238,8 +241,100 @@
});
instructionText.anchor.set(0.5, 0);
LK.gui.top.addChild(instructionText);
instructionText.y = 100;
+// Create pause button in top left (avoiding the 100x100 platform menu area)
+pauseButton = LK.getAsset('pauseButton', {
+ anchorX: 0,
+ anchorY: 0
+});
+LK.gui.topLeft.addChild(pauseButton);
+pauseButton.x = 120; // Offset from very top left to avoid platform menu
+pauseButton.y = 20;
+// Add pause symbol (two vertical lines)
+var pauseLine1 = LK.getAsset('pauseButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 8,
+ height: 40,
+ color: 0xffffff
+});
+var pauseLine2 = LK.getAsset('pauseButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 8,
+ height: 40,
+ color: 0xffffff
+});
+pauseButton.addChild(pauseLine1);
+pauseButton.addChild(pauseLine2);
+pauseLine1.x = 25;
+pauseLine1.y = 40;
+pauseLine2.x = 55;
+pauseLine2.y = 40;
+// Pause button functionality
+pauseButton.down = function (x, y, obj) {
+ isPaused = !isPaused;
+ if (isPaused) {
+ // Show paused state - make lines into play triangle
+ pauseLine1.visible = false;
+ pauseLine2.visible = false;
+ // Create play triangle
+ var playTriangle = LK.getAsset('pauseButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 0,
+ height: 0,
+ color: 0xffffff
+ });
+ pauseButton.addChild(playTriangle);
+ playTriangle.x = 45;
+ playTriangle.y = 40;
+ playTriangle.name = 'playTriangle';
+ // Create triangle using three lines (simple approach)
+ var tri1 = LK.getAsset('pauseButton', {
+ width: 30,
+ height: 4,
+ color: 0xffffff,
+ anchorX: 0,
+ anchorY: 0.5
+ });
+ var tri2 = LK.getAsset('pauseButton', {
+ width: 30,
+ height: 4,
+ color: 0xffffff,
+ anchorX: 0,
+ anchorY: 0.5
+ });
+ var tri3 = LK.getAsset('pauseButton', {
+ width: 30,
+ height: 4,
+ color: 0xffffff,
+ anchorX: 0,
+ anchorY: 0.5
+ });
+ playTriangle.addChild(tri1);
+ playTriangle.addChild(tri2);
+ playTriangle.addChild(tri3);
+ tri1.x = -15;
+ tri1.y = -15;
+ tri1.rotation = 0.5;
+ tri2.x = -15;
+ tri2.y = 15;
+ tri2.rotation = -0.5;
+ tri3.x = -15;
+ tri3.y = 0;
+ tri3.rotation = 0;
+ } else {
+ // Show pause state - remove play triangle and show pause lines
+ var playTriangle = pauseButton.getChildByName('playTriangle');
+ if (playTriangle) {
+ pauseButton.removeChild(playTriangle);
+ }
+ pauseLine1.visible = true;
+ pauseLine2.visible = true;
+ }
+};
// Game controls
game.down = function (x, y, obj) {
if (isGameRunning) {
isJumpPressed = true;
@@ -400,9 +495,9 @@
}
}
}
game.update = function () {
- if (!isGameRunning) return;
+ if (!isGameRunning || isPaused) return;
updateScore();
// Spawn cacti
cactusSpawnTimer++;
if (cactusSpawnTimer >= cactusSpawnInterval) {
Generame un cactus. In-Game asset. 2d. Estilo cartoon. Cartoon
Que el personaje tenga un casco de militar de la guerra con unos lentes de mira redonda
Un cañón verde estilo cartón plano y con un aura naranja resplandeciente como borde. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat