User prompt
Make a sound when the green box spawns
User prompt
The third red toy should have a rolling animation while falling ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the game get faster more slowly
User prompt
When the green box is not spawned the boxes should have some distance between them ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
When the green box is not spawned, the boxes should be at the center. The green box spawning should have a fade in animation using opacity. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
The green box should spawn at the right of all the boxes and the boxes should move left ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the exclamation mark also appear at 60 seconds and at 60 seconds a green box spawns and 3 types of green toys start spawning ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
The exclamation mark should be a new asset
User prompt
Five seconds before the brown toys spawn, a warning sound should play and an exclamation mark should pop out at the screen for 2 seconds ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
When speed reaches max, a new music should start playing and when santa appears, all music should stop playing
User prompt
Make everything stop when santa appears
User prompt
Make the milestone sound play at 1000 score
User prompt
When toys that are not brown fall out the screen they should disappear and give you 1 wrong and -15 points
User prompt
Add different types of red, yellow, blue and brown toys which do the same as their first version but look different
User prompt
Brown toys should be not that common
User prompt
Brown toys still give penalty when they fall off, they should not!
User prompt
The brown toys are distractions, they should give penalty when you put them in boxes. But they give penalty when you ignore them (let them fall off the screen)!
User prompt
The brown toys are distractions, you should ignore them. But when you ignore them, you get removed points!
User prompt
Make a sound at reaching 200 score called “scoreMilestone”
User prompt
Make multiple toys not grabbable at once
User prompt
The sounds and music don’t play only after a while
User prompt
Make the boxes 2x bigger and toys 1.75x bigger ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Use the new “background” asset i made
User prompt
Make a background asset which is below all assets
User prompt
Make the toys go 5% faster every 2 secs (max: 300%) ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Box = Container.expand(function (color) { var self = Container.call(this); self.color = color; var assetName = color + 'Box'; var boxGraphics = self.attachAsset(assetName, { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Toy = Container.expand(function (color) { var self = Container.call(this); self.color = color; self.speed = 3; self.isDragging = false; self.startX = 0; self.startY = 0; // Randomly select a toy variant (1, 2, or 3) var variant = Math.floor(Math.random() * 3) + 1; var assetName = color + 'Toy' + (variant === 1 ? '' : variant); var toyGraphics = self.attachAsset(assetName, { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { if (!self.isDragging && !gameOver) { self.y += self.speed; } }; self.down = function (x, y, obj) { if (!draggedToy && !gameOver) { self.isDragging = true; self.startX = self.x; self.startY = self.y; draggedToy = self; } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x006600 }); /**** * Game Code ****/ // Create background var background = LK.getAsset('background', { anchorX: 0, anchorY: 0, scaleX: 20.48, scaleY: 27.32 }); background.x = 0; background.y = 0; game.addChild(background); // Game variables var toys = []; var boxes = []; var draggedToy = null; var wrong = 0; var spawnTimer = 0; var spawnDelay = 90; var gameSpeed = 1; var speedIncreaseTimer = 0; var gameTimer = 0; var gameOver = false; var scoreMilestonePlayed = false; var fastMusicPlaying = false; var warningPlayed = false; // Create boxes at bottom of screen var boxColors = ['red', 'yellow', 'blue']; var boxPositions = [2048 / 5, 2 * 2048 / 5, 3 * 2048 / 5]; var greenBoxSpawned = false; for (var i = 0; i < boxColors.length; i++) { var box = new Box(boxColors[i]); box.x = boxPositions[i]; box.y = 2732 - 200; boxes.push(box); game.addChild(box); } // UI Elements var scoreTxt = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var healthTxt = new Text2('Wrong: 0/3', { size: 80, fill: 0xFF0000 }); healthTxt.anchor.set(0, 0); healthTxt.x = 150; healthTxt.y = 20; LK.gui.topLeft.addChild(healthTxt); // Spawn toy function function spawnToy() { if (gameOver) return; var availableColors = boxColors.slice(); // Add brown toys after 25 seconds (1500 ticks at 60fps) but less frequently if (gameTimer >= 1500 && Math.random() < 0.3) { availableColors.push('brown'); } // Add green toys after 60 seconds (3600 ticks at 60fps) if (gameTimer >= 3600) { availableColors.push('green'); } var randomColor = availableColors[Math.floor(Math.random() * availableColors.length)]; var toy = new Toy(randomColor); toy.x = Math.random() * (2048 - 240) + 120; toy.y = -60; toy.speed = 3 * gameSpeed; toys.push(toy); game.addChild(toy); } // Check if toy intersects with any box function checkToyBoxIntersection(toy) { for (var i = 0; i < boxes.length; i++) { if (toy.intersects(boxes[i])) { return boxes[i]; } } return null; } // Remove toy from game function removeToy(toy, index) { toy.destroy(); toys.splice(index, 1); } // Game input handlers game.move = function (x, y, obj) { if (draggedToy && !gameOver) { draggedToy.x = x; draggedToy.y = y; } }; game.up = function (x, y, obj) { if (draggedToy && !gameOver) { var intersectingBox = checkToyBoxIntersection(draggedToy); if (intersectingBox) { if (draggedToy.color === intersectingBox.color) { // Correct placement LK.setScore(LK.getScore() + 5); scoreTxt.setText('Score: ' + LK.getScore()); LK.getSound('correct').play(); // Remove toy var toyIndex = toys.indexOf(draggedToy); if (toyIndex !== -1) { removeToy(draggedToy, toyIndex); } } else { // Wrong placement (including brown toys in any box) var newScore = Math.max(0, LK.getScore() - 15); LK.setScore(newScore); scoreTxt.setText('Score: ' + LK.getScore()); wrong++; healthTxt.setText('Wrong: ' + wrong + '/3'); LK.getSound('wrong').play(); LK.effects.flashScreen(0xff0000, 500); // Remove brown toys when placed in any box, return others to position if (draggedToy.color === 'brown') { var toyIndex = toys.indexOf(draggedToy); if (toyIndex !== -1) { removeToy(draggedToy, toyIndex); } } else { // Return toy to original position draggedToy.x = draggedToy.startX; draggedToy.y = draggedToy.startY; } } } else { // Return toy to original position if not dropped on box draggedToy.x = draggedToy.startX; draggedToy.y = draggedToy.startY; } draggedToy.isDragging = false; draggedToy = null; } }; // Main game update game.update = function () { if (gameOver) return; // Update game timer gameTimer++; // Spawn toys spawnTimer++; if (spawnTimer >= spawnDelay) { spawnToy(); spawnTimer = 0; } // Increase game speed over time speedIncreaseTimer++; if (speedIncreaseTimer >= 120) { // Every 2 seconds at 60fps gameSpeed *= 1.05; // Increase by 5% if (gameSpeed > 3.0) { gameSpeed = 3.0; // Cap at 300% (3x original speed) } if (spawnDelay > 30) { spawnDelay -= 2; } speedIncreaseTimer = 0; } // Start fast music when speed reaches maximum if (gameSpeed >= 3.0 && !fastMusicPlaying) { LK.playMusic('fastMusic'); fastMusicPlaying = true; } // Update toys and check for collisions/missed toys for (var i = toys.length - 1; i >= 0; i--) { var toy = toys[i]; // Check if toy fell off screen if (toy.y > 2732 + 60) { // Brown toys don't give penalty when falling off screen - just remove them if (toy.color !== 'brown') { // Non-brown toys give penalty when falling off screen var newScore = Math.max(0, LK.getScore() - 15); LK.setScore(newScore); scoreTxt.setText('Score: ' + LK.getScore()); wrong++; healthTxt.setText('Wrong: ' + wrong + '/3'); LK.getSound('wrong').play(); LK.effects.flashScreen(0xff0000, 500); } removeToy(toy, i); continue; } // Check if toy is intersecting with correct box while not being dragged if (!toy.isDragging) { var intersectingBox = checkToyBoxIntersection(toy); if (intersectingBox) { if (toy.color === intersectingBox.color) { LK.setScore(LK.getScore() + 5); scoreTxt.setText('Score: ' + LK.getScore()); LK.getSound('correct').play(); removeToy(toy, i); continue; } } } } // Check game over condition if (wrong >= 3 && !gameOver) { gameOver = true; // Stop all music when santa appears LK.stopMusic(); // Show santa for 1 second before game over var santa = LK.getAsset('santa', { anchorX: 0.5, anchorY: 0.5 }); santa.x = 2048 / 2; santa.y = 2732 / 2; game.addChild(santa); // Play santa sound LK.getSound('santa').play(); // Calculate scale to make santa almost fill the screen // Leave some padding around the edges (90% of screen size) var targetScaleX = 2048 * 0.9 / santa.width; var targetScaleY = 2732 * 0.9 / santa.height; // Use the smaller scale to maintain aspect ratio and fit within screen var targetScale = Math.min(targetScaleX, targetScaleY); // Animate santa appearing with scale tween santa.scaleX = 0; santa.scaleY = 0; tween(santa, { scaleX: targetScale, scaleY: targetScale }, { duration: 500, easing: tween.bounceOut, onFinish: function onFinish() { // Wait 1500ms more then show game over (total 2 seconds) LK.setTimeout(function () { LK.showGameOver(); }, 1500); } }); } // Play warning 5 seconds before brown toys spawn (at 20 seconds / 1200 ticks) if (gameTimer >= 1200 && !warningPlayed) { LK.getSound('warning').play(); warningPlayed = true; // Create exclamation mark var exclamation = LK.getAsset('exclamation', { anchorX: 0.5, anchorY: 0.5 }); exclamation.x = 2048 / 2; exclamation.y = 2732 / 2; exclamation.scaleX = 0; exclamation.scaleY = 0; game.addChild(exclamation); // Animate exclamation mark appearing tween(exclamation, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.bounceOut, onFinish: function onFinish() { // Keep exclamation visible for 2 seconds then fade out LK.setTimeout(function () { tween(exclamation, { alpha: 0, scaleX: 0, scaleY: 0 }, { duration: 300, easing: tween.easeIn, onFinish: function onFinish() { exclamation.destroy(); } }); }, 2000); } }); } // Play warning at 60 seconds (3600 ticks) and spawn green box if (gameTimer >= 3600 && !greenBoxSpawned) { LK.getSound('warning').play(); greenBoxSpawned = true; // Move existing boxes to the left with tween animation for (var b = 0; b < boxes.length; b++) { var targetX = (b + 1) * 2048 / 5; tween(boxes[b], { x: targetX }, { duration: 1000, easing: tween.easeInOut }); } // Create green box at the right var greenBox = new Box('green'); greenBox.x = 4 * 2048 / 5; greenBox.y = 2732 - 200; boxes.push(greenBox); boxColors.push('green'); game.addChild(greenBox); // Create exclamation mark var exclamation = LK.getAsset('exclamation', { anchorX: 0.5, anchorY: 0.5 }); exclamation.x = 2048 / 2; exclamation.y = 2732 / 2; exclamation.scaleX = 0; exclamation.scaleY = 0; game.addChild(exclamation); // Animate exclamation mark appearing tween(exclamation, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.bounceOut, onFinish: function onFinish() { // Keep exclamation visible for 2 seconds then fade out LK.setTimeout(function () { tween(exclamation, { alpha: 0, scaleX: 0, scaleY: 0 }, { duration: 300, easing: tween.easeIn, onFinish: function onFinish() { exclamation.destroy(); } }); }, 2000); } }); } // Play sound effect when reaching a score of 1000 if (LK.getScore() >= 1000 && !scoreMilestonePlayed) { LK.getSound('scoreMilestone').play(); scoreMilestonePlayed = true; } // Check win condition (optional - high score) if (LK.getScore() >= 500) { LK.showYouWin(); } }; // Start background music immediately at game start LK.playMusic('christmas'); // Ensure sounds are preloaded and ready to play LK.getSound('correct').play(); LK.getSound('wrong').play(); LK.getSound('santa').play();
===================================================================
--- original.js
+++ change.js
@@ -81,9 +81,9 @@
var fastMusicPlaying = false;
var warningPlayed = false;
// Create boxes at bottom of screen
var boxColors = ['red', 'yellow', 'blue'];
-var boxPositions = [2048 / 4, 2048 / 2, 3 * 2048 / 4];
+var boxPositions = [2048 / 5, 2 * 2048 / 5, 3 * 2048 / 5];
var greenBoxSpawned = false;
for (var i = 0; i < boxColors.length; i++) {
var box = new Box(boxColors[i]);
box.x = boxPositions[i];
@@ -333,12 +333,22 @@
// Play warning at 60 seconds (3600 ticks) and spawn green box
if (gameTimer >= 3600 && !greenBoxSpawned) {
LK.getSound('warning').play();
greenBoxSpawned = true;
- // Create green box
+ // Move existing boxes to the left with tween animation
+ for (var b = 0; b < boxes.length; b++) {
+ var targetX = (b + 1) * 2048 / 5;
+ tween(boxes[b], {
+ x: targetX
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut
+ });
+ }
+ // Create green box at the right
var greenBox = new Box('green');
- greenBox.x = 2048 / 2;
- greenBox.y = 2732 - 400;
+ greenBox.x = 4 * 2048 / 5;
+ greenBox.y = 2732 - 200;
boxes.push(greenBox);
boxColors.push('green');
game.addChild(greenBox);
// Create exclamation mark
Santa angry In-Game asset. 2d. High contrast. No shadows
Brown rocking horse. In-Game asset. 2d. High contrast. No shadows
Brown kids book. In-Game asset. 2d. High contrast. No shadows
A blue robot toy. In-Game asset. 2d. High contrast. No shadows
A yellow box. In-Game asset. 2d. High contrast. No shadows
Yellow star plushie with a smile on it. In-Game asset. 2d. High contrast. No shadows
A red toy car. In-Game asset. 2d. High contrast. No shadows
A yellow banana. In-Game asset. 2d. High contrast. No shadows
Red ball with two white eyes, inside the eyes are medium sized black dots, and a black smiley mouth. In-Game asset. 2d. High contrast. No shadows
Blue diamond toy. In-Game asset. 2d. High contrast
Red exclamation mark with a gradient and a stroke. In-Game asset. 2d. High contrast. No shadows
Green box. In-Game asset. 2d. High contrast. No shadows
Red clock. In-Game asset. 2d. High contrast. No shadows
A green puzzle piece. In-Game asset. 2d. High contrast. No shadows
Green dino plushie. In-Game asset. 2d. High contrast. No shadows
Green apple. In-Game asset. 2d. High contrast. No shadows