User prompt
Dash cooldown i kaldır
User prompt
Engellerin oluşmasını beat ile senkronize etmeyi kaldır. Otomatik olarak rastgele oluşsun
User prompt
En baştaki dash sistemi düzgün çalışıyordu onunla karşılaştır ve eski haline getir
User prompt
Oyuna dash mekaniği getir. Ekranın sağ tarafına dokununca karakter ileri atılsın
User prompt
Dash mekaniğini oyundan ve kodlardan tamamen kaldır
User prompt
kameranın hızı bir yerden sonra azalıyor karakter daha yavaş yürüyormuş gibi görünüyor
User prompt
kameranın hızını da görmek istiyorum
User prompt
karakterin yürüme hızını ekranda görmek istiyorum
User prompt
pos before 2048 de after 2098 de duruyor. ve durduğu anda da dash yapınca karakter ileri fırlamıyor
User prompt
dash ile alakalı tüm ayrları değiştir bağımlı olduğu bağlılıkları da değiştir neyin debep olduğunu bulmak için
User prompt
hayır olmuyor dash yaptıktan sonra ileri atılan mesafe azalıyor en son sıfırlanıyor. camera ile alaklı olabilir mi
User prompt
oyunun başında dash iyi çalışıyor ama sonra bozuluyor
User prompt
dash ile alakalı tüm değerleri ekranda görmek istiyorum tüm
User prompt
sorun displayda değil sorun dashta yani ileri gidiyor sanıyor ama bir yerden sonra gitmiyor
User prompt
şimdi current her dash tıklmasında 0.05 azalıyor, reset timer sıfırlanıyor, forward tam okuyamıyorum ama değeri yazıyor. dash yaptığımda karakter ileri gitmiyor ama forward da sanki ileri gidiyormulum gibi gözüküyor
User prompt
ileri atılması mesafesini de göstersin
User prompt
sorunun ne olduğunu çzebilmem için dash ile alakalı değerleri ekrana getir
User prompt
zamanla dash mesafesi azalıyor sonra sıfırlanıyor
Code edit (1 edits merged)
Please save this source code
User prompt
Kodları izin almadan değiştirme
User prompt
Gittikçe dash mesafesi azalıyor ve en son sıfırlanıyor. Dasha bastığımda efekt ve ses var ama karakter ileri hareket etmiyor. Zamanla azalıyor olabilir emin değilim
User prompt
Evet
User prompt
Hayır sorun hala aynı. Üstelik oyun kasmaya başladı. cevap ver kodu değiştirme
User prompt
Hayır sorun hala aynı. Üstelik oyun kasmaya başladı. cevap ver kod değiştirme
User prompt
O zaman twen mekanikleri dash için uygun değilse başka bir şey kullan
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var AmbientParticle = Container.expand(function () {
var self = Container.call(this);
var particleGfx = self.attachAsset('particle', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = (Math.random() - 0.5) * 2;
self.velocityY = (Math.random() - 0.5) * 2;
self.life = 180;
self.maxLife = 180;
self.floatPhase = Math.random() * Math.PI * 2;
self.update = function () {
self.floatPhase += 0.02;
self.x += self.velocityX + Math.sin(self.floatPhase) * 0.5;
self.y += self.velocityY + Math.cos(self.floatPhase) * 0.3;
self.life--;
var alpha = Math.min(1, self.life / 60) * Math.min(1, (self.maxLife - self.life) / 60) * 0.4;
particleGfx.alpha = alpha;
particleGfx.scaleX = 0.5;
particleGfx.scaleY = 0.5;
if (self.life <= 0) {
self.shouldDestroy = true;
}
};
return self;
});
var BackgroundShape = Container.expand(function () {
var self = Container.call(this);
var shapeGfx = self.attachAsset('bgShape', {
anchorX: 0.5,
anchorY: 0.5
});
self.pulsePhase = Math.random() * Math.PI * 2;
self.oscillatePhase = Math.random() * Math.PI * 2;
self.floatSpeed = 0.02 + Math.random() * 0.03;
self.pulseSpeed = 0.05 + Math.random() * 0.05;
self.baseScale = 0.5 + Math.random() * 1.0;
self.baseAlpha = 0.1 + Math.random() * 0.2;
self.update = function () {
self.pulsePhase += self.pulseSpeed;
self.oscillatePhase += self.floatSpeed;
// Pulsing with beat
var beatScale = 1 + beatPulse * 0.3;
var pulseScale = 1 + Math.sin(self.pulsePhase) * 0.2;
shapeGfx.scaleX = self.baseScale * beatScale * pulseScale;
shapeGfx.scaleY = self.baseScale * beatScale * pulseScale;
// Oscillating movement
self.x += Math.sin(self.oscillatePhase) * 0.5;
self.y += Math.cos(self.oscillatePhase * 0.7) * 0.3;
// Alpha varies with intensity
shapeGfx.alpha = self.baseAlpha + beatPulse * 0.1;
// Slow drift
self.x -= gameSpeed * 0.2;
};
return self;
});
var BurstParticle = Container.expand(function () {
var self = Container.call(this);
var particleGfx = self.attachAsset('particle', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = 0;
self.velocityY = 0;
self.life = 40;
self.maxLife = 40;
self.initialScale = 1.5;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.velocityX *= 0.95;
self.velocityY *= 0.95;
self.life--;
var alpha = self.life / self.maxLife;
particleGfx.alpha = alpha;
var scale = self.initialScale * alpha;
particleGfx.scaleX = scale;
particleGfx.scaleY = scale;
if (self.life <= 0) {
self.shouldDestroy = true;
}
};
return self;
});
var Cloud = Container.expand(function () {
var self = Container.call(this);
var cloudGlow = self.attachAsset('cloudGlow', {
anchorX: 0.5,
anchorY: 0.5
});
var cloudCore = self.attachAsset('cloud', {
anchorX: 0.5,
anchorY: 0.5
});
cloudGlow.alpha = 0.4;
cloudCore.alpha = 0.9;
self.speed = -4;
self.floatPhase = Math.random() * Math.PI * 2;
self.glowPhase = Math.random() * Math.PI * 2;
self.bouncePhase = 0;
self.isBouncing = false;
self.bounceIntensity = 0;
self.mistTimer = 0;
self.update = function () {
self.x += self.speed;
// Gentle floating animation
self.floatPhase += 0.03;
var floatY = Math.sin(self.floatPhase) * 8;
self.y += floatY * 0.1;
// Soft glow pulsing
self.glowPhase += 0.05;
var glowIntensity = 0.3 + Math.sin(self.glowPhase) * 0.1;
cloudGlow.alpha = glowIntensity;
// Bounce animation when stepped on
if (self.isBouncing) {
self.bouncePhase += 0.3;
self.bounceIntensity = Math.sin(self.bouncePhase) * 0.5;
cloudCore.scaleY = 1 - self.bounceIntensity * 0.2;
cloudGlow.scaleY = 1 - self.bounceIntensity * 0.15;
if (self.bouncePhase >= Math.PI) {
self.isBouncing = false;
self.bouncePhase = 0;
cloudCore.scaleY = 1;
cloudGlow.scaleY = 1;
}
}
// Create mist particles
self.mistTimer++;
if (self.mistTimer >= 40) {
self.mistTimer = 0;
self.createMist();
}
};
self.bounce = function () {
if (!self.isBouncing) {
self.isBouncing = true;
self.bouncePhase = 0;
// Play soft bounce sound
if (Math.random() < 0.3) {
LK.getSound('echoChime').play();
}
}
};
self.createMist = function () {
// Mist creation disabled
};
return self;
});
var DataStreamParticle = Container.expand(function () {
var self = Container.call(this);
var streamGfx = self.attachAsset('dataStream', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = -1 - Math.random() * 3;
self.velocityY = (Math.random() - 0.5) * 2;
self.life = 300 + Math.random() * 200;
self.maxLife = self.life;
self.twinklePhase = Math.random() * Math.PI * 2;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.twinklePhase += 0.1;
self.life--;
// Twinkling effect
var twinkle = Math.sin(self.twinklePhase) * 0.3;
var fadeAlpha = Math.min(1, self.life / 60) * Math.min(1, (self.maxLife - self.life) / 60);
streamGfx.alpha = (0.3 + twinkle + beatPulse * 0.2) * fadeAlpha;
streamGfx.scaleX = 0.8 + beatPulse * 0.4;
streamGfx.scaleY = 0.8 + beatPulse * 0.4;
if (self.life <= 0) {
self.shouldDestroy = true;
}
};
return self;
});
var ExplosionPart = Container.expand(function () {
var self = Container.call(this);
var partGfx = self.attachAsset('explosionPart', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = 0;
self.velocityY = 0;
self.rotationSpeed = 0;
self.life = 40;
self.maxLife = 40;
self.gravity = 0.3;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.velocityY += self.gravity;
self.velocityX *= 0.98;
partGfx.rotation += self.rotationSpeed;
self.life--;
var alpha = self.life / self.maxLife;
partGfx.alpha = alpha;
// Color transition from bright orange to dark red
var colorProgress = 1 - alpha;
var red = 255;
var green = Math.floor(170 * (1 - colorProgress));
var blue = 0;
partGfx.tint = red << 16 | green << 8 | blue;
var scale = alpha * (1 + (1 - alpha) * 0.5);
partGfx.scaleX = scale;
partGfx.scaleY = scale;
if (self.life <= 0) {
self.shouldDestroy = true;
}
};
return self;
});
var GroundSegment = Container.expand(function () {
var self = Container.call(this);
var groundGfx = self.attachAsset('ground', {
anchorX: 0,
anchorY: 0
});
var shimmerGfx = self.attachAsset('groundShimmer', {
anchorX: 0,
anchorY: 0
});
shimmerGfx.y = -8;
self.shimmerPhase = Math.random() * Math.PI * 2;
self.wavePhase = Math.random() * Math.PI * 2;
self.beatIntensity = 0;
self.update = function () {
// Reflective shimmer effect
self.shimmerPhase += 0.08;
shimmerGfx.alpha = 0.4 + Math.sin(self.shimmerPhase) * 0.3;
shimmerGfx.scaleX = 1 + Math.sin(self.shimmerPhase * 0.7) * 0.1;
// Waveform moving through ground
self.wavePhase += gameSpeed * 0.02;
var waveOffset = Math.sin(self.wavePhase) * 3;
groundGfx.y = waveOffset;
shimmerGfx.y = -8 + waveOffset;
// Beat-synced effects
self.beatIntensity = beatPulse;
var glowIntensity = 0.7 + self.beatIntensity * 0.3;
groundGfx.alpha = glowIntensity;
// Color changes based on beat
var beatColor = Math.floor(self.beatIntensity * 80);
groundGfx.tint = 0x4488ff + beatColor;
shimmerGfx.tint = 0x88ccff + (beatColor << 4);
// Motion matching scrolling tempo
self.x -= gameSpeed;
};
return self;
});
var Heart = Container.expand(function () {
var self = Container.call(this);
var heartGfx = self.attachAsset('heart', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -8;
self.pulsePhase = Math.random() * Math.PI * 2;
self.glowPhase = Math.random() * Math.PI * 2;
self.isPulsing = false;
self.pulseTimer = 0;
self.maxPulseTime = 60; // 1 second at 60fps
self.sparkleTimer = 0;
self.update = function () {
self.x += self.speed;
// Gentle floating
self.pulsePhase += 0.08;
var floatY = Math.sin(self.pulsePhase) * 8;
self.y += floatY * 0.05;
// Check if should pulse with beat
if (beatPulse > 0.7 && !self.isPulsing) {
self.isPulsing = true;
self.pulseTimer = self.maxPulseTime;
}
// Handle pulsing state
if (self.isPulsing) {
self.pulseTimer--;
// Bright glow and scale during pulse
var pulseIntensity = self.pulseTimer / self.maxPulseTime;
heartGfx.alpha = 0.8 + pulseIntensity * 0.2;
heartGfx.scaleX = 1.0 + pulseIntensity * 0.4;
heartGfx.scaleY = 1.0 + pulseIntensity * 0.4;
heartGfx.tint = 0xff1144; // Bright red when pulsing
// Sparkle creation disabled
if (self.pulseTimer <= 0) {
self.isPulsing = false;
}
} else {
// Normal state - gentle glow
self.glowPhase += 0.05;
heartGfx.alpha = 0.7 + Math.sin(self.glowPhase) * 0.2;
heartGfx.scaleX = 1.0 + Math.sin(self.glowPhase) * 0.1;
heartGfx.scaleY = 1.0 + Math.sin(self.glowPhase) * 0.1;
heartGfx.tint = 0xff3366; // Normal pink-red
}
};
return self;
});
var HolographicElement = Container.expand(function () {
var self = Container.call(this);
var elementType = Math.floor(Math.random() * 3);
var elementGfx;
if (elementType === 0) {
elementGfx = self.attachAsset('waveform', {
anchorX: 0.5,
anchorY: 0.5
});
} else if (elementType === 1) {
elementGfx = self.attachAsset('speaker', {
anchorX: 0.5,
anchorY: 0.5
});
} else {
elementGfx = self.attachAsset('freqBar', {
anchorX: 0.5,
anchorY: 1
});
}
self.fadePhase = 0;
self.maxFadePhase = 300 + Math.random() * 200;
self.pulsePhase = Math.random() * Math.PI * 2;
self.driftSpeed = -0.5 - Math.random() * 1.5;
self.baseScale = 2 + Math.random() * 3;
self.update = function () {
self.fadePhase++;
self.pulsePhase += 0.03;
self.x += self.driftSpeed;
// Fade in and out effect
var fadeProgress = self.fadePhase / self.maxFadePhase;
var fadeAlpha;
if (fadeProgress < 0.2) {
fadeAlpha = fadeProgress / 0.2;
} else if (fadeProgress > 0.8) {
fadeAlpha = (1 - fadeProgress) / 0.2;
} else {
fadeAlpha = 1;
}
// Very faint holographic appearance
elementGfx.alpha = fadeAlpha * (0.05 + beatPulse * 0.1);
// Pulse with beat
var scale = self.baseScale * (1 + Math.sin(self.pulsePhase) * 0.1 + beatPulse * 0.2);
elementGfx.scaleX = scale;
elementGfx.scaleY = scale;
// Color tinting for holographic effect
elementGfx.tint = 0x4466aa + Math.floor(beatPulse * 50);
if (self.fadePhase >= self.maxFadePhase) {
self.shouldDestroy = true;
}
};
return self;
});
var LaserBeam = Container.expand(function () {
var self = Container.call(this);
// Laser core that moves up and down
var laserCore = self.attachAsset('laserCore', {
anchorX: 0.5,
anchorY: 0.5
});
// Main laser beam
var laserBeam = self.attachAsset('laserBeam', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -6;
self.verticalSpeed = 3;
self.direction = 1; // 1 for down, -1 for up
self.warningTimer = 60; // Warning phase before activation
self.isActive = false;
self.pulsePhase = 0;
self.coreY = 0;
self.maxTravel = 150;
// Initially hide the beam, show only core
laserBeam.alpha = 0;
laserCore.y = -self.maxTravel;
self.update = function () {
self.x += self.speed;
// Warning phase
if (self.warningTimer > 0) {
self.warningTimer--;
// Blinking warning effect
laserCore.alpha = Math.sin(self.warningTimer * 0.3) * 0.5 + 0.5;
laserCore.tint = 0xff0000; // Red warning
if (self.warningTimer === 0) {
self.isActive = true;
laserBeam.alpha = 0.9;
}
}
// Active laser movement
if (self.isActive) {
self.coreY += self.verticalSpeed * self.direction;
laserCore.y = self.coreY;
// Reverse direction at limits
if (self.coreY >= self.maxTravel || self.coreY <= -self.maxTravel) {
self.direction *= -1;
}
// Pulse effects
self.pulsePhase += 0.15;
var intensity = 0.8 + Math.sin(self.pulsePhase) * 0.2 + beatPulse * 0.3;
laserBeam.alpha = intensity;
laserCore.alpha = 1.0;
// Bright laser colors
laserBeam.tint = 0xff0088 + Math.floor(beatPulse * 100);
laserCore.tint = 0xffffff;
// Scale effects
var scale = 1 + beatPulse * 0.4;
laserBeam.scaleX = scale;
laserCore.scaleX = 1 + beatPulse * 0.6;
laserCore.scaleY = 1 + beatPulse * 0.6;
}
};
return self;
});
var LightLine = Container.expand(function () {
var self = Container.call(this);
var lineGfx = self.attachAsset('lightLine', {
anchorX: 0,
anchorY: 0.5
});
self.speed = -2 - Math.random() * 4;
self.pulsePhase = Math.random() * Math.PI * 2;
self.glowPhase = Math.random() * Math.PI * 2;
self.baseAlpha = 0.2 + Math.random() * 0.3;
self.update = function () {
self.x += self.speed;
self.pulsePhase += 0.08;
self.glowPhase += 0.05;
// Flowing glow effect
lineGfx.alpha = self.baseAlpha + Math.sin(self.glowPhase) * 0.2 + beatPulse * 0.2;
lineGfx.scaleY = 0.8 + Math.sin(self.pulsePhase) * 0.4 + beatPulse * 0.3;
// Color shift with beat
var colorShift = Math.floor(beatPulse * 100);
lineGfx.tint = 0x6644ff + (colorShift << 8);
};
return self;
});
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGfx = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 1
});
self.speed = -6;
self.pulsePhase = 0;
self.update = function () {
self.x += self.speed;
// Pulse effect
self.pulsePhase += 0.15;
var scale = 1 + Math.sin(self.pulsePhase) * 0.1;
obstacleGfx.scaleX = scale;
obstacleGfx.scaleY = scale;
// Beat sync glow
if (beatPulse > 0.5) {
obstacleGfx.tint = 0xffffff;
} else {
obstacleGfx.tint = 0xff0044;
}
};
return self;
});
var Particle = Container.expand(function () {
var self = Container.call(this);
var particleGfx = self.attachAsset('particle', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = 0;
self.velocityY = 0;
self.life = 60;
self.maxLife = 60;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.velocityY += 0.2;
self.life--;
particleGfx.alpha = self.life / self.maxLife;
if (self.life <= 0) {
self.shouldDestroy = true;
}
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
// Create main glow aura behind character
var mainGlow = self.attachAsset('playerGlow', {
anchorX: 0.5,
anchorY: 0.5
});
mainGlow.alpha = 0.3;
mainGlow.y = -10;
// Create body parts with neon light appearance
var head = self.attachAsset('playerHead', {
anchorX: 0.5,
anchorY: 0.5
});
var body = self.attachAsset('playerBody', {
anchorX: 0.5,
anchorY: 0
});
var leftArm = self.attachAsset('playerArm', {
anchorX: 0.5,
anchorY: 0
});
var rightArm = self.attachAsset('playerArm', {
anchorX: 0.5,
anchorY: 0
});
var leftLeg = self.attachAsset('playerLeg', {
anchorX: 0.5,
anchorY: 0
});
var rightLeg = self.attachAsset('playerLeg', {
anchorX: 0.5,
anchorY: 0
});
// Position body parts relative to center
head.y = -30;
body.y = -12;
leftArm.x = -10;
leftArm.y = -8;
rightArm.x = 10;
rightArm.y = -8;
leftLeg.x = -6;
leftLeg.y = 13;
rightLeg.x = 6;
rightLeg.y = 13;
// Set initial electric blue color with glow effect
head.tint = 0x00ccff;
body.tint = 0x0099ff;
leftArm.tint = 0x0088ff;
rightArm.tint = 0x0088ff;
leftLeg.tint = 0x0077ff;
rightLeg.tint = 0x0077ff;
self.velocityY = 0;
self.velocityX = 0;
self.isGrounded = false;
self.isDashing = false;
self.dashCooldown = 0;
self.canDoubleJump = false;
self.hasUsedDoubleJump = false;
self.hasJumped = false; // Track if player has actually jumped
self.glowPhase = 0;
self.walkPhase = 0;
self.constantSpeed = 3; // Constant walking speed
self.hoverPhase = 0;
self.beatReactionTimer = 0;
self.currentHue = 0; // For color shifting
self.comboStreakColor = 0x00ccff; // Base electric blue
self.update = function () {
// Floating effect - character hovers above ground
self.hoverPhase += 0.08;
var hoverOffset = Math.sin(self.hoverPhase) * 3;
// Gravity with floating adjustment - tuned for variable jump
if (!self.isGrounded) {
if (gamePhase === 3) {
// Slower fall speed in sky level
if (self.velocityY < 0) {
// Rising - normal gravity
self.velocityY += 0.5;
} else {
// Falling - reduced gravity for floatier feel
self.velocityY += 0.35;
}
// Enable jump when falling in sky level
if (self.velocityY > 0) {
// If player hasn't jumped yet (just falling from platform), allow first jump
if (!self.hasJumped) {
self.canDoubleJump = false; // This allows first jump
self.hasUsedDoubleJump = false; // Reset double jump flag
}
}
} else {
// Normal/speed phase - apply different gravity when rising vs falling
if (self.velocityY < 0) {
// Rising - normal gravity
self.velocityY += 0.7;
} else {
// Falling - reduced gravity for better control
self.velocityY += 0.45;
}
}
}
// Apply velocity
self.y += self.velocityY;
self.x += self.velocityX;
// Constant forward movement when grounded
if (self.isGrounded && !self.isDashing) {
self.x += self.constantSpeed;
}
// Ground collision with hover offset (only in normal/speed phases)
if (gamePhase !== 3) {
var groundThreshold = groundLevel - 35 + hoverOffset;
if (self.y >= groundThreshold) {
self.y = groundThreshold;
self.velocityY = 0;
self.isGrounded = true;
self.canDoubleJump = false;
self.hasUsedDoubleJump = false;
self.hasJumped = false; // Reset jump flag when grounded
}
} else {
// Sky level - check if player is actually on a cloud or seagull
var onPlatform = false;
// Check if standing on any cloud
for (var i = 0; i < clouds.length; i++) {
var cloud = clouds[i];
if (self.intersects(cloud) && self.velocityY >= 0 && self.y <= cloud.y) {
onPlatform = true;
break;
}
}
// Check if standing on any seagull
if (!onPlatform) {
for (var i = 0; i < seagulls.length; i++) {
var seagull = seagulls[i];
if (self.intersects(seagull) && self.velocityY >= 0 && self.y <= seagull.y) {
onPlatform = true;
break;
}
}
}
// If not on any platform, player should fall
if (!onPlatform) {
// Track if player was grounded before falling
var wasGrounded = self.isGrounded;
self.isGrounded = false;
// If player just started falling (was on platform, now falling)
if (wasGrounded) {
// Reset jump flags to allow jumping while falling
self.hasJumped = false;
self.canDoubleJump = false;
self.hasUsedDoubleJump = false;
}
} else {
// Player is on a platform
self.isGrounded = true;
self.canDoubleJump = false;
self.hasUsedDoubleJump = false;
self.hasJumped = false;
}
}
// Removed backward movement from gameSpeed to prevent character going backwards
// Dash cooldown
if (self.dashCooldown > 0) {
self.dashCooldown--;
}
// Rhythmic bouncing and running animation
if (self.isGrounded && !self.isDashing) {
self.walkPhase += 0.25;
// Energetic arm movements
leftArm.rotation = Math.sin(self.walkPhase) * 0.6;
rightArm.rotation = -Math.sin(self.walkPhase) * 0.6;
// Dynamic leg running motion
leftLeg.rotation = Math.sin(self.walkPhase + Math.PI) * 0.4;
rightLeg.rotation = Math.sin(self.walkPhase) * 0.4;
// Head bobbing with beat awareness
var beatBob = beatPulse > 0.5 ? beatPulse * 2 : 0;
head.y = -30 + Math.sin(self.walkPhase * 2) * 2 + beatBob;
} else {
// Reset positions when not walking
leftArm.rotation = 0;
rightArm.rotation = 0;
leftLeg.rotation = 0;
rightLeg.rotation = 0;
head.y = -30;
}
// Neon glow effects with beat reaction
self.glowPhase += 0.12;
var baseGlow = 0.9 + Math.sin(self.glowPhase) * 0.1;
var beatGlow = beatPulse * 0.3;
var totalGlow = Math.min(1.0, baseGlow + beatGlow);
// Beat reaction timer
if (self.beatReactionTimer > 0) {
self.beatReactionTimer--;
totalGlow = 1.0;
}
// Apply glow to all parts
head.alpha = totalGlow;
body.alpha = totalGlow;
leftArm.alpha = totalGlow;
rightArm.alpha = totalGlow;
leftLeg.alpha = totalGlow;
rightLeg.alpha = totalGlow;
// Main glow pulsing
mainGlow.alpha = 0.2 + beatPulse * 0.3;
mainGlow.scaleX = 1 + Math.sin(self.glowPhase * 0.7) * 0.1 + beatPulse * 0.2;
mainGlow.scaleY = 1 + Math.sin(self.glowPhase * 0.7) * 0.1 + beatPulse * 0.2;
// Color shifting based on combo streak and game phase
if (combo > 0) {
self.currentHue += 0.02;
var hueShift = Math.sin(self.currentHue) * 60;
if (gamePhase === 3) {
// Sky phase - soft golden colors
self.comboStreakColor = 0xffcc66 + Math.floor(hueShift);
} else if (gamePhase === 2) {
// Speed phase - orange/red colors
self.comboStreakColor = 0xff8800 + Math.floor(hueShift);
} else {
// Normal phase - blue colors
self.comboStreakColor = 0x0088ff + Math.floor(hueShift);
}
// Apply combo colors
head.tint = self.comboStreakColor + 0x2200;
body.tint = self.comboStreakColor;
leftArm.tint = self.comboStreakColor - 0x1100;
rightArm.tint = self.comboStreakColor - 0x1100;
leftLeg.tint = self.comboStreakColor - 0x2200;
rightLeg.tint = self.comboStreakColor - 0x2200;
mainGlow.tint = self.comboStreakColor;
} else {
if (gamePhase === 3) {
// Sky phase - soft golden/white colors
head.tint = 0xffffdd;
body.tint = 0xffeeaa;
leftArm.tint = 0xffdd88;
rightArm.tint = 0xffdd88;
leftLeg.tint = 0xffcc66;
rightLeg.tint = 0xffcc66;
mainGlow.tint = 0xffee99;
} else if (gamePhase === 2) {
// Speed phase - orange colors
head.tint = 0xff9900;
body.tint = 0xff7700;
leftArm.tint = 0xff6600;
rightArm.tint = 0xff6600;
leftLeg.tint = 0xff5500;
rightLeg.tint = 0xff5500;
mainGlow.tint = 0xff8800;
} else {
// Normal phase - electric blue
head.tint = 0x00ccff;
body.tint = 0x0099ff;
leftArm.tint = 0x0088ff;
rightArm.tint = 0x0088ff;
leftLeg.tint = 0x0077ff;
rightLeg.tint = 0x0077ff;
mainGlow.tint = 0x0088ff;
}
self.currentHue = 0;
}
// Keep player on screen
if (self.x < 0) self.x = 0;
if (self.x > 2048) self.x = 2048;
};
// Jump method removed - now handled by variable jump system in main game loop
self.dash = function () {
if (self.dashCooldown <= 0) {
self.velocityX = currentDashDistance; // Use dynamic dash distance
self.isDashing = true;
self.dashCooldown = 30;
LK.getSound('dash').play();
self.createDashEffect();
// Reduce dash distance for next use
currentDashDistance = Math.max(minDashDistance, currentDashDistance - dashDecayRate);
dashResetTimer = 0; // Reset the timer when dashing
tween(self, {
velocityX: 0
}, {
duration: 400
});
LK.setTimeout(function () {
self.isDashing = false;
}, 400);
}
};
self.createJumpEffect = function () {
for (var i = 0; i < 5; i++) {
var particle = new Particle();
particle.x = self.x + (Math.random() - 0.5) * 40;
particle.y = self.y + 20;
particle.velocityY = Math.random() * 5 + 2;
particle.velocityX = (Math.random() - 0.5) * 8;
game.addChild(particle);
particles.push(particle);
}
};
self.createDashEffect = function () {
for (var i = 0; i < 8; i++) {
var particle = new Particle();
particle.x = self.x - 30;
particle.y = self.y + (Math.random() - 0.5) * 40;
particle.velocityY = (Math.random() - 0.5) * 6;
particle.velocityX = -Math.random() * 10 - 5;
game.addChild(particle);
particles.push(particle);
}
};
// React to beats with flash and pulse
self.reactToBeat = function () {
self.beatReactionTimer = 8; // Flash for 8 frames
// Bright flash effect
tween(self, {
alpha: 1.2
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self, {
alpha: 1.0
}, {
duration: 200,
easing: tween.easeInOut
});
}
});
// Scale pulse
tween(self, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 150,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 250,
easing: tween.easeInOut
});
}
});
};
return self;
});
var RotatingCube = Container.expand(function () {
var self = Container.call(this);
var cubeGfx = self.attachAsset('rotatingCube', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -6;
self.rotationSpeed = 0.1 + Math.random() * 0.1;
self.pulsePhase = 0;
self.glowPhase = Math.random() * Math.PI * 2;
self.update = function () {
self.x += self.speed;
// Continuous rotation
cubeGfx.rotation += self.rotationSpeed;
// Pulse effect with beat
self.pulsePhase += 0.1;
var scale = 1 + Math.sin(self.pulsePhase) * 0.2 + beatPulse * 0.3;
cubeGfx.scaleX = scale;
cubeGfx.scaleY = scale;
// Glow effect
self.glowPhase += 0.08;
cubeGfx.alpha = 0.8 + Math.sin(self.glowPhase) * 0.2 + beatPulse * 0.2;
// Color shifting
var colorShift = Math.floor(beatPulse * 100);
cubeGfx.tint = 0xff4400 + (colorShift << 4);
};
return self;
});
var Seagull = Container.expand(function () {
var self = Container.call(this);
// Create seagull body
var body = self.attachAsset('seagullBody', {
anchorX: 0.5,
anchorY: 0.5
});
// Create wings
var leftWing = self.attachAsset('seagullWing', {
anchorX: 0.8,
anchorY: 0.5
});
var rightWing = self.attachAsset('seagullWing', {
anchorX: 0.2,
anchorY: 0.5
});
// Position wings
leftWing.x = -15;
leftWing.y = -3;
rightWing.x = 15;
rightWing.y = -3;
// Flight properties
self.speed = -5 - Math.random() * 2; // Slightly faster than clouds
self.wingPhase = Math.random() * Math.PI * 2;
self.wingSpeed = 0.3 + Math.random() * 0.2;
self.floatPhase = Math.random() * Math.PI * 2;
self.floatAmplitude = 15 + Math.random() * 10;
self.baseY = 0;
self.update = function () {
self.x += self.speed;
// Wing flapping animation
self.wingPhase += self.wingSpeed;
var wingFlap = Math.sin(self.wingPhase);
leftWing.rotation = wingFlap * 0.4;
rightWing.rotation = -wingFlap * 0.4;
leftWing.scaleY = 0.8 + wingFlap * 0.3;
rightWing.scaleY = 0.8 + wingFlap * 0.3;
// Graceful floating movement
self.floatPhase += 0.02;
var floatOffset = Math.sin(self.floatPhase) * self.floatAmplitude;
self.y = self.baseY + floatOffset;
// Subtle size pulsing for life-like movement
var sizePulse = 1 + Math.sin(self.wingPhase * 0.7) * 0.1;
body.scaleX = sizePulse;
body.scaleY = sizePulse;
// Slight transparency for ethereal sky feel
body.alpha = 0.9;
leftWing.alpha = 0.85;
rightWing.alpha = 0.85;
};
return self;
});
var ShatterPart = Container.expand(function () {
var self = Container.call(this);
var shatterGfx = self.attachAsset('shatter', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = 0;
self.velocityY = 0;
self.rotationSpeed = 0;
self.life = 60;
self.maxLife = 60;
self.gravity = 0.2;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.velocityY += self.gravity;
self.velocityX *= 0.96;
shatterGfx.rotation += self.rotationSpeed;
self.life--;
var alpha = self.life / self.maxLife;
shatterGfx.alpha = alpha;
var scale = alpha * 0.8;
shatterGfx.scaleX = scale;
shatterGfx.scaleY = scale;
if (self.life <= 0) {
self.shouldDestroy = true;
}
};
return self;
});
var SunRay = Container.expand(function () {
var self = Container.call(this);
var rayGfx = self.attachAsset('sunRay', {
anchorX: 0,
anchorY: 0.5
});
self.speed = -1.5;
self.fadePhase = 0;
self.maxFadePhase = 600;
self.glowPhase = Math.random() * Math.PI * 2;
self.angle = (Math.random() - 0.5) * 0.3;
rayGfx.rotation = self.angle;
rayGfx.alpha = 0.3;
self.update = function () {
self.x += self.speed;
self.fadePhase++;
self.glowPhase += 0.02;
// Fade in and out effect
var fadeProgress = self.fadePhase / self.maxFadePhase;
var fadeAlpha;
if (fadeProgress < 0.3) {
fadeAlpha = fadeProgress / 0.3;
} else if (fadeProgress > 0.7) {
fadeAlpha = (1 - fadeProgress) / 0.3;
} else {
fadeAlpha = 1;
}
// Gentle glow pulsing
var glow = 0.8 + Math.sin(self.glowPhase) * 0.2;
rayGfx.alpha = fadeAlpha * glow * 0.25;
if (self.fadePhase >= self.maxFadePhase) {
self.shouldDestroy = true;
}
};
return self;
});
var TrailParticle = Container.expand(function () {
var self = Container.call(this);
var particleGfx = self.attachAsset('trailGlow', {
anchorX: 0.5,
anchorY: 0.5
});
self.life = 40;
self.maxLife = 40;
self.targetX = 0;
self.targetY = 0;
self.followSpeed = 0.12;
self.pulsePhase = Math.random() * Math.PI * 2;
self.update = function () {
// Follow target with smooth movement
self.x += (self.targetX - self.x) * self.followSpeed;
self.y += (self.targetY - self.y) * self.followSpeed;
self.life--;
self.pulsePhase += 0.15;
// Bright motion trail that pulses with beat
var fadeAlpha = self.life / self.maxLife;
var pulseEffect = 1 + Math.sin(self.pulsePhase) * 0.3 + beatPulse * 0.4;
particleGfx.alpha = fadeAlpha * 0.8 * pulseEffect;
var scale = fadeAlpha * 1.2 * pulseEffect;
particleGfx.scaleX = scale;
particleGfx.scaleY = scale;
// Color matches player's current color and game phase
if (gamePhase === 3) {
particleGfx.tint = player ? player.comboStreakColor : 0xffee99;
} else if (gamePhase === 2) {
particleGfx.tint = player ? player.comboStreakColor : 0xff8800;
} else {
particleGfx.tint = player ? player.comboStreakColor : 0x00aaff;
}
if (self.life <= 0) {
self.shouldDestroy = true;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x0a0520
});
/****
* Game Code
****/
// Game variables
var player;
var playerLives = 3;
var maxLives = 5;
var hearts = [];
var heartSpawnTimer = 0;
var heartSpawnInterval = 900; // 15 seconds at 60fps
var lifePopupTimer = 0;
var lifePopupText = null;
// Dash distance decay system
var maxDashDistance = 15; // Maximum dash distance
var currentDashDistance = 15; // Current dash distance
var dashDecayRate = 0.05; // How much distance decreases per dash
var minDashDistance = 3; // Minimum dash distance
var dashResetTimer = 0;
var dashResetInterval = 600; // 10 seconds at 60fps to reset dash distance
var obstacles = [];
var rotatingCubes = [];
var laserBeams = [];
var explosionParts = [];
var shatterParts = [];
var particles = [];
var trailParticles = [];
var ambientParticles = [];
var burstParticles = [];
var backgroundShapes = [];
var lightLines = [];
var dataStreamParticles = [];
var holographicElements = [];
var groundLevel = 2200;
var gameSpeed = 6;
var spawnTimer = 0;
var beatTimer = 0;
var beatInterval = 60; // 60 frames = 1 second at 60fps
var beatPulse = 0;
var combo = 0;
var perfectHits = 0;
var trailTimer = 0;
var ambientTimer = 0;
var bgShapeTimer = 0;
var lightLineTimer = 0;
var dataStreamTimer = 0;
var holographicTimer = 0;
// Game phase variables
var gamePhase = 1; // 1 = normal, 2 = speed phase after 1000 points, 3 = sky level after 2000 points
var phaseTransitioned = false;
var skyTransitioned = false;
var clouds = [];
var sunRays = [];
var seagulls = [];
var sunRayTimer = 0;
var cloudSpawnTimer = 0;
var seagullSpawnTimer = 0;
// Camera variables
var cameraTargetX = 0;
var cameraTargetY = 0;
var cameraShakeIntensity = 0;
var cameraShakeDecay = 0.9;
var cameraZoom = 1;
var cameraTargetZoom = 1;
var cameraFollowSpeed = 0.1;
// UI
var scoreText = new Text2('Score: 0', {
size: 80,
fill: 0x00FFFF
});
scoreText.anchor.set(0, 0);
scoreText.x = 100;
scoreText.y = 100;
LK.gui.topLeft.addChild(scoreText);
var comboText = new Text2('Combo: 0', {
size: 60,
fill: 0xFFFF00
});
comboText.anchor.set(0, 0);
comboText.x = 100;
comboText.y = 200;
LK.gui.topLeft.addChild(comboText);
// Dash distance display
var dashText = new Text2('Dash: 100%', {
size: 50,
fill: 0x00ff88
});
dashText.anchor.set(0, 0);
dashText.x = 100;
dashText.y = 280;
LK.gui.topLeft.addChild(dashText);
// Debug display for dash values
var dashDebugText = new Text2('Debug', {
size: 40,
fill: 0xffffff
});
dashDebugText.anchor.set(0, 0);
dashDebugText.x = 100;
dashDebugText.y = 350;
LK.gui.topLeft.addChild(dashDebugText);
var dashTimerText = new Text2('Timer', {
size: 40,
fill: 0xffaa00
});
dashTimerText.anchor.set(0, 0);
dashTimerText.x = 100;
dashTimerText.y = 420;
LK.gui.topLeft.addChild(dashTimerText);
// Lives display in top right - using heart symbols
var livesContainer = new Container();
livesContainer.x = -100;
livesContainer.y = 100;
LK.gui.topRight.addChild(livesContainer);
var heartSymbols = [];
function updateLivesDisplay() {
// Clear existing hearts
for (var i = 0; i < heartSymbols.length; i++) {
livesContainer.removeChild(heartSymbols[i]);
heartSymbols[i].destroy();
}
heartSymbols = [];
// Create heart symbols for current lives
for (var i = 0; i < playerLives; i++) {
var heartSymbol = LK.getAsset('heart', {
anchorX: 1,
anchorY: 0,
scaleX: 0.8,
scaleY: 0.8
});
heartSymbol.x = -i * 35;
heartSymbol.y = 0;
heartSymbol.tint = 0xff3366;
livesContainer.addChild(heartSymbol);
heartSymbols.push(heartSymbol);
}
}
// Initialize lives display
updateLivesDisplay();
// Create ground with shimmer effects
var ground = [];
for (var i = 0; i < 12; i++) {
var groundSegment = new GroundSegment();
groundSegment.x = i * 300;
groundSegment.y = groundLevel;
ground.push(groundSegment);
game.addChild(groundSegment);
}
// Create player
player = new Player();
player.x = 300;
player.y = groundLevel - 30;
game.addChild(player);
// Background pulse effect
function updateBackgroundPulse() {
var intensity = beatPulse * 0.2;
var fastSection = gameSpeed > 8 ? 1 : 0; // Detect fast sections
if (gamePhase === 3) {
// Sky phase - gradient from soft blue to pinkish-purple
var baseRed = 180 + Math.floor(intensity * 40) + fastSection * 20;
var baseGreen = 220 + Math.floor(intensity * 20) + fastSection * 10;
var baseBlue = 255;
} else if (gamePhase === 2) {
// Speed phase - orange/red colors
var baseRed = 60 + Math.floor(intensity * 50) + fastSection * 40;
var baseGreen = 20 + Math.floor(intensity * 30) + fastSection * 20;
var baseBlue = 5 + Math.floor(intensity * 15) + fastSection * 10;
} else {
// Normal phase - deep black to dark purple with intensity variations
var baseRed = 10 + Math.floor(intensity * 30) + fastSection * 20;
var baseGreen = 5 + Math.floor(intensity * 20) + fastSection * 10;
var baseBlue = 32 + Math.floor(intensity * 40) + fastSection * 30;
}
var backgroundColor = baseRed << 16 | baseGreen << 8 | baseBlue;
game.setBackgroundColor(backgroundColor);
}
// Camera system with smooth scrolling and beat sync
function updateCamera() {
// Smooth camera follow player
cameraTargetX = -player.x + 400; // Offset to keep player visible
cameraTargetY = -player.y + 1600; // Vertical centering
// Apply smooth camera movement
game.x += (cameraTargetX - game.x) * cameraFollowSpeed;
game.y += (cameraTargetY - game.y) * cameraFollowSpeed;
// Apply camera shake
if (cameraShakeIntensity > 0) {
game.x += (Math.random() - 0.5) * cameraShakeIntensity;
game.y += (Math.random() - 0.5) * cameraShakeIntensity;
cameraShakeIntensity *= cameraShakeDecay;
}
// Smooth zoom interpolation
cameraZoom += (cameraTargetZoom - cameraZoom) * 0.05;
game.scaleX = cameraZoom;
game.scaleY = cameraZoom;
// Beat-synced zoom pulse with sky level zoom
if (gamePhase === 3) {
// Sky level - zoomed in view
if (beatPulse > 0.8) {
cameraTargetZoom = 1.25; // Zoomed in with beat pulse
} else {
cameraTargetZoom = 1.2; // Base zoom for sky level
}
} else {
// Normal/speed phase - regular zoom
if (beatPulse > 0.8) {
cameraTargetZoom = 1.05;
} else {
cameraTargetZoom = 1.0;
}
}
}
// Spawn obstacles on beat
function spawnObstacle() {
if (gamePhase === 3) {
// Sky level - mostly spawn clouds instead of obstacles
if (Math.random() < 0.3) {
spawnCloud();
}
return;
}
var obstacleType = Math.random();
if (obstacleType < 0.4) {
// Regular obstacle
var obstacle = new Obstacle();
obstacle.x = 2200;
obstacle.y = groundLevel;
obstacles.push(obstacle);
game.addChild(obstacle);
} else if (obstacleType < 0.7) {
// Rotating cube
var cube = new RotatingCube();
cube.x = 2200;
cube.y = groundLevel - 60 - Math.random() * 80;
rotatingCubes.push(cube);
game.addChild(cube);
} else {
// Laser beam
var laser = new LaserBeam();
laser.x = 2200;
laser.y = groundLevel - 200;
laserBeams.push(laser);
game.addChild(laser);
}
}
// Create player trail particles
function createTrailParticles() {
trailTimer++;
if (trailTimer >= 3) {
// Create trail every 3 frames
trailTimer = 0;
var trail = new TrailParticle();
trail.x = player.x + (Math.random() - 0.5) * 20;
trail.y = player.y + (Math.random() - 0.5) * 20;
trail.targetX = player.x - 50;
trail.targetY = player.y + 10;
trailParticles.push(trail);
game.addChild(trail);
}
}
// Create radial burst particles for perfect hits
function createPerfectBurst(x, y, color) {
for (var i = 0; i < 12; i++) {
var angle = i / 12 * Math.PI * 2;
var speed = 8 + Math.random() * 4;
var burst = new BurstParticle();
burst.x = x;
burst.y = y;
burst.velocityX = Math.cos(angle) * speed;
burst.velocityY = Math.sin(angle) * speed;
var burstGfx = burst.children[0];
burstGfx.tint = color;
burstParticles.push(burst);
game.addChild(burst);
}
}
// Create ambient floating particles
function createAmbientParticles() {
ambientTimer++;
if (ambientTimer >= 20) {
// Create ambient particles every 20 frames
ambientTimer = 0;
var ambient = new AmbientParticle();
ambient.x = player.x + 1200 + Math.random() * 400;
ambient.y = Math.random() * 2732;
var ambientGfx = ambient.children[0];
ambientGfx.tint = 0x888888 + Math.floor(Math.random() * 0x444444);
ambientParticles.push(ambient);
game.addChild(ambient);
}
}
// Create beat-synced particle wave
function createBeatWave() {
for (var i = 0; i < 8; i++) {
var wave = new BurstParticle();
wave.x = -200 + i * 300;
wave.y = groundLevel - 100;
wave.velocityX = 6;
wave.velocityY = -2 + (Math.random() - 0.5) * 4;
wave.life = 60;
wave.maxLife = 60;
var waveGfx = wave.children[0];
waveGfx.tint = 0x00ffff;
burstParticles.push(wave);
game.addChild(wave);
}
}
// Create background abstract shapes
function createBackgroundShapes() {
bgShapeTimer++;
if (bgShapeTimer >= 120) {
bgShapeTimer = 0;
var bgShape = new BackgroundShape();
bgShape.x = 2200 + Math.random() * 400;
bgShape.y = Math.random() * 2000;
backgroundShapes.push(bgShape);
game.addChild(bgShape);
}
}
// Create flowing light lines
function createLightLines() {
lightLineTimer++;
if (lightLineTimer >= 180) {
lightLineTimer = 0;
var lightLine = new LightLine();
lightLine.x = 2200;
lightLine.y = Math.random() * 2732;
lightLine.rotation = (Math.random() - 0.5) * 0.5;
lightLines.push(lightLine);
game.addChild(lightLine);
}
}
// Create data stream particles
function createDataStreamParticles() {
dataStreamTimer++;
if (dataStreamTimer >= 15) {
dataStreamTimer = 0;
var dataStream = new DataStreamParticle();
dataStream.x = 2200 + Math.random() * 200;
dataStream.y = Math.random() * 2732;
dataStreamParticles.push(dataStream);
game.addChild(dataStream);
}
}
// Create holographic musical elements
function createHolographicElements() {
holographicTimer++;
if (holographicTimer >= 600) {
// Less frequent appearance
holographicTimer = 0;
var holographic = new HolographicElement();
holographic.x = 1500 + Math.random() * 800;
holographic.y = 200 + Math.random() * 1800;
holographicElements.push(holographic);
game.addChild(holographic);
}
}
// Create explosion effect when obstacle is destroyed
function createExplosion(x, y, color) {
for (var i = 0; i < 8; i++) {
var explosion = new ExplosionPart();
explosion.x = x + (Math.random() - 0.5) * 40;
explosion.y = y + (Math.random() - 0.5) * 40;
explosion.velocityX = (Math.random() - 0.5) * 12;
explosion.velocityY = -Math.random() * 8 - 2;
explosion.rotationSpeed = (Math.random() - 0.5) * 0.3;
var explosionGfx = explosion.children[0];
explosionGfx.tint = color;
explosionParts.push(explosion);
game.addChild(explosion);
}
}
// Create shatter effect when obstacle breaks
function createShatter(x, y, originalColor) {
for (var i = 0; i < 6; i++) {
var shatter = new ShatterPart();
shatter.x = x + (Math.random() - 0.5) * 30;
shatter.y = y + (Math.random() - 0.5) * 30;
shatter.velocityX = (Math.random() - 0.5) * 8;
shatter.velocityY = -Math.random() * 6 - 1;
shatter.rotationSpeed = (Math.random() - 0.5) * 0.2;
var shatterGfx = shatter.children[0];
shatterGfx.tint = originalColor;
shatterParts.push(shatter);
game.addChild(shatter);
}
}
// Spawn floating clouds for sky level
function spawnCloud() {
var cloud = new Cloud();
cloud.x = 2200;
cloud.y = groundLevel - 100 - Math.random() * 300;
clouds.push(cloud);
game.addChild(cloud);
}
// Create warm sunlight rays
function createSunRays() {
sunRayTimer++;
if (sunRayTimer >= 400) {
sunRayTimer = 0;
var sunRay = new SunRay();
sunRay.x = 1800 + Math.random() * 600;
sunRay.y = 200 + Math.random() * 800;
sunRays.push(sunRay);
game.addChild(sunRay);
}
}
// Create flying seagulls above clouds
function spawnSeagull() {
var seagull = new Seagull();
seagull.x = 2200 + Math.random() * 200;
seagull.y = groundLevel - 450 - Math.random() * 200; // Spawn 450-650 pixels above ground, well above clouds
seagull.baseY = seagull.y;
seagulls.push(seagull);
game.addChild(seagull);
}
// Spawn heart pickup
function spawnHeart() {
var heart = new Heart();
heart.x = 2200;
// Spawn hearts above clouds in sky level (where seagulls are)
if (gamePhase === 3) {
// Sky level - spawn above clouds, at seagull level
heart.y = groundLevel - 450 - Math.random() * 200; // Same height as seagulls
} else {
// Normal/speed phase - original position
heart.y = groundLevel - 200 - Math.random() * 300;
}
hearts.push(heart);
game.addChild(heart);
}
// Create life gain popup
function showLifeGainPopup(amount) {
if (lifePopupText) {
lifePopupText.destroy();
}
var popupText = '+' + amount + ' LIFE';
lifePopupText = new Text2(popupText, {
size: 80,
fill: 0xff3366
});
lifePopupText.anchor.set(0.5, 0.5);
lifePopupText.x = 1024;
lifePopupText.y = 1000;
lifePopupText.alpha = 0;
game.addChild(lifePopupText);
// Animate popup
tween(lifePopupText, {
alpha: 1,
y: 800
}, {
duration: 300,
easing: tween.easeOut
});
// Fade out after showing
LK.setTimeout(function () {
if (lifePopupText) {
tween(lifePopupText, {
alpha: 0,
y: 600
}, {
duration: 500,
easing: tween.easeIn,
onFinish: function onFinish() {
if (lifePopupText) {
lifePopupText.destroy();
lifePopupText = null;
}
}
});
}
}, 1500);
lifePopupTimer = 120; // 2 seconds
}
// Create score popup
var scorePopupText = null;
function showScorePopup(points) {
if (scorePopupText) {
scorePopupText.destroy();
}
var popupText = '+' + points;
scorePopupText = new Text2(popupText, {
size: 70,
fill: 0x00ff00
});
scorePopupText.anchor.set(0.5, 0.5);
scorePopupText.x = player.x;
scorePopupText.y = player.y - 200;
scorePopupText.alpha = 0;
game.addChild(scorePopupText);
// Animate popup
tween(scorePopupText, {
alpha: 1,
y: player.y - 250
}, {
duration: 250,
easing: tween.easeOut
});
// Fade out after showing
LK.setTimeout(function () {
if (scorePopupText) {
tween(scorePopupText, {
alpha: 0,
y: player.y - 250
}, {
duration: 400,
easing: tween.easeIn,
onFinish: function onFinish() {
if (scorePopupText) {
scorePopupText.destroy();
scorePopupText = null;
}
}
});
}
}, 1000);
}
// Check collisions
function checkCollisions() {
// Regular obstacle collisions
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
if (player.intersects(obstacle)) {
if (player.isDashing) {
// Destroy obstacle with explosion effect
createExplosion(obstacle.x, obstacle.y, 0xff4400);
createShatter(obstacle.x, obstacle.y, 0xff0044);
LK.getSound('successHit').play();
var scoreGain = 25;
LK.setScore(LK.getScore() + scoreGain);
showScorePopup(scoreGain);
combo++;
} else {
LK.getSound('loseLife').play();
LK.effects.flashScreen(0xff0000, 500);
combo = 0;
playerLives--;
updateLivesDisplay();
// Intense camera shake on collision
cameraShakeIntensity = 20;
tween(game, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(game, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 400,
easing: tween.easeInOut
});
}
});
}
// Remove obstacle
obstacle.destroy();
obstacles.splice(i, 1);
}
}
// Rotating cube collisions
for (var i = rotatingCubes.length - 1; i >= 0; i--) {
var cube = rotatingCubes[i];
if (player.intersects(cube)) {
if (player.isDashing) {
// Destroy cube with spectacular explosion
createExplosion(cube.x, cube.y, 0xff8800);
createShatter(cube.x, cube.y, 0xff4400);
LK.getSound('successHit').play();
var scoreGain = 35;
LK.setScore(LK.getScore() + scoreGain);
showScorePopup(scoreGain);
combo++;
cameraShakeIntensity = 8;
} else {
LK.getSound('loseLife').play();
LK.effects.flashScreen(0xff0000, 500);
combo = 0;
playerLives--;
updateLivesDisplay();
cameraShakeIntensity = 25;
}
cube.destroy();
rotatingCubes.splice(i, 1);
}
}
// Laser beam collisions
for (var i = laserBeams.length - 1; i >= 0; i--) {
var laser = laserBeams[i];
if (laser.isActive && player.intersects(laser)) {
LK.getSound('loseLife').play();
LK.effects.flashScreen(0xff0088, 600);
combo = 0;
playerLives--;
updateLivesDisplay();
cameraShakeIntensity = 30;
// Create explosion at collision point
createExplosion(player.x, player.y, 0xff0088);
// Remove laser
laser.destroy();
laserBeams.splice(i, 1);
}
}
// Cloud collisions for sky level
for (var i = clouds.length - 1; i >= 0; i--) {
var cloud = clouds[i];
if (player.intersects(cloud)) {
// Landing on cloud
if (player.velocityY > 0 && player.y < cloud.y) {
player.y = cloud.y - 30;
player.velocityY = 0; // Stop bouncing
player.isGrounded = true; // Enable jumping
player.canDoubleJump = false; // Reset to allow first jump from cloud
player.hasUsedDoubleJump = false;
player.hasJumped = false; // Reset jump flag when landing on cloud
cloud.bounce();
// Soft landing sound effect
if (Math.random() < 0.5) {
LK.getSound('windWhoosh').play();
}
LK.setScore(LK.getScore() + 15);
}
}
}
// Seagull collisions - can land on seagulls
for (var i = seagulls.length - 1; i >= 0; i--) {
var seagull = seagulls[i];
if (player.intersects(seagull)) {
// Landing on seagull
if (player.velocityY > 0 && player.y < seagull.y) {
player.y = seagull.y - 35;
player.velocityY = 0;
player.isGrounded = true;
player.canDoubleJump = false; // Reset to allow first jump from seagull
player.hasUsedDoubleJump = false;
player.hasJumped = false; // Reset jump flag when landing on seagull
// Gentle landing sound
if (Math.random() < 0.3) {
LK.getSound('echoChime').play();
}
LK.setScore(LK.getScore() + 20);
}
}
}
// Heart pickup collisions
for (var i = hearts.length - 1; i >= 0; i--) {
var heart = hearts[i];
if (player.intersects(heart)) {
var livesGained = heart.isPulsing ? 2 : 1;
playerLives = Math.min(maxLives, playerLives + livesGained);
updateLivesDisplay();
// Play life gain sound
LK.getSound('gainLife').play();
// Show popup
showLifeGainPopup(livesGained);
// Create sparkle burst effect
createPerfectBurst(heart.x, heart.y, 0xff6699);
// Camera shake for life gain
cameraShakeIntensity = 8;
// Remove heart
heart.destroy();
hearts.splice(i, 1);
}
}
}
// Beat detection and rhythm mechanics
function updateBeat() {
beatTimer++;
// Simple beat simulation (in real game this would sync with music)
if (beatTimer >= beatInterval) {
beatTimer = 0;
beatPulse = 1;
// Make player react to every beat
if (player) {
player.reactToBeat();
}
// Beat-synced camera shake and zoom
cameraShakeIntensity = 8;
tween(game, {
scaleX: 1.08,
scaleY: 1.08
}, {
duration: 150,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(game, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 300,
easing: tween.easeInOut
});
}
});
// Create beat-synced particle wave
createBeatWave();
}
// Beat pulse decay
beatPulse *= 0.9;
}
// Variable jump state tracking
var isJumpPressed = false;
var jumpHoldTime = 0;
var maxJumpHoldTime = 20; // Maximum frames to hold for full jump
var minJumpForce = -18; // Minimum jump force for quick tap
var maxJumpForce = -32; // Maximum jump force for full hold
// Touch controls
game.down = function (x, y, obj) {
// Convert coordinates to global position to handle camera transformations
var globalPos = game.toGlobal({
x: x,
y: y
});
var screenX = globalPos.x;
if (screenX < 1024) {
// Left side - jump or double jump ONLY
// Reset any existing jump state first
isJumpPressed = false;
jumpHoldTime = 0;
// Determine if this should be a double jump
var canJump = player.isGrounded || !player.hasJumped && !player.isGrounded;
var canDoubleJump = player.canDoubleJump && !player.hasUsedDoubleJump && !player.isGrounded;
if (canJump || canDoubleJump) {
isJumpPressed = true;
jumpHoldTime = 0;
var isDoubleJump = canDoubleJump && !canJump;
if (isDoubleJump) {
// Double jump - fixed force, more responsive
player.velocityY = -25; // Fixed double jump force
player.hasUsedDoubleJump = true;
// Create different visual effect for double jump
LK.effects.flashObject(player, 0x00ffff, 300);
// Double jump particle effect
for (var i = 0; i < 8; i++) {
var particle = new Particle();
particle.x = player.x + (Math.random() - 0.5) * 60;
particle.y = player.y + 10;
particle.velocityY = Math.random() * 8 + 3;
particle.velocityX = (Math.random() - 0.5) * 12;
var particleGfx = particle.children[0];
particleGfx.tint = 0x00ffff; // Cyan for double jump
game.addChild(particle);
particles.push(particle);
}
} else {
// First jump - variable jump system
player.velocityY = minJumpForce;
player.isGrounded = false;
player.canDoubleJump = true; // Enable double jump after first jump
player.hasJumped = true; // Mark that player has jumped
player.createJumpEffect();
}
LK.getSound('jump').play();
// Check if jump was on beat
if (beatPulse > 0.7) {
perfectHits++;
combo++;
var scoreBonus = isDoubleJump ? 15 : 10; // More points for double jump on beat
var totalScore = scoreBonus + combo * 2;
LK.setScore(LK.getScore() + totalScore);
showScorePopup(totalScore);
LK.getSound('successHit').play();
LK.effects.flashObject(player, 0x00ff00, 200);
// Camera shake for perfect jump
cameraShakeIntensity = 5;
// Create radial burst particles
createPerfectBurst(player.x, player.y, 0x00ff00);
}
}
} else {
// Right side - dash ONLY (only if not currently jumping)
if (!isJumpPressed) {
player.dash();
// Check if dash was on beat
if (beatPulse > 0.7) {
perfectHits++;
combo++;
var totalScore = 15 + combo * 3;
LK.setScore(LK.getScore() + totalScore);
showScorePopup(totalScore);
LK.getSound('successHit').play();
LK.effects.flashObject(player, 0xffff00, 200);
// Camera shake for perfect dash
cameraShakeIntensity = 6;
// Create radial burst particles
createPerfectBurst(player.x, player.y, 0xffff00);
}
}
}
};
// Add touch up handler for variable jump release
game.up = function (x, y, obj) {
// Convert coordinates to global position to handle camera transformations
var globalPos = game.toGlobal({
x: x,
y: y
});
var screenX = globalPos.x;
if (screenX < 1024 && isJumpPressed) {
// Left side - release jump only if we were pressing jump
isJumpPressed = false;
jumpHoldTime = 0;
// Stop ascending immediately when released if moving upward
if (player.velocityY < 0) {
player.velocityY *= 0.4; // Reduce upward velocity for responsive control
}
}
};
// Main game loop
game.update = function () {
// Reset jump state if player is grounded to prevent desync
if (player.isGrounded && isJumpPressed) {
isJumpPressed = false;
jumpHoldTime = 0;
}
// Handle variable jump mechanics (only for first jump, not double jump)
if (isJumpPressed && jumpHoldTime < maxJumpHoldTime && !player.hasUsedDoubleJump) {
jumpHoldTime++;
// Calculate additional jump force based on hold time
var holdRatio = jumpHoldTime / maxJumpHoldTime;
var additionalForce = (maxJumpForce - minJumpForce) * holdRatio * 0.08; // Gradual force application
// Apply additional upward force while holding and moving upward
if (player.velocityY < 0) {
player.velocityY += additionalForce;
}
}
updateBeat();
updateBackgroundPulse();
updateCamera();
checkCollisions();
// Update ground segments
for (var i = 0; i < ground.length; i++) {
if (ground[i].x <= -300) {
ground[i].x += 3600; // 12 * 300
}
}
// Update and remove obstacles
for (var i = obstacles.length - 1; i >= 0; i--) {
if (obstacles[i].x < -100) {
obstacles[i].destroy();
obstacles.splice(i, 1);
// Bonus points for passing obstacles
var scoreGain = 5;
LK.setScore(LK.getScore() + scoreGain);
showScorePopup(scoreGain);
}
}
// Update and remove rotating cubes
for (var i = rotatingCubes.length - 1; i >= 0; i--) {
if (rotatingCubes[i].x < -100) {
rotatingCubes[i].destroy();
rotatingCubes.splice(i, 1);
var scoreGain = 8;
LK.setScore(LK.getScore() + scoreGain);
showScorePopup(scoreGain);
}
}
// Update and remove laser beams
for (var i = laserBeams.length - 1; i >= 0; i--) {
if (laserBeams[i].x < -100) {
laserBeams[i].destroy();
laserBeams.splice(i, 1);
var scoreGain = 10;
LK.setScore(LK.getScore() + scoreGain);
showScorePopup(scoreGain);
}
}
// Update and remove explosion parts
for (var i = explosionParts.length - 1; i >= 0; i--) {
if (explosionParts[i].shouldDestroy) {
explosionParts[i].destroy();
explosionParts.splice(i, 1);
}
}
// Update and remove shatter parts
for (var i = shatterParts.length - 1; i >= 0; i--) {
if (shatterParts[i].shouldDestroy) {
shatterParts[i].destroy();
shatterParts.splice(i, 1);
}
}
// Update and remove particles
for (var i = particles.length - 1; i >= 0; i--) {
if (particles[i].shouldDestroy) {
particles[i].destroy();
particles.splice(i, 1);
}
}
// Update and remove trail particles
for (var i = trailParticles.length - 1; i >= 0; i--) {
if (trailParticles[i].shouldDestroy) {
trailParticles[i].destroy();
trailParticles.splice(i, 1);
}
}
// Update and remove burst particles
for (var i = burstParticles.length - 1; i >= 0; i--) {
if (burstParticles[i].shouldDestroy) {
burstParticles[i].destroy();
burstParticles.splice(i, 1);
}
}
// Update and remove ambient particles
for (var i = ambientParticles.length - 1; i >= 0; i--) {
if (ambientParticles[i].shouldDestroy) {
ambientParticles[i].destroy();
ambientParticles.splice(i, 1);
}
}
// Update and remove background shapes
for (var i = backgroundShapes.length - 1; i >= 0; i--) {
if (backgroundShapes[i].x < -200) {
backgroundShapes[i].destroy();
backgroundShapes.splice(i, 1);
}
}
// Update and remove light lines
for (var i = lightLines.length - 1; i >= 0; i--) {
if (lightLines[i].x < -500) {
lightLines[i].destroy();
lightLines.splice(i, 1);
}
}
// Update and remove data stream particles
for (var i = dataStreamParticles.length - 1; i >= 0; i--) {
if (dataStreamParticles[i].shouldDestroy || dataStreamParticles[i].x < -100) {
dataStreamParticles[i].destroy();
dataStreamParticles.splice(i, 1);
}
}
// Update and remove holographic elements
for (var i = holographicElements.length - 1; i >= 0; i--) {
if (holographicElements[i].shouldDestroy || holographicElements[i].x < -400) {
holographicElements[i].destroy();
holographicElements.splice(i, 1);
}
}
// Update and remove clouds
for (var i = clouds.length - 1; i >= 0; i--) {
if (clouds[i].x < -200) {
clouds[i].destroy();
clouds.splice(i, 1);
}
}
// Update and remove sun rays
for (var i = sunRays.length - 1; i >= 0; i--) {
if (sunRays[i].shouldDestroy || sunRays[i].x < -500) {
sunRays[i].destroy();
sunRays.splice(i, 1);
}
}
// Update and remove seagulls
for (var i = seagulls.length - 1; i >= 0; i--) {
if (seagulls[i].x < -100) {
seagulls[i].destroy();
seagulls.splice(i, 1);
}
}
// Update and remove hearts
for (var i = hearts.length - 1; i >= 0; i--) {
if (hearts[i].x < -100) {
hearts[i].destroy();
hearts.splice(i, 1);
}
}
// Lives display is updated only when lives change
// Spawn hearts occasionally
heartSpawnTimer++;
if (heartSpawnTimer >= heartSpawnInterval) {
heartSpawnTimer = 0;
if (playerLives < maxLives) {
spawnHeart();
}
}
// Update life popup timer
if (lifePopupTimer > 0) {
lifePopupTimer--;
}
// Create continuous particle effects
createTrailParticles();
createAmbientParticles();
// Create background environment effects
if (gamePhase === 3) {
// Sky level effects
createSunRays();
// Cloud and seagull spawning now handled by position-based system above
} else {
// Normal/speed phase effects
createBackgroundShapes();
createLightLines();
createDataStreamParticles();
createHolographicElements();
}
// Update dash distance decay system
dashResetTimer++;
if (dashResetTimer >= dashResetInterval) {
// Reset dash distance to maximum
currentDashDistance = maxDashDistance;
dashResetTimer = 0;
// Visual feedback for dash reset
if (player) {
LK.effects.flashObject(player, 0x00ff88, 300);
// Create reset particle effect
for (var i = 0; i < 6; i++) {
var particle = new Particle();
particle.x = player.x + (Math.random() - 0.5) * 40;
particle.y = player.y + (Math.random() - 0.5) * 40;
particle.velocityY = -Math.random() * 5 - 2;
particle.velocityX = (Math.random() - 0.5) * 8;
var particleGfx = particle.children[0];
particleGfx.tint = 0x00ff88; // Green for dash reset
game.addChild(particle);
particles.push(particle);
}
}
}
// Update UI
scoreText.setText('Score: ' + LK.getScore());
comboText.setText('Combo: ' + combo);
// Update dash distance display
var dashPercentage = Math.round(currentDashDistance / maxDashDistance * 100);
dashText.setText('Dash: ' + dashPercentage + '%');
// Color code the dash indicator based on distance remaining
if (dashPercentage >= 70) {
dashText.fill = 0x00ff88; // Green for high distance
} else if (dashPercentage >= 40) {
dashText.fill = 0xffaa00; // Orange for medium distance
} else {
dashText.fill = 0xff4444; // Red for low distance
}
// Update debug display with detailed dash values including forward distance
dashDebugText.setText('Current: ' + currentDashDistance.toFixed(2) + ' | Max: ' + maxDashDistance + ' | Min: ' + minDashDistance + ' | Decay: ' + dashDecayRate);
dashTimerText.setText('Reset Timer: ' + dashResetTimer + '/' + dashResetInterval + ' (' + Math.round(dashResetTimer / dashResetInterval * 100) + '%) | Forward: ' + player.velocityX.toFixed(2));
// Game over if no lives left
if (playerLives <= 0) {
LK.showGameOver();
}
// Position-based spawning system - spawn objects ahead of player with balanced random spacing
var spawnDistance = 1800; // Distance ahead of player to spawn objects
var minSpacing = 250; // Further reduced minimum distance between objects
var maxSpacing = 450; // Reduced maximum distance for better flow
var spawnZone = player.x + spawnDistance;
// Check if we need to spawn new obstacles based on player position
var shouldSpawn = false;
if (obstacles.length === 0 && rotatingCubes.length === 0 && laserBeams.length === 0) {
shouldSpawn = true;
} else {
// Check if the furthest obstacle is far enough to spawn a new one
var furthestObstacleX = -999999;
for (var i = 0; i < obstacles.length; i++) {
if (obstacles[i].x > furthestObstacleX) furthestObstacleX = obstacles[i].x;
}
for (var i = 0; i < rotatingCubes.length; i++) {
if (rotatingCubes[i].x > furthestObstacleX) furthestObstacleX = rotatingCubes[i].x;
}
for (var i = 0; i < laserBeams.length; i++) {
if (laserBeams[i].x > furthestObstacleX) furthestObstacleX = laserBeams[i].x;
}
// Spawn new obstacle only if furthest one is far enough behind spawn zone
if (furthestObstacleX < spawnZone - minSpacing) {
shouldSpawn = true;
}
}
// Spawn obstacle at appropriate distance ahead with random spacing
if (shouldSpawn && Math.random() < 0.35) {
// Further increased chance per frame for better obstacle flow
if (gamePhase === 3) {
// Sky level - mostly spawn clouds instead of obstacles
if (Math.random() < 0.6) {
var cloud = new Cloud();
cloud.x = spawnZone + minSpacing + Math.random() * (maxSpacing - minSpacing); // Random spacing between min and max
cloud.y = groundLevel - 100 - Math.random() * 300;
clouds.push(cloud);
game.addChild(cloud);
}
} else {
var obstacleType = Math.random();
var spawnX = spawnZone + minSpacing + Math.random() * (maxSpacing - minSpacing); // Random spacing for variety
if (obstacleType < 0.4) {
// Regular obstacle
var obstacle = new Obstacle();
obstacle.x = spawnX;
obstacle.y = groundLevel;
obstacles.push(obstacle);
game.addChild(obstacle);
} else if (obstacleType < 0.7) {
// Rotating cube
var cube = new RotatingCube();
cube.x = spawnX;
cube.y = groundLevel - 60 - Math.random() * 80;
rotatingCubes.push(cube);
game.addChild(cube);
} else {
// Laser beam
var laser = new LaserBeam();
laser.x = spawnX;
laser.y = groundLevel - 200;
laserBeams.push(laser);
game.addChild(laser);
}
}
}
// Position-based cloud spawning for sky level with balanced random spacing
if (gamePhase === 3) {
var furthestCloudX = -999999;
for (var i = 0; i < clouds.length; i++) {
if (clouds[i].x > furthestCloudX) furthestCloudX = clouds[i].x;
}
if (furthestCloudX < spawnZone - minSpacing && Math.random() < 0.08) {
// Increased chance for better flow
var cloud = new Cloud();
cloud.x = spawnZone + minSpacing + Math.random() * (maxSpacing - minSpacing); // Random spacing between min and max
cloud.y = groundLevel - 100 - Math.random() * 300;
clouds.push(cloud);
game.addChild(cloud);
}
// Position-based seagull spawning with balanced spacing
var furthestSeagullX = -999999;
for (var i = 0; i < seagulls.length; i++) {
if (seagulls[i].x > furthestSeagullX) furthestSeagullX = seagulls[i].x;
}
if (furthestSeagullX < spawnZone - minSpacing * 1.2 && Math.random() < 0.02) {
// Moderately reduced spacing and increased spawn chance
var seagull = new Seagull();
seagull.x = spawnZone + minSpacing * 1.2 + Math.random() * (maxSpacing - minSpacing); // More balanced spacing
seagull.y = groundLevel - 450 - Math.random() * 200;
seagull.baseY = seagull.y;
seagulls.push(seagull);
game.addChild(seagull);
// Add elegant entrance animation
seagull.alpha = 0;
tween(seagull, {
alpha: 0.9
}, {
duration: 1000,
easing: tween.easeOut
});
}
}
// Gradually increase difficulty
if (LK.ticks % 1800 == 0) {
// Every 30 seconds
gameSpeed += 0.5;
beatInterval = Math.max(30, beatInterval - 2);
}
// Game over condition (if player falls off screen)
if (gamePhase === 3) {
// Sky level - portal respawn system
if (player.y > 2732 + 100) {
// Respawn from top with portal effect
player.y = -100;
player.velocityY = 0;
player.isGrounded = false;
// Portal effect
LK.effects.flashScreen(0xaaccff, 800);
cameraShakeIntensity = 15;
// Play whoosh sound for portal
LK.getSound('windWhoosh').play();
}
} else {
// Normal/speed phase - game over
if (player.y > 2732 + 100) {
LK.showGameOver();
}
}
// Sky level transition at 1000 points - dreamy sky environment
if (LK.getScore() >= 1000 && !phaseTransitioned) {
phaseTransitioned = true;
gamePhase = 3;
// Hide ground segments for sky level
for (var i = 0; i < ground.length; i++) {
ground[i].visible = false;
}
// Adjust player position for sky level
groundLevel = 1800;
player.y = groundLevel - 30;
// Set camera zoom target for sky level
cameraTargetZoom = 1.2;
// Transition to sky level ambient music with fade
LK.playMusic('skyLevelMusic', {
fade: {
start: 0,
end: 0.8,
duration: 2000
}
});
// Play ambient wind sound
LK.getSound('windWhoosh').play();
// Visual effect for sky transition
LK.effects.flashScreen(0xffffcc, 3000);
// Camera shake for transition
cameraShakeIntensity = 30;
// Scale pulse effect for sky transition (this will be overridden by camera zoom)
tween(game, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 800,
easing: tween.easeOut,
onFinish: function onFinish() {
// Don't reset scale here as camera zoom will handle it
}
});
}
// New win condition at higher score
if (LK.getScore() >= 2500) {
LK.showYouWin();
}
};
// Test button to get 1000 points instantly
var testButton = new Text2('1000 PTS', {
size: 50,
fill: 0xFFFF00
});
testButton.anchor.set(1, 0);
testButton.x = -20;
testButton.y = 20;
LK.gui.topRight.addChild(testButton);
// Add click handler for test button
testButton.down = function (x, y, obj) {
LK.setScore(1000);
};
// Start the music
LK.playMusic('mainBgMusic');
; ===================================================================
--- original.js
+++ change.js
@@ -2051,11 +2051,11 @@
dashText.fill = 0xffaa00; // Orange for medium distance
} else {
dashText.fill = 0xff4444; // Red for low distance
}
- // Update debug display with detailed dash values
+ // Update debug display with detailed dash values including forward distance
dashDebugText.setText('Current: ' + currentDashDistance.toFixed(2) + ' | Max: ' + maxDashDistance + ' | Min: ' + minDashDistance + ' | Decay: ' + dashDecayRate);
- dashTimerText.setText('Reset Timer: ' + dashResetTimer + '/' + dashResetInterval + ' (' + Math.round(dashResetTimer / dashResetInterval * 100) + '%)');
+ dashTimerText.setText('Reset Timer: ' + dashResetTimer + '/' + dashResetInterval + ' (' + Math.round(dashResetTimer / dashResetInterval * 100) + '%) | Forward: ' + player.velocityX.toFixed(2));
// Game over if no lives left
if (playerLives <= 0) {
LK.showGameOver();
}
2d rock for game. In-Game asset. 2d. High contrast. No shadows
agaç gövdesi 2d. In-Game asset. 2d. High contrast. No shadows
bush 2d. In-Game asset. 2d. High contrast. No shadows
nehiri kaldır
oxygen tank 2d. In-Game asset. 2d. High contrast. No shadows
shark shadow 2d. In-Game asset. 2d. High contrast. No shadows
2 yapraklı deniz yosunu 2d. In-Game asset. 2d. High contrast. No shadows
piranha 2d. In-Game asset. 2d. High contrast. No shadows
deniz mercanı 2d. In-Game asset. 2d. High contrast. No shadows
jump
Sound effect
dash
Sound effect
failureMiss
Sound effect
mainBgMusic
Music
skyLevelMusic
Music
speedMusic
Music
natureMusic
Music
jumpNature
Sound effect
jumpUnderwater
Sound effect
dashNature
Sound effect
dashUnderwater
Sound effect
underwaterMusic
Music
jumpSpeed
Sound effect
dashSpeed
Sound effect