User prompt
Cuando un ladrillo le cae al pollo y este tiene el power up le dará un vida extra al pollo (max-10) ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Cuando un cactus se rompe suelta partículas verdes como si fuera un explosión leve ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que enves de que tengas triple salto por tiempo ilimitado lo trendas por 69 segundos(aparecerá cuando tiempo te queda en color verde abajo del botón de pausa) ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Agrega un cactus mas alto que los otro que solo aparece aleatoriamente una vez en la partida y inmediatamente que aparece en la pantalla el pollo puede hacer 3 saltos enves de 2 por tiempo ilimitado ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que los ladrillos lo vaya tirando un avion(haz que el avión solo sea visual y no tenga una función como tal) ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que la cámara vuelva a ser normal
User prompt
Que caiga un ladrillo del cielo cada 10 segundos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Que la cámara este mucho más cerca del pollo
User prompt
Agregar un fondo de día, cuando el jugador llega a 100 puntos se hace de noche por 50 segundos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Cuando la gallina salta cambia de imagen a "chicken jump"
Remix started
Copy Desert Dash Chicken
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Airplane = Container.expand(function () {
var self = Container.call(this);
var airplaneGraphics = self.attachAsset('airplane', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.isVisible = false;
self.targetX = 0;
self.hasDroppedBrick = false;
self.update = function () {
self.x += self.speed;
// Check if airplane reached drop position and hasn't dropped brick yet
if (!self.hasDroppedBrick && self.x >= self.targetX - 50) {
self.hasDroppedBrick = true;
// Spawn the brick at airplane's position
var newBrick = new Brick();
newBrick.x = self.x;
newBrick.y = self.y + 50; // Drop below airplane
bricks.push(newBrick);
game.addChild(newBrick);
}
};
return self;
});
var Brick = Container.expand(function () {
var self = Container.call(this);
var brickGraphics = self.attachAsset('pauseButton', {
anchorX: 0.5,
anchorY: 0.5,
width: 80,
height: 40,
color: 0x8B4513
});
self.velocityY = 0;
self.gravity = 0.8;
self.hit = false;
self.update = function () {
self.velocityY += self.gravity;
self.y += self.velocityY;
};
return self;
});
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
});
var chickenJumpGraphics = self.attachAsset('chickenjump', {
anchorX: 0.5,
anchorY: 1.0
});
chickenJumpGraphics.visible = false;
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.isDashing = false;
self.dashSpeed = 25;
self.dashDuration = 300; // milliseconds
self.update = function () {
if (self.isJumping && !self.isDashing) {
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;
tripleJumpUsed = 0;
}
}
if (self.isCharging && self.jumpChargeTime < 30) {
self.jumpChargeTime++;
}
// Switch between normal and jump images based on jumping state
if (self.isJumping) {
chickenGraphics.visible = false;
chickenJumpGraphics.visible = true;
} else {
chickenGraphics.visible = true;
chickenJumpGraphics.visible = false;
}
};
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;
if (!tripleJumpActive) {
self.canDoubleJump = false;
}
tripleJumpUsed++;
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);
}
} else if (self.isJumping && tripleJumpActive && tripleJumpUsed < 2) {
// Triple jump (third jump)
self.jumpVelocity = self.maxJumpVelocity * 0.7;
tripleJumpUsed++;
if (tripleJumpUsed >= 2) {
self.canDoubleJump = false;
}
LK.getSound('jump').play();
// Create special particles for triple jump
for (var i = 0; i < 12; i++) {
var particle = new Particle();
particle.x = self.x + (Math.random() - 0.5) * 60;
particle.y = self.y + 30;
particles.push(particle);
game.addChild(particle);
}
}
};
self.startDash = function () {
// Dash functionality disabled
};
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 SuperTallCactus = Container.expand(function () {
var self = Container.call(this);
var cactusGraphics = self.attachAsset('superTallCactus', {
anchorX: 0.5,
anchorY: 1.0
});
self.type = 'superTall';
self.speed = gameSpeed;
self.passed = false;
self.tripleJumpActivated = false;
self.update = function () {
self.x -= self.speed;
};
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 isNightTime = false;
var nightTimer = 0;
var nightDuration = 3000; // 50 seconds at 60fps
var dayBackground;
var nightBackground;
var cactusSpawnTimer = 0;
var cactusSpawnInterval = 90;
var minSpawnInterval = 45;
var cloudSpawnTimer = 0;
var distanceTraveled = 0;
var lastScoreSound = 0;
var jumpScore = 0;
var chicken;
var chickenLives = 3;
var lifeDisplays = [];
var cacti = [];
var clouds = [];
var powerUps = [];
var particles = [];
var trailParticles = [];
var bricks = [];
var airplanes = [];
var brickSpawnTimer = 0;
var brickSpawnInterval = 600; // 10 seconds at 60fps (10 * 60 = 600 frames)
var ground;
var isGameRunning = true;
var isJumpPressed = false;
var tapCount = 0;
var lastTapTime = 0;
var doubleTapThreshold = 300; // milliseconds for double tap detection
var dashCooldown = 0; // Timer for dash cooldown
var dashCooldownDuration = 600; // 10 seconds at 60fps (10 * 60 = 600 frames)
var hasSuperTallCactusSpawned = false;
var tripleJumpActive = false;
var tripleJumpUsed = 0;
var tripleJumpTimer = 0;
var tripleJumpDuration = 4140; // 69 seconds at 60fps (69 * 60 = 4140 frames)
// Power-up system
var powerUpSpawnTimer = 0;
var powerUpSpawnInterval = 1200 + Math.random() * 1200; // Random 20-40 seconds at 60fps
var isInvincible = false;
var invincibilityTimer = 0;
var invincibilityDuration = 1500; // 25 seconds at 60fps
var baseGameSpeed = 8;
// Pause system
var isPaused = false;
var pauseButton;
// Create day and night backgrounds
dayBackground = game.addChild(LK.getAsset('dayBackground', {
anchorX: 0,
anchorY: 0
}));
dayBackground.x = 0;
dayBackground.y = 0;
nightBackground = game.addChild(LK.getAsset('nightBackground', {
anchorX: 0,
anchorY: 0
}));
nightBackground.x = 0;
nightBackground.y = 0;
nightBackground.visible = false;
// 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;
// Camera system variables (disabled)
var cameraX = 0;
var cameraY = 0;
var cameraFollowSpeed = 0.1;
var cameraZoom = 1; // Normal zoom - no zoom applied
var targetCameraX = 0;
var targetCameraY = 0;
// Apply normal camera zoom (no zoom)
game.scale.set(cameraZoom);
// Create life display hearts beside pause button
for (var i = 0; i < chickenLives; i++) {
var heart = LK.getAsset('heart', {
anchorX: 0.5,
anchorY: 0.5
});
heart.x = 250 + i * 50; // Position next to pause button
heart.y = 70; // Align with pause button
lifeDisplays.push(heart);
LK.gui.topLeft.addChild(heart);
}
// 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;
// Tap counter display
var tapCountText = new Text2('CP: 0', {
size: 60,
fill: 0xFFFFFF
});
tapCountText.anchor.set(0.5, 0);
LK.gui.top.addChild(tapCountText);
tapCountText.y = 90;
// 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;
// Power-up timer display
var powerUpTimerText = new Text2('', {
size: 80,
fill: 0xFFFF00 // Yellow color
});
powerUpTimerText.anchor.set(0.5, 0.5);
LK.gui.center.addChild(powerUpTimerText);
powerUpTimerText.visible = false;
// Triple jump display
var tripleJumpText = new Text2('TRIPLE JUMP ACTIVE!', {
size: 70,
fill: 0x00FF00 // Green color
});
tripleJumpText.anchor.set(0.5, 0.5);
LK.gui.center.addChild(tripleJumpText);
tripleJumpText.visible = false;
tripleJumpText.y = -100; // Position above center
// Triple jump timer display (below pause button)
var tripleJumpTimerText = new Text2('', {
size: 50,
fill: 0x00FF00 // Green color
});
tripleJumpTimerText.anchor.set(0, 0);
LK.gui.topLeft.addChild(tripleJumpTimerText);
tripleJumpTimerText.x = 120; // Align with pause button
tripleJumpTimerText.y = 140; // Below pause button
tripleJumpTimerText.visible = false;
// 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;
// Variable to store play triangle reference
var playTriangle = null;
// 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
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;
// 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
if (playTriangle) {
pauseButton.removeChild(playTriangle);
playTriangle = null;
}
pauseLine1.visible = true;
pauseLine2.visible = true;
}
};
// Game controls
game.down = function (x, y, obj) {
if (isGameRunning) {
// Single tap - start jump
isJumpPressed = true;
chicken.startJump();
tapCount++;
tapCountText.setText('CP: ' + tapCount);
}
};
game.up = function (x, y, obj) {
if (isGameRunning && isJumpPressed) {
isJumpPressed = false;
chicken.executeJump();
}
};
function spawnCactus() {
// Check if super tall cactus should spawn (random chance and hasn't spawned yet)
if (!hasSuperTallCactusSpawned && Math.random() < 0.02 && jumpScore > 20) {
// Spawn super tall cactus
var newSuperCactus = new SuperTallCactus();
newSuperCactus.x = 2048 + 100;
newSuperCactus.y = 2732 - 200;
newSuperCactus.speed = gameSpeed;
cacti.push(newSuperCactus);
game.addChild(newSuperCactus);
hasSuperTallCactusSpawned = true;
// Activate triple jump for 69 seconds when super cactus appears
tripleJumpActive = true;
tripleJumpTimer = 0;
tripleJumpText.visible = true;
tripleJumpTimerText.visible = true;
// Flash screen to indicate special event
LK.effects.flashScreen(0x00FF00, 500);
// Add glow effect to chicken
tween(chicken, {
tint: 0x00FF00
}, {
duration: 500,
onFinish: function onFinish() {
tween(chicken, {
tint: 0xFFFFFF
}, {
duration: 500
});
}
});
} else {
// Normal cactus spawning
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 spawnBrick() {
var newAirplane = new Airplane();
newAirplane.x = -150; // Start off-screen left
newAirplane.y = 300 + Math.random() * 200; // Random height in sky
newAirplane.targetX = 200 + Math.random() * 1648; // Random drop position
airplanes.push(newAirplane);
game.addChild(newAirplane);
// Add slight bobbing animation to airplane
tween(newAirplane, {
y: newAirplane.y + 20
}, {
duration: 2000,
easing: tween.easeInOut
});
}
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 {
// Lose a life
chickenLives--;
// Hide one heart
if (lifeDisplays.length > 0) {
var heartToRemove = lifeDisplays.pop();
tween(heartToRemove, {
alpha: 0,
scaleX: 0,
scaleY: 0
}, {
duration: 300,
onFinish: function onFinish() {
heartToRemove.destroy();
}
});
}
// Push chicken backwards
tween(chicken, {
x: chicken.x - 150
}, {
duration: 500,
easing: tween.easeOut
});
// Flash chicken red briefly
tween(chicken, {
tint: 0xff0000
}, {
duration: 200,
onFinish: function onFinish() {
tween(chicken, {
tint: 0xffffff
}, {
duration: 200
});
}
});
// Destroy the cactus that hit the chicken with animation
tween(cactus, {
alpha: 0,
scaleX: 2,
scaleY: 2,
rotation: Math.PI
}, {
duration: 400,
easing: tween.easeOut,
onFinish: function onFinish() {
cactus.destroy();
}
});
cacti.splice(i, 1);
// Check if all lives are lost
if (chickenLives <= 0) {
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;
if (cactus.type === 'superTall') {
// Super tall cactus gives 5 points
jumpScore += 5;
// Keep triple jump active permanently after passing
cactus.tripleJumpActivated = true;
} else {
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;
// Increase chicken speed by 70%
chicken.speed = baseGameSpeed * 1.7;
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 checkBrickCollisions() {
for (var i = bricks.length - 1; i >= 0; i--) {
var brick = bricks[i];
if (chicken.intersects(brick) && !brick.hit) {
brick.hit = true;
if (!isInvincible) {
// Lose 2 lives
chickenLives -= 2;
// Hide two hearts
for (var h = 0; h < 2 && lifeDisplays.length > 0; h++) {
var heartToRemove = lifeDisplays.pop();
tween(heartToRemove, {
alpha: 0,
scaleX: 0,
scaleY: 0
}, {
duration: 300,
onFinish: function onFinish() {
heartToRemove.destroy();
}
});
}
// Push chicken backwards
tween(chicken, {
x: chicken.x - 150
}, {
duration: 500,
easing: tween.easeOut
});
// Flash chicken red briefly
tween(chicken, {
tint: 0xff0000
}, {
duration: 200,
onFinish: function onFinish() {
tween(chicken, {
tint: 0xffffff
}, {
duration: 200
});
}
});
// Check if all lives are lost
if (chickenLives <= 0) {
isGameRunning = false;
LK.effects.flashScreen(0xFF0000, 800);
LK.setTimeout(function () {
LK.showGameOver();
}, 400);
return;
}
}
// Destroy the brick with animation
tween(brick, {
alpha: 0,
scaleX: 2,
scaleY: 2,
rotation: Math.PI
}, {
duration: 400,
easing: tween.easeOut,
onFinish: function onFinish() {
brick.destroy();
}
});
bricks.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 updateCamera() {
// Camera disabled - return to normal static view
game.x = 0;
game.y = 0;
}
function updateDayNightCycle() {
// Check if score reaches 100 and we're not already in night mode
if (jumpScore >= 100 && !isNightTime) {
isNightTime = true;
nightTimer = 0;
// Transition to night
tween(dayBackground, {
alpha: 0
}, {
duration: 2000
});
tween(nightBackground, {
alpha: 1
}, {
duration: 2000,
onFinish: function onFinish() {
nightBackground.visible = true;
dayBackground.visible = false;
}
});
}
// If in night mode, count down timer
if (isNightTime) {
nightTimer++;
// After 50 seconds, return to day
if (nightTimer >= nightDuration) {
isNightTime = false;
nightTimer = 0;
// Transition back to day
dayBackground.visible = true;
nightBackground.visible = true;
tween(dayBackground, {
alpha: 1
}, {
duration: 2000
});
tween(nightBackground, {
alpha: 0
}, {
duration: 2000,
onFinish: function onFinish() {
nightBackground.visible = false;
}
});
}
}
}
function updateTripleJumpTimer() {
if (tripleJumpActive) {
tripleJumpTimer++;
// Calculate remaining seconds
var remainingSeconds = Math.ceil((tripleJumpDuration - tripleJumpTimer) / 60);
tripleJumpTimerText.setText(remainingSeconds + 's');
// End triple jump after 69 seconds
if (tripleJumpTimer >= tripleJumpDuration) {
tripleJumpActive = false;
tripleJumpTimer = 0;
tripleJumpText.visible = false;
tripleJumpTimerText.visible = false;
// Reset chicken appearance
tween(chicken, {
tint: 0xFFFFFF
}, {
duration: 500
});
}
}
}
function updateInvincibility() {
if (isInvincible) {
invincibilityTimer++;
// Update power-up timer display
var remainingSeconds = Math.ceil((invincibilityDuration - invincibilityTimer) / 60);
powerUpTimerText.setText(remainingSeconds + 's');
powerUpTimerText.visible = true;
// 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;
powerUpTimerText.visible = false;
// Reset chicken speed
chicken.speed = baseGameSpeed;
// Reset chicken appearance
tween(chicken, {
tint: 0xffffff
}, {
duration: 500
});
}
} else {
powerUpTimerText.visible = false;
}
}
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;
// Set new random interval for next power-up (20-40 seconds)
powerUpSpawnInterval = 1200 + Math.random() * 1200;
}
// Spawn bricks every 50 seconds
brickSpawnTimer++;
if (brickSpawnTimer >= brickSpawnInterval) {
spawnBrick();
brickSpawnTimer = 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);
}
}
// Update and clean up airplanes
for (var i = airplanes.length - 1; i >= 0; i--) {
var airplane = airplanes[i];
if (airplane.x > 2048 + 200) {
// Off-screen cleanup
airplane.destroy();
airplanes.splice(i, 1);
}
}
// Update and clean up bricks
for (var i = bricks.length - 1; i >= 0; i--) {
var brick = bricks[i];
if (brick.y > 2732 + 100) {
// Off-screen cleanup
brick.destroy();
bricks.splice(i, 1);
}
}
updateTripleJumpTimer();
updateInvincibility();
updateDayNightCycle();
updateCamera();
// Update dash cooldown
if (dashCooldown > 0) {
dashCooldown--;
}
checkCollisions();
checkCactusJumps();
checkPowerUpCollisions();
checkBrickCollisions();
// Hide instructions after first jump
if (chicken.isJumping && instructionText.alpha > 0) {
tween(instructionText, {
alpha: 0
}, {
duration: 1000
});
}
}; ===================================================================
--- original.js
+++ change.js
@@ -312,8 +312,10 @@
var dashCooldownDuration = 600; // 10 seconds at 60fps (10 * 60 = 600 frames)
var hasSuperTallCactusSpawned = false;
var tripleJumpActive = false;
var tripleJumpUsed = 0;
+var tripleJumpTimer = 0;
+var tripleJumpDuration = 4140; // 69 seconds at 60fps (69 * 60 = 4140 frames)
// Power-up system
var powerUpSpawnTimer = 0;
var powerUpSpawnInterval = 1200 + Math.random() * 1200; // Random 20-40 seconds at 60fps
var isInvincible = false;
@@ -417,8 +419,18 @@
tripleJumpText.anchor.set(0.5, 0.5);
LK.gui.center.addChild(tripleJumpText);
tripleJumpText.visible = false;
tripleJumpText.y = -100; // Position above center
+// Triple jump timer display (below pause button)
+var tripleJumpTimerText = new Text2('', {
+ size: 50,
+ fill: 0x00FF00 // Green color
+});
+tripleJumpTimerText.anchor.set(0, 0);
+LK.gui.topLeft.addChild(tripleJumpTimerText);
+tripleJumpTimerText.x = 120; // Align with pause button
+tripleJumpTimerText.y = 140; // Below pause button
+tripleJumpTimerText.visible = false;
// Create pause button in top left (avoiding the 100x100 platform menu area)
pauseButton = LK.getAsset('pauseButton', {
anchorX: 0,
anchorY: 0
@@ -537,11 +549,13 @@
newSuperCactus.speed = gameSpeed;
cacti.push(newSuperCactus);
game.addChild(newSuperCactus);
hasSuperTallCactusSpawned = true;
- // Activate triple jump immediately when super cactus appears
+ // Activate triple jump for 69 seconds when super cactus appears
tripleJumpActive = true;
+ tripleJumpTimer = 0;
tripleJumpText.visible = true;
+ tripleJumpTimerText.visible = true;
// Flash screen to indicate special event
LK.effects.flashScreen(0x00FF00, 500);
// Add glow effect to chicken
tween(chicken, {
@@ -882,8 +896,29 @@
});
}
}
}
+function updateTripleJumpTimer() {
+ if (tripleJumpActive) {
+ tripleJumpTimer++;
+ // Calculate remaining seconds
+ var remainingSeconds = Math.ceil((tripleJumpDuration - tripleJumpTimer) / 60);
+ tripleJumpTimerText.setText(remainingSeconds + 's');
+ // End triple jump after 69 seconds
+ if (tripleJumpTimer >= tripleJumpDuration) {
+ tripleJumpActive = false;
+ tripleJumpTimer = 0;
+ tripleJumpText.visible = false;
+ tripleJumpTimerText.visible = false;
+ // Reset chicken appearance
+ tween(chicken, {
+ tint: 0xFFFFFF
+ }, {
+ duration: 500
+ });
+ }
+ }
+}
function updateInvincibility() {
if (isInvincible) {
invincibilityTimer++;
// Update power-up timer display
@@ -1001,8 +1036,9 @@
brick.destroy();
bricks.splice(i, 1);
}
}
+ updateTripleJumpTimer();
updateInvincibility();
updateDayNightCycle();
updateCamera();
// Update dash cooldown
Cactus 2d style pixel 1980. 2d. High contrast. No shadows. 2d
White chicken military hat style 2d pixel 1980. In-Game asset. 2d. High contrast. No shadows
Chicken jump
Brick style pixel 1980. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Day sky and clouds style pixel 1980. In-Game asset. 2d. High contrast. No shadows. Pixel
Airplane 2d style pixel 1980. 2d. High contrast. No shadows
Night sky
Tubería gris radioactiva estilo pixel de 1983. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Boton verde ovalado qué dice "compra" estilo 2d pixel 1989. In-Game asset. 2d. High contrast. No shadows
Que el botón sea rojo y que diga salir
Pocion azul clara estilo pixel art . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Golden con style pixel art. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Red heart style pixel art. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Fondo verde
One Cloud style pixel art. 2d. High contrast. No shadows
Alas de ángel blancas estilo pixel art. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Un barrir marrón con 2 líneas negras en el medio estilo pixel art. 2d. High contrast. No shadows
Gray rock (stone) style pixel art. 2d. High contrast. No shadows
Yellow star with Black eyes style pixel art. 2d. High contrast. No shadows
Silla amarilla de un avion estilo pixel art. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Has el cuadro un poco más recto y sin líneas blancas
Caja de Interrogación alcoiris de líneas blancas estilo pixel art. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Una bola de acero negro con unas cadenas grises estilo pixel art. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Hitbox green. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Tiburón azul robótico volando con una elize abajo y una cara graciosa . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat