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"); var storage = LK.import("@upit/storage.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; }); 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 = 4; self.isJumping = false; self.jumpVelocity = 0; self.gravity = 0.9; self.groundY = 2500; self.jumpStartY = self.groundY; self.comboCount = 0; self.lastBeatTime = 0; self.beatPulseScale = 1.0; self.update = function () { // Auto-run to the right with slight variation self.x += self.runSpeed; // Handle jumping physics if (self.isJumping) { self.y += self.jumpVelocity; self.jumpVelocity += self.gravity; // Land on ground or platform if (self.y >= self.groundY) { self.y = self.groundY; self.isJumping = false; self.jumpVelocity = 0; } } // Wrap around screen smoothly if (self.x > 2200) { self.x = -150; } // Enhanced pulse effect based on beat with headphone glow if (isInJumpWindow) { playerGraphics.tint = 0x00ff88; // Bright green when in perfect timing self.beatPulseScale = 1.1; } else if (nearBeat) { playerGraphics.tint = 0xffff44; // Yellow when approaching beat self.beatPulseScale = 1.05; } else { playerGraphics.tint = 0x44ddff; // Cool blue normal color (DJ vibe) self.beatPulseScale = 1.0; } // Apply beat pulse scaling playerGraphics.scaleX = self.beatPulseScale; playerGraphics.scaleY = self.beatPulseScale; }; self.jump = function () { if (!self.isJumping) { self.isJumping = true; self.jumpVelocity = -19; // Slightly higher jump self.jumpStartY = self.y; // Play jump sound with slight pitch variation LK.getSound('beatHit').play(); } }; self.addCombo = function () { self.comboCount++; // Enhanced combo effects if (self.comboCount % 5 === 0) { var comboEffect = game.addChild(new ComboEffect()); comboEffect.x = self.x; comboEffect.y = self.y - 120; comboEffect.show(self.comboCount); LK.getSound('combo').play(); } // Crowd cheer every 20 jumps if (self.comboCount % 20 === 0) { LK.getSound('crowdCheer').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; self.glowIntensity = 0; self.update = function () { // Glow effect when beat hits nearby if (isInJumpWindow && Math.abs(self.x - djPlayer.x) < 200) { self.glowIntensity = Math.min(1.0, self.glowIntensity + 0.1); platformGraphics.tint = 0xff6644; // Orange glow } else { self.glowIntensity = Math.max(0, self.glowIntensity - 0.05); platformGraphics.tint = 0xffffff; // Normal color } // Subtle floating animation platformGraphics.y = Math.sin(LK.ticks * 0.05 + self.x * 0.01) * 3; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a0033 // Dark purple digital background }); /**** * Game Code ****/ // Game variables for 120 BPM rhythm mechanics 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; // 120 BPM = 60 frames per beat at 60 FPS var beatTimer = 0; var beatInterval = 60; // 120 BPM timing var jumpWindow = 6; // ±100ms window (6 frames at 60fps) var isInJumpWindow = false; var nearBeat = false; // For visual warning var nextPlatform = null; var perfectJumps = 0; var gameSpeed = 1.0; var highScore = storage.highScore || 0; var totalJumps = storage.totalJumps || 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 with precise 120 BPM mechanics function checkJumpTiming() { nextPlatform = findNextPlatform(); if (nextPlatform) { var distanceToPlatform = Math.abs(nextPlatform.x - djPlayer.x); // Player must jump when close to platform AND within beat window if (distanceToPlatform < 140 && isInJumpWindow && !nextPlatform.isHit) { // Successful jump nextPlatform.isHit = true; successfulJumps++; totalJumps++; comboCount++; djPlayer.addCombo(); // Perfect timing detection (center 3 frames of beat window) var perfectTiming = Math.abs(beatTimer - beatInterval) <= 2; if (perfectTiming) { perfectJumps++; score += 300; // Higher bonus for perfect timing LK.getSound('beatHit').play(); perfectTxt.setText('Perfect: ' + perfectJumps); // Perfect jump particle effect createParticleEffect(djPlayer.x, djPlayer.y - 50, 0x00ffff); } else { score += 150; LK.getSound('jumpSuccess').play(); // Good jump particle effect createParticleEffect(djPlayer.x, djPlayer.y - 50, 0x00ff00); } // Update combo tracking if (comboCount > maxCombo) { maxCombo = comboCount; } // Save progress storage.totalJumps = totalJumps; if (score > highScore) { highScore = score; storage.highScore = highScore; } // Update UI scoreTxt.setText('Score: ' + score + ' (Best: ' + highScore + ')'); jumpsTxt.setText('Jumps: ' + successfulJumps); comboTxt.setText('Combo: ' + comboCount); // Enhanced platform flash effect tween(nextPlatform, { tint: perfectTiming ? 0x00ffff : 0x00ff00, scaleX: 1.3, scaleY: 1.3 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(nextPlatform, { tint: 0xffffff, scaleX: 1.0, scaleY: 1.0 }, { duration: 300, easing: tween.easeIn }); } }); // Progressive speed increase if (comboCount % 8 === 0) { gameSpeed += 0.03; djPlayer.runSpeed = 4 * gameSpeed; } // Background color change every 10 successful jumps if (successfulJumps % 10 === 0) { currentBGIndex = (currentBGIndex + 1) % backgroundColors.length; game.setBackgroundColor(backgroundColors[currentBGIndex]); LK.effects.flashScreen(perfectTiming ? 0x00ffff : 0x00ff00, 600); } return true; } } return false; } // Create particle effect for successful jumps function createParticleEffect(x, y, color) { for (var i = 0; i < 5; i++) { var particle = game.addChild(LK.getAsset('beatTrail', { anchorX: 0.5, anchorY: 0.5, x: x + (Math.random() - 0.5) * 40, y: y + (Math.random() - 0.5) * 40, tint: color })); // Animate particles tween(particle, { x: particle.x + (Math.random() - 0.5) * 200, y: particle.y - Math.random() * 100 - 50, alpha: 0, scaleX: 0.2, scaleY: 0.2 }, { duration: 800 + Math.random() * 400, easing: tween.easeOut, onFinish: function onFinish() { particle.destroy(); } }); } } // 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 with precise 120 BPM mechanics game.update = function () { // 120 BPM beat timing (60 frames per beat) beatTimer++; if (beatTimer > beatInterval) { beatTimer = 0; } // Check for perfect beat window (±100ms = ±6 frames) isInJumpWindow = beatTimer >= beatInterval - jumpWindow && beatTimer <= jumpWindow || beatTimer >= beatInterval - jumpWindow; // Near beat warning (±200ms = ±12 frames) nearBeat = beatTimer >= beatInterval - 12 && beatTimer <= 12 || beatTimer >= beatInterval - 12; // Beat pulse effect exactly on beat if (beatTimer === 0) { beatIndicator.pulse(); // Create multiple beat trail effects for (var i = 0; i < 3; i++) { var trail = game.addChild(new BeatTrail()); trail.x = beatIndicator.x + 50 + i * 30; trail.y = beatIndicator.y + (Math.random() - 0.5) * 40; beatTrails.push(trail); } // Enhanced track pulse effect tween(track, { scaleY: 1.3, tint: 0xff6644 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(track, { scaleY: 1, tint: 0xffffff }, { duration: 200, easing: tween.easeIn }); } }); // Synchronized screen pulse LK.effects.flashScreen(0x444444, 120); } // 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 platforms in sync with music rhythm if (platforms.length < 8) { generatePlatform(); } // Remove old platforms for (var i = platforms.length - 1; i >= 0; i--) { var platform = platforms[i]; if (platform.x < djPlayer.x - 600) { platform.destroy(); platforms.splice(i, 1); } } // Check if player fell if (djPlayer.y > 2800) { handleFailedJump(); } // Win condition: 50 successful jumps with good combo performance if (successfulJumps >= 50 && maxCombo >= 15) { LK.showYouWin(); } };
===================================================================
--- original.js
+++ change.js
@@ -1,8 +1,9 @@
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
@@ -74,66 +75,80 @@
});
};
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.runSpeed = 4;
self.isJumping = false;
self.jumpVelocity = 0;
- self.gravity = 0.8;
+ self.gravity = 0.9;
self.groundY = 2500;
self.jumpStartY = self.groundY;
self.comboCount = 0;
self.lastBeatTime = 0;
+ self.beatPulseScale = 1.0;
self.update = function () {
- // Auto-run to the right
+ // Auto-run to the right with slight variation
self.x += self.runSpeed;
// Handle jumping physics
if (self.isJumping) {
self.y += self.jumpVelocity;
self.jumpVelocity += self.gravity;
- // Land on ground
+ // Land on ground or platform
if (self.y >= self.groundY) {
self.y = self.groundY;
self.isJumping = false;
self.jumpVelocity = 0;
}
}
- // Wrap around screen
+ // Wrap around screen smoothly
if (self.x > 2200) {
- self.x = -100;
+ self.x = -150;
}
- // Pulse effect based on beat
+ // Enhanced pulse effect based on beat with headphone glow
if (isInJumpWindow) {
- playerGraphics.tint = 0x00ff00; // Green when in beat window
+ playerGraphics.tint = 0x00ff88; // Bright green when in perfect timing
+ self.beatPulseScale = 1.1;
+ } else if (nearBeat) {
+ playerGraphics.tint = 0xffff44; // Yellow when approaching beat
+ self.beatPulseScale = 1.05;
} else {
- playerGraphics.tint = 0xffffff; // Normal color
+ playerGraphics.tint = 0x44ddff; // Cool blue normal color (DJ vibe)
+ self.beatPulseScale = 1.0;
}
+ // Apply beat pulse scaling
+ playerGraphics.scaleX = self.beatPulseScale;
+ playerGraphics.scaleY = self.beatPulseScale;
};
self.jump = function () {
if (!self.isJumping) {
self.isJumping = true;
- self.jumpVelocity = -18;
+ self.jumpVelocity = -19; // Slightly higher jump
self.jumpStartY = self.y;
+ // Play jump sound with slight pitch variation
+ LK.getSound('beatHit').play();
}
};
self.addCombo = function () {
self.comboCount++;
- if (self.comboCount >= 5) {
- // Show combo effect
+ // Enhanced combo effects
+ if (self.comboCount % 5 === 0) {
var comboEffect = game.addChild(new ComboEffect());
comboEffect.x = self.x;
- comboEffect.y = self.y - 100;
+ comboEffect.y = self.y - 120;
comboEffect.show(self.comboCount);
LK.getSound('combo').play();
}
+ // Crowd cheer every 20 jumps
+ if (self.comboCount % 20 === 0) {
+ LK.getSound('crowdCheer').play();
+ }
};
self.resetCombo = function () {
self.comboCount = 0;
};
@@ -147,8 +162,21 @@
});
self.x = x;
self.y = y;
self.isHit = false;
+ self.glowIntensity = 0;
+ self.update = function () {
+ // Glow effect when beat hits nearby
+ if (isInJumpWindow && Math.abs(self.x - djPlayer.x) < 200) {
+ self.glowIntensity = Math.min(1.0, self.glowIntensity + 0.1);
+ platformGraphics.tint = 0xff6644; // Orange glow
+ } else {
+ self.glowIntensity = Math.max(0, self.glowIntensity - 0.05);
+ platformGraphics.tint = 0xffffff; // Normal color
+ }
+ // Subtle floating animation
+ platformGraphics.y = Math.sin(LK.ticks * 0.05 + self.x * 0.01) * 3;
+ };
return self;
});
/****
@@ -160,10 +188,9 @@
/****
* Game Code
****/
-// Game variables
-// Game assets
+// Game variables for 120 BPM rhythm mechanics
var djPlayer;
var platforms = [];
var beatIndicator;
var track;
@@ -173,15 +200,19 @@
var comboCount = 0;
var maxCombo = 0;
var backgroundColors = [0x1a0033, 0x330033, 0x004d33, 0x4d0033, 0x001a4d, 0x4d1a00];
var currentBGIndex = 0;
+// 120 BPM = 60 frames per beat at 60 FPS
var beatTimer = 0;
-var beatInterval = 50; // Slightly faster beat
-var jumpWindow = 8; // Tighter timing window
+var beatInterval = 60; // 120 BPM timing
+var jumpWindow = 6; // ±100ms window (6 frames at 60fps)
var isInJumpWindow = false;
+var nearBeat = false; // For visual warning
var nextPlatform = null;
var perfectJumps = 0;
var gameSpeed = 1.0;
+var highScore = storage.highScore || 0;
+var totalJumps = storage.totalJumps || 0;
// Create UI elements
var scoreTxt = new Text2('Score: 0', {
size: 60,
fill: 0x00FFFF
@@ -260,68 +291,111 @@
}
}
return nearest;
}
-// Check if jump timing is correct
+// Check if jump timing is correct with precise 120 BPM mechanics
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) {
+ // Player must jump when close to platform AND within beat window
+ if (distanceToPlatform < 140 && isInJumpWindow && !nextPlatform.isHit) {
// Successful jump
nextPlatform.isHit = true;
successfulJumps++;
+ totalJumps++;
comboCount++;
djPlayer.addCombo();
- // Check for perfect timing (very center of beat window)
- var perfectTiming = beatTimer >= beatInterval - 3 && beatTimer <= beatInterval + 3;
+ // Perfect timing detection (center 3 frames of beat window)
+ var perfectTiming = Math.abs(beatTimer - beatInterval) <= 2;
if (perfectTiming) {
perfectJumps++;
- score += 200; // Bonus for perfect timing
+ score += 300; // Higher bonus for perfect timing
LK.getSound('beatHit').play();
perfectTxt.setText('Perfect: ' + perfectJumps);
+ // Perfect jump particle effect
+ createParticleEffect(djPlayer.x, djPlayer.y - 50, 0x00ffff);
} else {
- score += 100;
+ score += 150;
LK.getSound('jumpSuccess').play();
+ // Good jump particle effect
+ createParticleEffect(djPlayer.x, djPlayer.y - 50, 0x00ff00);
}
// Update combo tracking
if (comboCount > maxCombo) {
maxCombo = comboCount;
}
+ // Save progress
+ storage.totalJumps = totalJumps;
+ if (score > highScore) {
+ highScore = score;
+ storage.highScore = highScore;
+ }
// Update UI
- scoreTxt.setText('Score: ' + score);
+ scoreTxt.setText('Score: ' + score + ' (Best: ' + highScore + ')');
jumpsTxt.setText('Jumps: ' + successfulJumps);
comboTxt.setText('Combo: ' + comboCount);
- // Flash platform green
+ // Enhanced platform flash effect
tween(nextPlatform, {
- tint: perfectTiming ? 0x00ffff : 0x00ff00
+ tint: perfectTiming ? 0x00ffff : 0x00ff00,
+ scaleX: 1.3,
+ scaleY: 1.3
}, {
- duration: 300,
+ duration: 200,
+ easing: tween.easeOut,
onFinish: function onFinish() {
tween(nextPlatform, {
- tint: 0xffffff
+ tint: 0xffffff,
+ scaleX: 1.0,
+ scaleY: 1.0
}, {
- duration: 200
+ duration: 300,
+ easing: tween.easeIn
});
}
});
- // Increase game speed slightly with combo
- if (comboCount % 5 === 0) {
- gameSpeed += 0.05;
- djPlayer.runSpeed = 3 * gameSpeed;
+ // Progressive speed increase
+ if (comboCount % 8 === 0) {
+ gameSpeed += 0.03;
+ djPlayer.runSpeed = 4 * gameSpeed;
}
- // Change background every 8 successful jumps
- if (successfulJumps % 8 === 0) {
+ // Background color change every 10 successful jumps
+ if (successfulJumps % 10 === 0) {
currentBGIndex = (currentBGIndex + 1) % backgroundColors.length;
game.setBackgroundColor(backgroundColors[currentBGIndex]);
- LK.effects.flashScreen(perfectTiming ? 0x00ffff : 0x00ff00, 500);
+ LK.effects.flashScreen(perfectTiming ? 0x00ffff : 0x00ff00, 600);
}
return true;
}
}
return false;
}
+// Create particle effect for successful jumps
+function createParticleEffect(x, y, color) {
+ for (var i = 0; i < 5; i++) {
+ var particle = game.addChild(LK.getAsset('beatTrail', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: x + (Math.random() - 0.5) * 40,
+ y: y + (Math.random() - 0.5) * 40,
+ tint: color
+ }));
+ // Animate particles
+ tween(particle, {
+ x: particle.x + (Math.random() - 0.5) * 200,
+ y: particle.y - Math.random() * 100 - 50,
+ alpha: 0,
+ scaleX: 0.2,
+ scaleY: 0.2
+ }, {
+ duration: 800 + Math.random() * 400,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ particle.destroy();
+ }
+ });
+ }
+}
// Handle failed jump
function handleFailedJump() {
// Reset combo
comboCount = 0;
@@ -348,67 +422,73 @@
}
};
// Start background music
LK.playMusic('bgbeat');
-// Main game update loop
+// Main game update loop with precise 120 BPM mechanics
game.update = function () {
- // Beat timing
+ // 120 BPM beat timing (60 frames per beat)
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) {
+ if (beatTimer > beatInterval) {
beatTimer = 0;
+ }
+ // Check for perfect beat window (±100ms = ±6 frames)
+ isInJumpWindow = beatTimer >= beatInterval - jumpWindow && beatTimer <= jumpWindow || beatTimer >= beatInterval - jumpWindow;
+ // Near beat warning (±200ms = ±12 frames)
+ nearBeat = beatTimer >= beatInterval - 12 && beatTimer <= 12 || beatTimer >= beatInterval - 12;
+ // Beat pulse effect exactly on beat
+ if (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
+ // Create multiple beat trail effects
+ for (var i = 0; i < 3; i++) {
+ var trail = game.addChild(new BeatTrail());
+ trail.x = beatIndicator.x + 50 + i * 30;
+ trail.y = beatIndicator.y + (Math.random() - 0.5) * 40;
+ beatTrails.push(trail);
+ }
+ // Enhanced track pulse effect
tween(track, {
- scaleY: 1.2
+ scaleY: 1.3,
+ tint: 0xff6644
}, {
- duration: 150,
+ duration: 100,
+ easing: tween.easeOut,
onFinish: function onFinish() {
tween(track, {
- scaleY: 1
+ scaleY: 1,
+ tint: 0xffffff
}, {
- duration: 150
+ duration: 200,
+ easing: tween.easeIn
});
}
});
- // Screen pulse on beat
- LK.effects.flashScreen(0x333333, 100);
+ // Synchronized screen pulse
+ LK.effects.flashScreen(0x444444, 120);
}
// 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) {
+ // Generate platforms in sync with music rhythm
+ if (platforms.length < 8) {
generatePlatform();
}
- // Remove platforms that are far behind
+ // Remove old platforms
for (var i = platforms.length - 1; i >= 0; i--) {
var platform = platforms[i];
- if (platform.x < djPlayer.x - 500) {
+ if (platform.x < djPlayer.x - 600) {
platform.destroy();
platforms.splice(i, 1);
}
}
- // Check if player fell too far
+ // Check if player fell
if (djPlayer.y > 2800) {
handleFailedJump();
}
- // Enhanced win condition with combo requirement
- if (successfulJumps >= 30 && maxCombo >= 10) {
+ // Win condition: 50 successful jumps with good combo performance
+ if (successfulJumps >= 50 && maxCombo >= 15) {
LK.showYouWin();
}
};
\ No newline at end of file