User prompt
Ritimleri yavaşlat ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Ritime basmadiğim zamanda score sifirlansin
User prompt
Create a 2D rhythm game. There are 4 large arrow icons (up, down, left, right) in the center of the screen. On every beat of the music (120 BPM), one arrow lights up. The player must press the matching arrow key exactly when the arrow lights up. If the player presses the correct key on time, increase the score by 1. If the player presses the wrong key or misses the beat, reset the score to 0. The game never ends — it continues forever. Show the score at the top of the screen. Use different colors for each arrow: up = blue, down = red, left = yellow, right = green. Add sound effects for correct and wrong inputs. Use a black background. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Kodlari sifirlq
User prompt
Sarki ritmi beata gore olsun
User prompt
Şarkiyi yavaşlat
User prompt
Beatı yavaşlat
User prompt
Basnadığim zamanda score sifirlansin
User prompt
Create a 2D rhythm game called "Rhythm Arrows". 🕹️ Gameplay: - Four large arrow icons are displayed in the center of the screen: up, down, left, and right. - At each beat of the background music, one of the arrows lights up with a glowing animation. - The player must press the corresponding arrow key (↑ ↓ ← →) exactly when the arrow is glowing. 🎯 Scoring: - If the player presses the correct key in sync with the glowing arrow, increase the score by 1. - If the player presses the wrong key or misses the beat, reset the score to 0. - The score should be visible at the top center of the screen in a bold font. 🎵 Music & Timing: - The background music is upbeat and consistent, around 120–130 BPM. - The arrows glow on every beat. The timing window for a correct press is ±250 milliseconds. - Add a subtle pulsing effect on the beat to help the player keep time. 🔊 Feedback: - Successful input plays a satisfying chime or "click". - Missed input plays a soft "error" sound or buzz. - The glowing arrow briefly turns green on success, or red on failure. 🎨 Visual Style: - Simple background with glowing effects. - Arrows are large, outlined in neon style. - Each arrow lights up in a unique color when active: - Up: Blue - Down: Red - Left: Yellow - Right: Green ♾️ Looping: - The game never ends. - There is no game over screen. - Players can keep playing and improving their score indefinitely. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Create a 2D rhythm game called "Rhythm Arrows". Gameplay: - Display four large arrow icons on the screen: up (↑), down (↓), left (←), and right (→). - On each beat of the music (120 BPM), one of the arrows flashes to indicate which direction to press. - The player must press the correct arrow key at the same time the arrow flashes. Scoring: - If the player presses the correct key in sync with the beat (within ±300ms), add +1 to the score. - If the player presses the wrong key or misses the beat, reset the score to 0. - The game continues even after a miss. There is no game over screen. - Show the score at the top center of the screen. Visuals: - Each arrow has a unique color when flashing: - Up = Blue - Down = Red - Left = Yellow - Right = Green - Use a dark background with subtle glowing effects. - Add a glowing pulse effect to the beat to help timing. Sound: - Add a looping electronic music track at 120 BPM. - When the player presses correctly, play a “ding” or click sound. - When the player misses or presses incorrectly, play a soft “buzz”. Flow: - The game runs in an infinite loop with no win or lose condition. - Only the score resets when the player fails. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Create a 2D rhythm game called "Rhythm Arrows". Gameplay: - There are 4 large arrow icons (↑ ↓ ← →) shown in the center of the screen. - On each beat of the music, one of the arrows randomly glows or flashes. - The player must press the matching arrow key exactly when the arrow lights up. Scoring: - If the player presses the correct key on time (±250ms window), increase the score by 1. - If the key is missed or wrong, reset the score to 0. - The score is displayed at the top center of the screen in neon digital font. Visuals: - Arrows glow in color when active: ↑ blue, ↓ red, ← yellow, → green. - Pressed arrows flash briefly. - Background is a dark gradient with pulsing light on each beat. Music: - Add a looping 120 BPM electronic music track. - All visual pulses and arrow timings follow the beat. Feedback: - Play a 'click' or 'ding' sound when input is correct. - Play a soft 'buzz' when incorrect. - Flash green when correct, red when incorrect. Flow: - The game does not end on failure. - Only the score resets, and gameplay continues forever. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Kodlqrı sil
User prompt
Make the rhythm timing easier for the player. 🕒 Timing Window: - Increase the allowed beat window from ±100 milliseconds to ±300 milliseconds. - Allow some tolerance so the player can jump slightly early or slightly late without failing. 🎵 Beat Feedback: - Show a visual cue (like a pulsing circle or glow) just before the beat happens to help the player prepare their jump. - Add a soft "tick" sound or flash effect synced with each beat to make timing easier. 🎮 Forgiveness System: - If the jump is close but slightly mistimed, count it as "OK" instead of a complete failure. - Only jumps that are far off-beat should cause a fail. 📊 Difficulty Scaling: - Keep the easier timing window for the first 30 jumps. - Gradually reduce the tolerance slightly after that if desired. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Remove the health or life system from the game. Instead, if the player misses the jump timing, immediately restart the level or reset the score. The player does not lose health or life on jump failure. Make sure the jump only causes failure if mistimed, not damage.
User prompt
Create a 2D rhythm platformer game called "Beat Jumper". 🎮 Gameplay: - The player controls a DJ character who runs automatically from left to right on a glowing digital track. - The player can only control the character's jump action. - The jump must be timed precisely to the background music's main beat (bass drum hits). - If the player presses jump too early or too late relative to the beat, the character misses the platform and falls, causing the game to restart. 🎵 Music & Rhythm: - Use a steady, electronic dance music (EDM) style background track with a clear, regular beat at 120 BPM. - The platforms appear in sync with the beat: each beat corresponds to one platform. - The game detects the timing of the player's jump input relative to the beat window (±100 milliseconds). - Jumping within this timing window is considered successful; otherwise, it counts as a miss. 🌈 Visuals: - The background is a dark digital cityscape with neon lights pulsing in sync with the music. - Platforms are semi-transparent rectangles that glow briefly when the beat hits. - The DJ character wears headphones and has a glowing outline that pulses with the music. - Each successful jump triggers a colorful particle effect. - Every 10 successful jumps, the background color scheme shifts through a cycle of neon colors (blue, pink, green, purple). 🔊 Sound Effects: - Play a subtle jump sound synchronized with the character's jump. - On successful jump, play a positive chime sound. - On failed jump (missed beat), play a short buzz or error sound. - Add a crowd cheering sound every 20 successful jumps as a reward. 🕹️ Controls: - Left and right movement is ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
Edit game
User prompt
Create a 2D rhythm platformer game called "Beat Jumper". The player is a DJ character running automatically across a glowing digital track. The background music has a steady beat, and the player must press jump at the right moment to land on platforms in sync with the music. If the player jumps too early or too late, they fall and the game resets. The background changes color every 10 successful jumps. Include visual pulsing effects matching the music beats, and sound effects when jumps are successful. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Bunu fulden sil butun kodlari
User prompt
Create a second level for the game "Code Hunter" with a more advanced puzzle system. 🎮 Level 2: "Firewall Passcode" This time, the puzzle is a randomized color code that changes every time the player restarts the level. There are 4 colored pressure plates on the floor: RED, BLUE, GREEN, and YELLOW. The correct 3-color sequence (e.g. BLUE → YELLOW → GREEN) is stored in a glowing Code Terminal placed at the beginning of the level. When the player interacts with this terminal, a short message appears on screen showing the correct order for this run. 🔒 Puzzle Mechanics: - The player must memorize and input the exact color sequence by stepping on the plates in order. - After each attempt, there is a 3-second cooldown where plates are disabled, giving time for the player to rethink. - If the player steps on the plates in the wrong order, the puzzle resets and the terminal generates a new random code. 🟨 Fake Plate: - A 5th plate (e.g. PURPLE) is added that never appears in the solution and is placed to confuse the player. If they step on it, they immediately lose 5 seconds from the timer. ⏱️ Time Pressure: - The player has 45 seconds total to solve the puzzle. - Every failed attempt costs 5 seconds from the timer. 🚪 Gate Behavior: - Once the correct code is entered, the security gate opens with a high-tech sliding animation. - If the time runs out, the system locks and the level restarts with a new code. 👤 Player: - Same character as Level 1: a futuristic hacker in a glowing suit. 📜 Visuals and Clarity: - The terminal message should appear in a readable popup: “Access Code: Blue → Yellow → Green” - Pressure plates should light up when stepped on, and play different sounds: - Success tone for correct input, - Error buzzer for incorrect input, - Warning chime when time is low. Add a floating drone assistant that sometimes whispers a hint: “Watch out for the purple trap.” This level should emphasize short-term memory, logic under pressure, and quick reaction. Keep the scene clean but slightly more intimidating than Level 1. The environment should feel like the player is deep inside a firewall system. ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
Create a 2D puzzle platformer game called "Code Hunter". In this game, the player is a cyber hacker trapped inside a futuristic digital computer world. The environment should look like a dark, neon-lit data lab — glowing wires, animated circuit boards, and metallic textures. 🎮 Level 1: "Code Start" The player must solve a sequence-based color puzzle to unlock a digital gate and move to the next level. There are three colored pressure plates: RED, BLUE, and GREEN. These are placed on the ground in front of the player. 🧠 Puzzle Rule: The player has to step on these plates in the correct order: 1. RED 2. BLUE 3. GREEN If the player steps on a wrong plate at any time, the puzzle resets — all plates deactivate, and they must try again from the beginning. ⏱️ Time Limit: There is a timer counting down from 30 seconds. If the player does not solve the puzzle within the time limit, the gate closes permanently and the level restarts. 🚪 Gate Logic: Once the correct sequence is entered, a locked digital door opens with an animation and sound. The player can then move through the door to complete the level. 🧍 Player: The character is a futuristic hacker avatar — wearing a glowing digital suit with blue and green lights. The character can move left and right, jump, and interact with puzzle objects. 🎨 Environment: - Background: dark, deep blue with animated circuitry - Floor: metallic and glowing with cyber panels - Pressure plates: clearly visible, color-coded with labels - Gate: a large steel door with electric effects 🔊 Sound: - A digital "beep" plays when a plate is pressed. - An error buzz sounds on wrong input. - A rising tone plays when the puzzle is completed correctly. Optional: Add a holographic AI helper in the corner that gives hints like "Try again!" or "One step closer..." when plates are pressed. The gameplay should be smooth, visually clean, and easy to follow. Focus on timing, memory, and logic. ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Code Hunter
Initial prompt
Create a puzzle game called "Code Hunter". In the first level, the player is a cyber hacker inside a digital lab. They must step on three colored blocks (red, blue, green) in the correct order to open a security gate. If they step on the wrong block, the puzzle resets. The gate will close after 30 seconds. The environment should look like a futuristic computer system, and the goal is to break through digital firewalls. Include pressure plates, logic gates, and timer mechanics. The character should look like a futuristic hacker or robot.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var BeatIndicator = Container.expand(function () { var self = Container.call(this); var indicatorGraphics = self.attachAsset('beatIndicator', { anchorX: 0.5, anchorY: 0.5 }); self.pulse = function () { // Pulse effect on beat tween(self, { scaleX: 1.5, scaleY: 1.5 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeIn }); } }); }; return self; }); var BeatTrail = Container.expand(function () { var self = Container.call(this); var trailGraphics = self.attachAsset('beatTrail', { anchorX: 0.5, anchorY: 0.5 }); self.lifespan = 30; // Frames to live self.velocity = -8; // Move left with beat self.update = function () { self.x += self.velocity; self.lifespan--; // Fade out over time self.alpha = self.lifespan / 30; // Remove when expired if (self.lifespan <= 0) { self.destroy(); } }; return self; }); var ComboEffect = Container.expand(function () { var self = Container.call(this); var comboGraphics = self.attachAsset('comboIndicator', { anchorX: 0.5, anchorY: 0.5 }); self.show = function (comboCount) { // Scale up and fade out effect tween(self, { scaleX: 2, scaleY: 2, alpha: 0 }, { duration: 800, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); // Game variables var DJPlayer = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('djPlayer', { anchorX: 0.5, anchorY: 1.0 }); // Player properties self.runSpeed = 3; self.isJumping = false; self.jumpVelocity = 0; self.gravity = 0.8; self.groundY = 2500; self.jumpStartY = self.groundY; self.comboCount = 0; self.lastBeatTime = 0; self.update = function () { // Auto-run to the right self.x += self.runSpeed; // Handle jumping physics if (self.isJumping) { self.y += self.jumpVelocity; self.jumpVelocity += self.gravity; // Land on ground if (self.y >= self.groundY) { self.y = self.groundY; self.isJumping = false; self.jumpVelocity = 0; } } // Wrap around screen if (self.x > 2200) { self.x = -100; } // Pulse effect based on beat if (isInJumpWindow) { playerGraphics.tint = 0x00ff00; // Green when in beat window } else { playerGraphics.tint = 0xffffff; // Normal color } }; self.jump = function () { if (!self.isJumping) { self.isJumping = true; self.jumpVelocity = -18; self.jumpStartY = self.y; } }; self.addCombo = function () { self.comboCount++; if (self.comboCount >= 5) { // Show combo effect var comboEffect = game.addChild(new ComboEffect()); comboEffect.x = self.x; comboEffect.y = self.y - 100; comboEffect.show(self.comboCount); LK.getSound('combo').play(); } }; self.resetCombo = function () { self.comboCount = 0; }; return self; }); var Platform = Container.expand(function (x, y) { var self = Container.call(this); var platformGraphics = self.attachAsset('platform', { anchorX: 0.5, anchorY: 0.5 }); self.x = x; self.y = y; self.isHit = false; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a0033 // Dark purple digital background }); /**** * Game Code ****/ // Game variables // Game assets var djPlayer; var platforms = []; var beatIndicator; var track; var beatTrails = []; var score = 0; var successfulJumps = 0; var comboCount = 0; var maxCombo = 0; var backgroundColors = [0x1a0033, 0x330033, 0x004d33, 0x4d0033, 0x001a4d, 0x4d1a00]; var currentBGIndex = 0; var beatTimer = 0; var beatInterval = 50; // Slightly faster beat var jumpWindow = 8; // Tighter timing window var isInJumpWindow = false; var nextPlatform = null; var perfectJumps = 0; var gameSpeed = 1.0; // Create UI elements var scoreTxt = new Text2('Score: 0', { size: 60, fill: 0x00FFFF }); scoreTxt.anchor.set(0, 0); scoreTxt.x = 120; // Move right to avoid menu LK.gui.topLeft.addChild(scoreTxt); var jumpsTxt = new Text2('Jumps: 0', { size: 40, fill: 0xFFFFFF }); jumpsTxt.anchor.set(0, 0); jumpsTxt.x = 120; jumpsTxt.y = 70; LK.gui.topLeft.addChild(jumpsTxt); var comboTxt = new Text2('Combo: 0', { size: 40, fill: 0xFF00FF }); comboTxt.anchor.set(0, 0); comboTxt.x = 120; comboTxt.y = 110; LK.gui.topLeft.addChild(comboTxt); var perfectTxt = new Text2('Perfect: 0', { size: 30, fill: 0x00FF00 }); perfectTxt.anchor.set(0, 0); perfectTxt.x = 120; perfectTxt.y = 150; LK.gui.topLeft.addChild(perfectTxt); var instructionTxt = new Text2('Jump on the YELLOW pulse!', { size: 50, fill: 0xFFFF00 }); instructionTxt.anchor.set(0.5, 0); LK.gui.top.addChild(instructionTxt); // Create ground track track = game.addChild(LK.getAsset('track', { anchorX: 0, anchorY: 0, x: 0, y: 2520 })); // Create DJ player djPlayer = game.addChild(new DJPlayer()); djPlayer.x = 300; djPlayer.y = 2500; // Create beat indicator beatIndicator = game.addChild(new BeatIndicator()); beatIndicator.x = 1024; beatIndicator.y = 200; // Generate initial platforms function generatePlatform() { var lastPlatformX = platforms.length > 0 ? platforms[platforms.length - 1].x : djPlayer.x; var spacing = 180 + Math.random() * 60; // Rhythm-based spacing var platformX = lastPlatformX + spacing; var platformY = 2300 + Math.random() * -150; // Varying heights var platform = new Platform(platformX, platformY); platforms.push(platform); game.addChild(platform); } // Initialize some platforms for (var i = 0; i < 3; i++) { generatePlatform(); } // Find the nearest platform ahead of player function findNextPlatform() { var nearest = null; var minDistance = Infinity; for (var i = 0; i < platforms.length; i++) { var platform = platforms[i]; if (platform.x > djPlayer.x && platform.x - djPlayer.x < minDistance) { minDistance = platform.x - djPlayer.x; nearest = platform; } } return nearest; } // Check if jump timing is correct function checkJumpTiming() { nextPlatform = findNextPlatform(); if (nextPlatform) { var distanceToPlatform = Math.abs(nextPlatform.x - djPlayer.x); // Player should jump when close to platform and on beat if (distanceToPlatform < 120 && isInJumpWindow && !nextPlatform.isHit) { // Successful jump nextPlatform.isHit = true; successfulJumps++; comboCount++; djPlayer.addCombo(); // Check for perfect timing (very center of beat window) var perfectTiming = beatTimer >= beatInterval - 3 && beatTimer <= beatInterval + 3; if (perfectTiming) { perfectJumps++; score += 200; // Bonus for perfect timing LK.getSound('beatHit').play(); perfectTxt.setText('Perfect: ' + perfectJumps); } else { score += 100; LK.getSound('jumpSuccess').play(); } // Update combo tracking if (comboCount > maxCombo) { maxCombo = comboCount; } // Update UI scoreTxt.setText('Score: ' + score); jumpsTxt.setText('Jumps: ' + successfulJumps); comboTxt.setText('Combo: ' + comboCount); // Flash platform green tween(nextPlatform, { tint: perfectTiming ? 0x00ffff : 0x00ff00 }, { duration: 300, onFinish: function onFinish() { tween(nextPlatform, { tint: 0xffffff }, { duration: 200 }); } }); // Increase game speed slightly with combo if (comboCount % 5 === 0) { gameSpeed += 0.05; djPlayer.runSpeed = 3 * gameSpeed; } // Change background every 8 successful jumps if (successfulJumps % 8 === 0) { currentBGIndex = (currentBGIndex + 1) % backgroundColors.length; game.setBackgroundColor(backgroundColors[currentBGIndex]); LK.effects.flashScreen(perfectTiming ? 0x00ffff : 0x00ff00, 500); } return true; } } return false; } // Handle failed jump function handleFailedJump() { // Reset combo comboCount = 0; djPlayer.resetCombo(); comboTxt.setText('Combo: 0'); // Play fail sound LK.getSound('jumpFail').play(); // Flash screen red LK.effects.flashScreen(0xff0000, 1000); // Reset game after delay LK.setTimeout(function () { LK.showGameOver(); }, 1000); } // Touch/click handler game.down = function (x, y, obj) { if (!djPlayer.isJumping) { djPlayer.jump(); // Check if jump was well-timed if (!checkJumpTiming()) { // Wrong timing - game over handleFailedJump(); } } }; // Start background music LK.playMusic('bgbeat'); // Main game update loop game.update = function () { // Beat timing beatTimer++; // Check for beat window (slightly before the actual beat) if (beatTimer >= beatInterval - jumpWindow && beatTimer <= beatInterval + jumpWindow) { isInJumpWindow = true; } else { isInJumpWindow = false; } // Beat pulse effect if (beatTimer >= beatInterval) { beatTimer = 0; beatIndicator.pulse(); // Create beat trail effect var trail = game.addChild(new BeatTrail()); trail.x = beatIndicator.x + 50; trail.y = beatIndicator.y; beatTrails.push(trail); // Pulse effect on track tween(track, { scaleY: 1.2 }, { duration: 150, onFinish: function onFinish() { tween(track, { scaleY: 1 }, { duration: 150 }); } }); // Screen pulse on beat LK.effects.flashScreen(0x333333, 100); } // Update beat trails for (var t = beatTrails.length - 1; t >= 0; t--) { var trail = beatTrails[t]; if (trail.lifespan <= 0) { beatTrails.splice(t, 1); } } // Generate new platforms as needed if (platforms.length < 6) { generatePlatform(); } // Remove platforms that are far behind for (var i = platforms.length - 1; i >= 0; i--) { var platform = platforms[i]; if (platform.x < djPlayer.x - 500) { platform.destroy(); platforms.splice(i, 1); } } // Check if player fell too far if (djPlayer.y > 2800) { handleFailedJump(); } // Enhanced win condition with combo requirement if (successfulJumps >= 30 && maxCombo >= 10) { LK.showYouWin(); } };
===================================================================
--- original.js
+++ change.js
@@ -32,8 +32,50 @@
});
};
return self;
});
+var BeatTrail = Container.expand(function () {
+ var self = Container.call(this);
+ var trailGraphics = self.attachAsset('beatTrail', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.lifespan = 30; // Frames to live
+ self.velocity = -8; // Move left with beat
+ self.update = function () {
+ self.x += self.velocity;
+ self.lifespan--;
+ // Fade out over time
+ self.alpha = self.lifespan / 30;
+ // Remove when expired
+ if (self.lifespan <= 0) {
+ self.destroy();
+ }
+ };
+ return self;
+});
+var ComboEffect = Container.expand(function () {
+ var self = Container.call(this);
+ var comboGraphics = self.attachAsset('comboIndicator', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.show = function (comboCount) {
+ // Scale up and fade out effect
+ tween(self, {
+ scaleX: 2,
+ scaleY: 2,
+ alpha: 0
+ }, {
+ duration: 800,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ self.destroy();
+ }
+ });
+ };
+ return self;
+});
// Game variables
var DJPlayer = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('djPlayer', {
@@ -46,8 +88,10 @@
self.jumpVelocity = 0;
self.gravity = 0.8;
self.groundY = 2500;
self.jumpStartY = self.groundY;
+ self.comboCount = 0;
+ self.lastBeatTime = 0;
self.update = function () {
// Auto-run to the right
self.x += self.runSpeed;
// Handle jumping physics
@@ -64,16 +108,36 @@
// Wrap around screen
if (self.x > 2200) {
self.x = -100;
}
+ // Pulse effect based on beat
+ if (isInJumpWindow) {
+ playerGraphics.tint = 0x00ff00; // Green when in beat window
+ } else {
+ playerGraphics.tint = 0xffffff; // Normal color
+ }
};
self.jump = function () {
if (!self.isJumping) {
self.isJumping = true;
self.jumpVelocity = -18;
self.jumpStartY = self.y;
}
};
+ self.addCombo = function () {
+ self.comboCount++;
+ if (self.comboCount >= 5) {
+ // Show combo effect
+ var comboEffect = game.addChild(new ComboEffect());
+ comboEffect.x = self.x;
+ comboEffect.y = self.y - 100;
+ comboEffect.show(self.comboCount);
+ LK.getSound('combo').play();
+ }
+ };
+ self.resetCombo = function () {
+ self.comboCount = 0;
+ };
return self;
});
var Platform = Container.expand(function (x, y) {
var self = Container.call(this);
@@ -97,38 +161,60 @@
/****
* Game Code
****/
// Game variables
-// Import tween plugin for animations
// Game assets
var djPlayer;
var platforms = [];
var beatIndicator;
var track;
+var beatTrails = [];
var score = 0;
var successfulJumps = 0;
+var comboCount = 0;
+var maxCombo = 0;
var backgroundColors = [0x1a0033, 0x330033, 0x004d33, 0x4d0033, 0x001a4d, 0x4d1a00];
var currentBGIndex = 0;
var beatTimer = 0;
-var beatInterval = 60; // 60 ticks = 1 second beat
-var jumpWindow = 10; // Frames of tolerance for timing
+var beatInterval = 50; // Slightly faster beat
+var jumpWindow = 8; // Tighter timing window
var isInJumpWindow = false;
var nextPlatform = null;
+var perfectJumps = 0;
+var gameSpeed = 1.0;
// Create UI elements
var scoreTxt = new Text2('Score: 0', {
size: 60,
fill: 0x00FFFF
});
scoreTxt.anchor.set(0, 0);
+scoreTxt.x = 120; // Move right to avoid menu
LK.gui.topLeft.addChild(scoreTxt);
var jumpsTxt = new Text2('Jumps: 0', {
size: 40,
fill: 0xFFFFFF
});
jumpsTxt.anchor.set(0, 0);
+jumpsTxt.x = 120;
jumpsTxt.y = 70;
LK.gui.topLeft.addChild(jumpsTxt);
-var instructionTxt = new Text2('Tap to jump on beat!', {
+var comboTxt = new Text2('Combo: 0', {
+ size: 40,
+ fill: 0xFF00FF
+});
+comboTxt.anchor.set(0, 0);
+comboTxt.x = 120;
+comboTxt.y = 110;
+LK.gui.topLeft.addChild(comboTxt);
+var perfectTxt = new Text2('Perfect: 0', {
+ size: 30,
+ fill: 0x00FF00
+});
+perfectTxt.anchor.set(0, 0);
+perfectTxt.x = 120;
+perfectTxt.y = 150;
+LK.gui.topLeft.addChild(perfectTxt);
+var instructionTxt = new Text2('Jump on the YELLOW pulse!', {
size: 50,
fill: 0xFFFF00
});
instructionTxt.anchor.set(0.5, 0);
@@ -149,10 +235,12 @@
beatIndicator.x = 1024;
beatIndicator.y = 200;
// Generate initial platforms
function generatePlatform() {
- var platformX = Math.random() * 1500 + 2300; // Spawn ahead of player
- var platformY = 2400 + Math.random() * -200; // Varying heights
+ var lastPlatformX = platforms.length > 0 ? platforms[platforms.length - 1].x : djPlayer.x;
+ var spacing = 180 + Math.random() * 60; // Rhythm-based spacing
+ var platformX = lastPlatformX + spacing;
+ var platformY = 2300 + Math.random() * -150; // Varying heights
var platform = new Platform(platformX, platformY);
platforms.push(platform);
game.addChild(platform);
}
@@ -178,21 +266,36 @@
nextPlatform = findNextPlatform();
if (nextPlatform) {
var distanceToPlatform = Math.abs(nextPlatform.x - djPlayer.x);
// Player should jump when close to platform and on beat
- if (distanceToPlatform < 100 && isInJumpWindow && !nextPlatform.isHit) {
+ if (distanceToPlatform < 120 && isInJumpWindow && !nextPlatform.isHit) {
// Successful jump
nextPlatform.isHit = true;
successfulJumps++;
- score += 100;
+ comboCount++;
+ djPlayer.addCombo();
+ // Check for perfect timing (very center of beat window)
+ var perfectTiming = beatTimer >= beatInterval - 3 && beatTimer <= beatInterval + 3;
+ if (perfectTiming) {
+ perfectJumps++;
+ score += 200; // Bonus for perfect timing
+ LK.getSound('beatHit').play();
+ perfectTxt.setText('Perfect: ' + perfectJumps);
+ } else {
+ score += 100;
+ LK.getSound('jumpSuccess').play();
+ }
+ // Update combo tracking
+ if (comboCount > maxCombo) {
+ maxCombo = comboCount;
+ }
// Update UI
scoreTxt.setText('Score: ' + score);
jumpsTxt.setText('Jumps: ' + successfulJumps);
- // Play success sound
- LK.getSound('jumpSuccess').play();
+ comboTxt.setText('Combo: ' + comboCount);
// Flash platform green
tween(nextPlatform, {
- tint: 0x00ff00
+ tint: perfectTiming ? 0x00ffff : 0x00ff00
}, {
duration: 300,
onFinish: function onFinish() {
tween(nextPlatform, {
@@ -201,22 +304,30 @@
duration: 200
});
}
});
- // Change background every 10 successful jumps
- if (successfulJumps % 10 === 0) {
+ // Increase game speed slightly with combo
+ if (comboCount % 5 === 0) {
+ gameSpeed += 0.05;
+ djPlayer.runSpeed = 3 * gameSpeed;
+ }
+ // Change background every 8 successful jumps
+ if (successfulJumps % 8 === 0) {
currentBGIndex = (currentBGIndex + 1) % backgroundColors.length;
game.setBackgroundColor(backgroundColors[currentBGIndex]);
- // Show achievement
- LK.effects.flashScreen(0x00ff00, 500);
+ LK.effects.flashScreen(perfectTiming ? 0x00ffff : 0x00ff00, 500);
}
return true;
}
}
return false;
}
// Handle failed jump
function handleFailedJump() {
+ // Reset combo
+ comboCount = 0;
+ djPlayer.resetCombo();
+ comboTxt.setText('Combo: 0');
// Play fail sound
LK.getSound('jumpFail').play();
// Flash screen red
LK.effects.flashScreen(0xff0000, 1000);
@@ -251,24 +362,38 @@
// Beat pulse effect
if (beatTimer >= beatInterval) {
beatTimer = 0;
beatIndicator.pulse();
+ // Create beat trail effect
+ var trail = game.addChild(new BeatTrail());
+ trail.x = beatIndicator.x + 50;
+ trail.y = beatIndicator.y;
+ beatTrails.push(trail);
// Pulse effect on track
tween(track, {
- scaleY: 1.1
+ scaleY: 1.2
}, {
- duration: 100,
+ duration: 150,
onFinish: function onFinish() {
tween(track, {
scaleY: 1
}, {
- duration: 100
+ duration: 150
});
}
});
+ // Screen pulse on beat
+ LK.effects.flashScreen(0x333333, 100);
}
+ // Update beat trails
+ for (var t = beatTrails.length - 1; t >= 0; t--) {
+ var trail = beatTrails[t];
+ if (trail.lifespan <= 0) {
+ beatTrails.splice(t, 1);
+ }
+ }
// Generate new platforms as needed
- if (platforms.length < 5) {
+ if (platforms.length < 6) {
generatePlatform();
}
// Remove platforms that are far behind
for (var i = platforms.length - 1; i >= 0; i--) {
@@ -281,9 +406,9 @@
// Check if player fell too far
if (djPlayer.y > 2800) {
handleFailedJump();
}
- // Win condition - survive long enough
- if (successfulJumps >= 50) {
+ // Enhanced win condition with combo requirement
+ if (successfulJumps >= 30 && maxCombo >= 10) {
LK.showYouWin();
}
};
\ No newline at end of file