User prompt
Add a visible combo counter to the top-right corner of the screen: - Initialize comboCounter = 0 - On each successful tile tap, increment comboCounter by 1 - On tile miss, reset comboCounter to 0 - Display current combo count using text element 'comboDisplay' - If comboCounter < 2, hide comboDisplay - If comboCounter ≥ 2, show text: "Combo x[comboCounter]" Style: - Position: Top-right (screenWidth - 100, 40) - Font size: 24px - Color: White or yellow - Bold or outlined for visibility
User prompt
On every 10-hit combo (comboCounter % 10 === 0): - Spawn 'comboText' at (screen center X, 100px from top) - Set text to “Combo x10!” (or x20, x30, etc. depending on comboCounter) - Fade in over 150ms, hold 400ms, then fade out over 300ms - Spawn 'comboGlow' behind tiles with opacity 0.5 and fade it out over 400ms - Combo counter resets to 0 on missed tile ↪ Consider scaling 'comboText' up slightly for a popping effect ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Track combo count (consecutive successful tile taps without miss) On every 10-hit combo streak: - Show 'comboGlow' overlay centered on screen - Fade it in to 0.5 opacity and out over 300ms using easing - Spawn text 'Combo x10!' slightly above screen center - Fade out text over 500ms - Reset or continue combo counter ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
On successful tile tap: - Determine the tapped column (1–4) - Spawn the corresponding overlay asset ('columnFlash1' to 'columnFlash4') at the tile's position - Animate it upward by 100px over 150ms using ease-out - Then animate it downward to original position over 150ms using ease-in - Fade out overlay over full 300ms duration - Ensure this animation does not block tile input ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
On successful tile tap: - Spawn 'columnFlashX' (corresponding to tapped column) at tile position - Animate it moving upward by 100px over 150ms - Then animate it moving back down to original position over 150ms - Apply easing to both directions - Fade out over the full duration (optional) ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
On every beat (375ms), fade in 'backgrayoverlay' to opacity 0.35 and fade back out over 300ms using smooth easing ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
At game start: - Set pulseFlash1 anchor to screen center - Scale pulseFlash1 so its width = screen width and its height = screen height (maintain aspect ratio) On every beat (375 ms): - Animate pulseFlash1 opacity 0→0.35→0, keep scale as set above - Fade‐out 300 ms with smooth easing ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Center "pulseFlash1" on screen; keep scale 1. On each beat: fade to opacity 0.3, then back to 0 over 300 ms. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Center pulseFlashFull on screen; keep scale 3. On each beat: fade to opacity 0.3, then back to 0 over 300 ms. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Center pulseFlashFull on screen; keep scale 1. On each beat: fade to opacity 0.3, then back to 0 over 300 ms. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
On every beat (375ms), fade in 'pulseFlash1' to opacity 0.35 and scale it to 1.2 Then fade out over 300ms with smooth easing ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add image asset 'pulseFlash1' to the center of the screen, behind the falling tiles Start with opacity 0 and scale 1 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make rhythmic background animation more visible: - Increase brightness/pulse intensity to 15% - Slightly scale background overlay (1.0 → 1.05) on beat - Add soft hue shift or gradient motion synced with beat - Ensure background overlay is layered above base background but behind falling tiles - Use 250ms smooth transitions triggered every 375ms for 160 BPM beat ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add rhythmic animated background synced to the beat: - Make background pulse in scale or brightness slightly with each beat - Use smooth easing and low opacity transitions (max 10% brightness shift) - Optionally rotate or shift gradient subtly over time - Increase animation intensity slightly with player score milestones - Ensure animation does not interfere with tile visibility ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Create a column-based visual effect when a tile is tapped: - Light up the entire column (top to bottom) with a bright overlay color matching the tile - Use a vertical color flash or pulse that fades within 300–400ms - Overlay should appear behind or blended with existing tiles - Use smooth easing and mild blur for soft visual effect - Avoid full-screen flashes; restrict effect to the tile’s column only ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Enhance impact without overwhelming the screen: - Keep 'burst1' and 'glowring1' size within 1.5x tile size - Use vivid colors and strong opacity, but apply a radial gradient or soft blur - Increase particle count slightly (5–6) with small movement radius (within 80px) - Add a short spark line animation or crossfade flash near the tile - Stagger effects by 50ms per column to reduce simultaneous flashing - Keep total animation duration under 400ms with smooth easing ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Limit visual effects to the tapped tile area: - Reduce the size and opacity of 'burst1' and 'glowring1' to avoid covering the whole screen - Ensure effects are centered on the tile and not scaled beyond tile bounds - Remove or minimize any global screen-wide flashes or shakes - Keep all effects localized and subtle, fading quickly (under 250ms) ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make visual effects more prominent: - Double the size and brightness of 'burst1' and 'glowring1' effects - Increase the number of 'trail1' particles to 6–8 and give them longer fade duration - Add a brief screen shake or flash if possible for dramatic feedback ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Limit visual effects to the tapped tile area: - Reduce the size and opacity of 'burst1' and 'glowring1' to avoid covering the whole screen - Ensure effects are centered on the tile and not scaled beyond tile bounds - Remove or minimize any global screen-wide flashes or shakes - Keep all effects localized and subtle, fading quickly (under 250ms) ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make visual effects more prominent: - Double the size and brightness of 'burst1' and 'glowring1' effects - Increase the number of 'trail1' particles to 6–8 and give them longer fade duration - Add a brief screen shake or flash if possible for dramatic feedback ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
When a tile is successfully tapped: - Spawn 'burst1' at the tile's position and animate it expanding and fading over 300ms - Overlay 'glowring1' with matching column color, scaled up smoothly and faded out - Optionally emit 3–5 small 'trail1' particles radiating outward, fading as they move Ensure all effects sync with the note sound and do not block gameplay ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Enhance the color burst effect when a tile is tapped: - Make the burst larger and more vivid - Use bright, saturated colors specific to each column: - Column 1: Purple - Column 2: Blue - Column 3: Yellow - Column 4: Red - The effect should include a short glow or ring that expands and fades - Add a soft particle trail or flash that radiates outward from the tap point - Fade the burst over 300ms with smooth easing ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add a visual color burst or glow effect on a tile when it's successfully tapped. Use a distinct, vibrant color for each column's note. The effect should appear instantly and fade out smoothly to give musical feedback. If possible, add a short trailing effect or explosion burst when the tile is hit. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add color transitions to the background or tile trails based on the active melody pattern or player score milestones. Make sure transitions are rhythmic and smooth. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Introduce controlled randomness to the melody. Occasionally vary the spawn column within the beat structure to prevent repetition, while keeping the overall melody harmonious and rhythmic.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Column = Container.expand(function () { var self = Container.call(this); var columnGraphics = self.attachAsset('column', { anchorX: 0.5, anchorY: 0, alpha: 0.3 }); var scoreZone = self.attachAsset('scoreZone', { anchorX: 0.5, anchorY: 0.5, y: 2732 - 200, alpha: 0.4 }); self.scoreZoneY = 2732 - 200; return self; }); var Tile = Container.expand(function () { var self = Container.call(this); var tileGraphics = self.attachAsset('tile', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 6; self.columnIndex = 0; self.scored = false; self.missed = false; self.update = function () { self.y += self.speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a2e }); /**** * Game Code ****/ var columns = []; var tiles = []; var score = 0; var gameStarted = false; var musicDuration = 22000; // 22 seconds var gameStartTime = 0; var perfectZone = 50; var goodZone = 100; var pianoTones = ['noteA3', 'noteC4', 'noteE4', 'noteG4']; // Create UI var scoreTxt = new Text2('Score: 0', { size: 120, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Create columns var columnWidth = 2048 / 4; for (var i = 0; i < 4; i++) { var column = new Column(); column.x = i * columnWidth + columnWidth / 2; column.y = 0; columns.push(column); game.addChild(column); } // Multiple predefined melody patterns for variety var melodyPatterns = [[1, 1, 2, 2, 3, 3, 2, 2, 1], // Pattern A: C4, C4, E4, E4, G4, G4, E4, E4, C4 [3, 2, 1, 1, 0, 0, 1, 2], // Pattern B: G4, E4, C4, C4, A3, A3, C4, E4 [0, 2, 1, 3, 0, 2, 1, 3], // Pattern C: A3, E4, C4, G4, A3, E4, C4, G4 [3, 1, 3, 1, 2, 2, 0, 0] // Pattern D: G4, C4, G4, C4, E4, E4, A3, A3 ]; var currentPatternIndex = 0; var melodyPattern = melodyPatterns[currentPatternIndex]; var spawnPattern = []; var beatInterval = 500; // 500ms per beat for steady rhythm var patternRepeatDuration = melodyPattern.length * beatInterval; // 9 beats = 4500ms per pattern // Generate spawn pattern by repeating the melody pattern throughout the game duration var currentTime = 500; // Start after 500ms var patternPosition = 0; while (currentTime < musicDuration) { spawnPattern.push({ time: currentTime, columns: [melodyPattern[patternPosition]] }); currentTime += beatInterval; patternPosition = (patternPosition + 1) % melodyPattern.length; } var patternIndex = 0; function spawnTile(columnIndex) { var tile = new Tile(); tile.columnIndex = columnIndex; tile.x = columns[columnIndex].x; tile.y = -60; tiles.push(tile); game.addChild(tile); } function calculateScore(distance) { if (distance <= perfectZone) { return 100; } else if (distance <= goodZone) { return 50; } return 0; } function updateScore(points) { score += points; scoreTxt.setText('Score: ' + score); } game.down = function (x, y, obj) { if (!gameStarted) { gameStarted = true; gameStartTime = LK.ticks * (1000 / 60); LK.playMusic('gamesound3_backing', { loop: true }); return; } // Determine which column was tapped var columnIndex = Math.floor(x / columnWidth); if (columnIndex < 0) columnIndex = 0; if (columnIndex > 3) columnIndex = 3; var hitTile = null; var bestDistance = Infinity; // Find the closest tile in the tapped column within scoring range for (var i = 0; i < tiles.length; i++) { var tile = tiles[i]; if (tile.columnIndex === columnIndex && !tile.scored && !tile.missed) { var scoreZoneY = columns[columnIndex].scoreZoneY; var distance = Math.abs(tile.y - scoreZoneY); if (distance <= goodZone && distance < bestDistance) { bestDistance = distance; hitTile = tile; } } } if (hitTile) { hitTile.scored = true; var points = calculateScore(bestDistance); updateScore(points); // Visual feedback if (points === 100) { LK.effects.flashObject(hitTile, 0x00ff00, 200); } else if (points === 50) { LK.effects.flashObject(hitTile, 0xffff00, 200); } LK.getSound(pianoTones[columnIndex]).play(); // Remove tile hitTile.destroy(); for (var j = tiles.length - 1; j >= 0; j--) { if (tiles[j] === hitTile) { tiles.splice(j, 1); break; } } } }; game.update = function () { if (!gameStarted) { return; } var currentTime = LK.ticks * (1000 / 60) - gameStartTime; // Spawn tiles according to endless repeating pattern with pattern cycling and controlled randomness var patternTime = currentTime % patternRepeatDuration; // Loop the pattern timing var shouldSpawn = false; // Check if we need to switch to the next pattern var patternCycleTime = Math.floor(currentTime / patternRepeatDuration); var newPatternIndex = patternCycleTime % melodyPatterns.length; if (newPatternIndex !== currentPatternIndex) { currentPatternIndex = newPatternIndex; melodyPattern = melodyPatterns[currentPatternIndex]; } for (var p = 0; p < melodyPattern.length; p++) { var spawnTime = p * beatInterval + 500; // Add initial 500ms offset if (Math.abs(patternTime - spawnTime) < 16) { // 16ms tolerance for 60fps var targetColumn = melodyPattern[p]; var finalColumn = targetColumn; // Add controlled randomness - 20% chance to vary the column if (Math.random() < 0.2) { // Define harmonic variations for each base column var harmonicVariations = [[0, 1], // A3 can vary to C4 [1, 2], // C4 can vary to E4 [2, 3, 1], // E4 can vary to G4 or back to C4 [3, 2] // G4 can vary to E4 ]; var variations = harmonicVariations[targetColumn]; if (variations && variations.length > 0) { finalColumn = variations[Math.floor(Math.random() * variations.length)]; } } spawnTile(finalColumn); shouldSpawn = true; break; } } // Update tiles and check for misses for (var i = tiles.length - 1; i >= 0; i--) { var tile = tiles[i]; // Check if tile passed the scoring zone without being hit if (!tile.scored && !tile.missed && tile.y > columns[tile.columnIndex].scoreZoneY + goodZone) { tile.missed = true; LK.effects.flashObject(tile, 0xff0000, 300); LK.getSound('miss').play(); } // Remove tiles that are off screen if (tile.y > 2732 + 100) { tile.destroy(); tiles.splice(i, 1); } } };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Column = Container.expand(function () {
var self = Container.call(this);
var columnGraphics = self.attachAsset('column', {
anchorX: 0.5,
anchorY: 0,
alpha: 0.3
});
var scoreZone = self.attachAsset('scoreZone', {
anchorX: 0.5,
anchorY: 0.5,
y: 2732 - 200,
alpha: 0.4
});
self.scoreZoneY = 2732 - 200;
return self;
});
var Tile = Container.expand(function () {
var self = Container.call(this);
var tileGraphics = self.attachAsset('tile', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.columnIndex = 0;
self.scored = false;
self.missed = false;
self.update = function () {
self.y += self.speed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a2e
});
/****
* Game Code
****/
var columns = [];
var tiles = [];
var score = 0;
var gameStarted = false;
var musicDuration = 22000; // 22 seconds
var gameStartTime = 0;
var perfectZone = 50;
var goodZone = 100;
var pianoTones = ['noteA3', 'noteC4', 'noteE4', 'noteG4'];
// Create UI
var scoreTxt = new Text2('Score: 0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create columns
var columnWidth = 2048 / 4;
for (var i = 0; i < 4; i++) {
var column = new Column();
column.x = i * columnWidth + columnWidth / 2;
column.y = 0;
columns.push(column);
game.addChild(column);
}
// Multiple predefined melody patterns for variety
var melodyPatterns = [[1, 1, 2, 2, 3, 3, 2, 2, 1],
// Pattern A: C4, C4, E4, E4, G4, G4, E4, E4, C4
[3, 2, 1, 1, 0, 0, 1, 2],
// Pattern B: G4, E4, C4, C4, A3, A3, C4, E4
[0, 2, 1, 3, 0, 2, 1, 3],
// Pattern C: A3, E4, C4, G4, A3, E4, C4, G4
[3, 1, 3, 1, 2, 2, 0, 0] // Pattern D: G4, C4, G4, C4, E4, E4, A3, A3
];
var currentPatternIndex = 0;
var melodyPattern = melodyPatterns[currentPatternIndex];
var spawnPattern = [];
var beatInterval = 500; // 500ms per beat for steady rhythm
var patternRepeatDuration = melodyPattern.length * beatInterval; // 9 beats = 4500ms per pattern
// Generate spawn pattern by repeating the melody pattern throughout the game duration
var currentTime = 500; // Start after 500ms
var patternPosition = 0;
while (currentTime < musicDuration) {
spawnPattern.push({
time: currentTime,
columns: [melodyPattern[patternPosition]]
});
currentTime += beatInterval;
patternPosition = (patternPosition + 1) % melodyPattern.length;
}
var patternIndex = 0;
function spawnTile(columnIndex) {
var tile = new Tile();
tile.columnIndex = columnIndex;
tile.x = columns[columnIndex].x;
tile.y = -60;
tiles.push(tile);
game.addChild(tile);
}
function calculateScore(distance) {
if (distance <= perfectZone) {
return 100;
} else if (distance <= goodZone) {
return 50;
}
return 0;
}
function updateScore(points) {
score += points;
scoreTxt.setText('Score: ' + score);
}
game.down = function (x, y, obj) {
if (!gameStarted) {
gameStarted = true;
gameStartTime = LK.ticks * (1000 / 60);
LK.playMusic('gamesound3_backing', {
loop: true
});
return;
}
// Determine which column was tapped
var columnIndex = Math.floor(x / columnWidth);
if (columnIndex < 0) columnIndex = 0;
if (columnIndex > 3) columnIndex = 3;
var hitTile = null;
var bestDistance = Infinity;
// Find the closest tile in the tapped column within scoring range
for (var i = 0; i < tiles.length; i++) {
var tile = tiles[i];
if (tile.columnIndex === columnIndex && !tile.scored && !tile.missed) {
var scoreZoneY = columns[columnIndex].scoreZoneY;
var distance = Math.abs(tile.y - scoreZoneY);
if (distance <= goodZone && distance < bestDistance) {
bestDistance = distance;
hitTile = tile;
}
}
}
if (hitTile) {
hitTile.scored = true;
var points = calculateScore(bestDistance);
updateScore(points);
// Visual feedback
if (points === 100) {
LK.effects.flashObject(hitTile, 0x00ff00, 200);
} else if (points === 50) {
LK.effects.flashObject(hitTile, 0xffff00, 200);
}
LK.getSound(pianoTones[columnIndex]).play();
// Remove tile
hitTile.destroy();
for (var j = tiles.length - 1; j >= 0; j--) {
if (tiles[j] === hitTile) {
tiles.splice(j, 1);
break;
}
}
}
};
game.update = function () {
if (!gameStarted) {
return;
}
var currentTime = LK.ticks * (1000 / 60) - gameStartTime;
// Spawn tiles according to endless repeating pattern with pattern cycling and controlled randomness
var patternTime = currentTime % patternRepeatDuration; // Loop the pattern timing
var shouldSpawn = false;
// Check if we need to switch to the next pattern
var patternCycleTime = Math.floor(currentTime / patternRepeatDuration);
var newPatternIndex = patternCycleTime % melodyPatterns.length;
if (newPatternIndex !== currentPatternIndex) {
currentPatternIndex = newPatternIndex;
melodyPattern = melodyPatterns[currentPatternIndex];
}
for (var p = 0; p < melodyPattern.length; p++) {
var spawnTime = p * beatInterval + 500; // Add initial 500ms offset
if (Math.abs(patternTime - spawnTime) < 16) {
// 16ms tolerance for 60fps
var targetColumn = melodyPattern[p];
var finalColumn = targetColumn;
// Add controlled randomness - 20% chance to vary the column
if (Math.random() < 0.2) {
// Define harmonic variations for each base column
var harmonicVariations = [[0, 1],
// A3 can vary to C4
[1, 2],
// C4 can vary to E4
[2, 3, 1],
// E4 can vary to G4 or back to C4
[3, 2] // G4 can vary to E4
];
var variations = harmonicVariations[targetColumn];
if (variations && variations.length > 0) {
finalColumn = variations[Math.floor(Math.random() * variations.length)];
}
}
spawnTile(finalColumn);
shouldSpawn = true;
break;
}
}
// Update tiles and check for misses
for (var i = tiles.length - 1; i >= 0; i--) {
var tile = tiles[i];
// Check if tile passed the scoring zone without being hit
if (!tile.scored && !tile.missed && tile.y > columns[tile.columnIndex].scoreZoneY + goodZone) {
tile.missed = true;
LK.effects.flashObject(tile, 0xff0000, 300);
LK.getSound('miss').play();
}
// Remove tiles that are off screen
if (tile.y > 2732 + 100) {
tile.destroy();
tiles.splice(i, 1);
}
}
};