User prompt
write “Glaud” in small orange letters at the top right of the screen.
User prompt
add sound for each action and add 3 background music to the game so that the color of the background changes according to the music. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
write $30 on the yellow dollars
Remix started
Copy Money Rain Collector
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Dollar = Container.expand(function (isSpecial) { var self = Container.call(this); var assetId = isSpecial ? 'specialDollar' : 'dollar'; var dollarGraphics = self.attachAsset(assetId, { anchorX: 0.5, anchorY: 0.5 }); // Create a text on the bill showing the dollar value var valueText = new Text2(isSpecial ? '$30' : '$10', { size: 40, fill: isSpecial ? "#5D4037" : "#FFFFFF" }); valueText.anchor.set(0.5, 0.5); self.addChild(valueText); self.isSpecial = isSpecial || false; self.speed = Math.random() * 7 + 6; // Random speed between 6-13 self.value = isSpecial ? 30 : 10; self.update = function () { self.y += self.speed; }; return self; }); var MoneyBag = Container.expand(function () { var self = Container.call(this); var bagGraphics = self.attachAsset('moneyBag', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); // Create a dollar sign on the bag var dollarSign = new Text2('$', { size: 80, fill: 0xFFD700 }); dollarSign.anchor.set(0.5, 0.5); self.addChild(dollarSign); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xd7ccc8 }); /**** * Game Code ****/ // Game variables var moneyBag; var dollars = []; var score = 0; var gameStarted = false; var dragNode = null; var gameSpeed = 1; var spawnRate = 100; // Lower numbers spawn more frequently var specialChance = 0.15; // 15% chance for special dollars var currentMusicIndex = 0; var bgColors = [0xd7ccc8, 0xb3e5fc, 0xc8e6c9]; // Colors for each music track var musicTracks = ['gameMusic1', 'gameMusic2', 'gameMusic3']; var musicChangeTimer = null; // Create score text var scoreTxt = new Text2('Score: 0', { size: 80, fill: 0x5D4037 }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Create speed indicator var speedTxt = new Text2('Speed: 1x', { size: 60, fill: 0x5D4037 }); speedTxt.anchor.set(1, 0); speedTxt.x = -50; // Offset from right edge LK.gui.topRight.addChild(speedTxt); // Add Glaud text in small orange letters to the top right var glaudTxt = new Text2('Glaud', { size: 30, fill: 0xFF8C00 // Orange color }); glaudTxt.anchor.set(1, 0); glaudTxt.x = -50; // Offset from right edge glaudTxt.y = 70; // Position below speed text LK.gui.topRight.addChild(glaudTxt); // Create game title var titleTxt = new Text2('Money Rain Collector', { size: 100, fill: 0x5D4037 }); titleTxt.anchor.set(0.5, 0.5); LK.gui.center.addChild(titleTxt); // Create start instruction var instructionTxt = new Text2('Tap to Start', { size: 80, fill: 0x43A047 }); instructionTxt.anchor.set(0.5, 0.5); instructionTxt.y = 150; LK.gui.center.addChild(instructionTxt); // Create money bag function createMoneyBag() { moneyBag = new MoneyBag(); moneyBag.x = 2048 / 2; moneyBag.y = 2732 - 150; game.addChild(moneyBag); } // Create a new dollar bill function createDollar() { var isSpecial = Math.random() < specialChance; var dollar = new Dollar(isSpecial); dollar.x = Math.random() * (2048 - 100) + 50; // Random position with margins dollar.y = -dollar.height; dollars.push(dollar); game.addChild(dollar); } // Change music and background color function changeMusic() { currentMusicIndex = (currentMusicIndex + 1) % musicTracks.length; LK.playMusic(musicTracks[currentMusicIndex], { fade: { start: 0, end: 0.8, duration: 1000 } }); // Change background color with a smooth tween tween(game, { backgroundColor: bgColors[currentMusicIndex] }, { duration: 1000, easing: tween.easeInOut }); } // Start the game function startGame() { if (gameStarted) { return; } gameStarted = true; // Play game start sound LK.getSound('gameStart').play(); // Remove title and instruction tween(titleTxt, { alpha: 0 }, { duration: 500 }); tween(instructionTxt, { alpha: 0 }, { duration: 500 }); // Create money bag createMoneyBag(); // Reset game variables score = 0; gameSpeed = 1; spawnRate = 100; currentMusicIndex = 0; scoreTxt.setText('Score: ' + score); speedTxt.setText('Speed: ' + gameSpeed + 'x'); // Start game music LK.playMusic(musicTracks[currentMusicIndex]); // Set up music change timer (change every 30 seconds) musicChangeTimer = LK.setInterval(changeMusic, 30000); } // Handle moving the money bag function handleMove(x, y, obj) { if (!gameStarted) { return; } if (dragNode) { dragNode.x = x; } } // Mouse down event game.down = function (x, y, obj) { if (!gameStarted) { startGame(); return; } dragNode = moneyBag; handleMove(x, y, obj); }; // Mouse up event game.up = function (x, y, obj) { dragNode = null; }; // Mouse move event game.move = handleMove; // Game update function game.update = function () { if (!gameStarted) { return; } // Spawn new dollars based on spawn rate if (LK.ticks % Math.floor(spawnRate / gameSpeed) === 0) { createDollar(); } // Update dollars for (var i = dollars.length - 1; i >= 0; i--) { var dollar = dollars[i]; // Check if dollar is off screen if (dollar.y > 2732 + dollar.height) { // Game over if we miss a special dollar if (dollar.isSpecial) { LK.getSound('missedSpecial').play(); LK.effects.flashScreen(0xff0000, 500); // Flash red for missing special dollar if (musicChangeTimer) { LK.clearInterval(musicChangeTimer); } LK.showGameOver(); } dollar.destroy(); dollars.splice(i, 1); continue; } // Check collision with money bag if (dollar.intersects(moneyBag)) { // Add to score score += dollar.value; scoreTxt.setText('Score: ' + score); // Play collect sound if (dollar.isSpecial) { LK.getSound('specialCollect').play(); // Flash screen green for special dollar LK.effects.flashScreen(0x43a047, 300); } else { LK.getSound('collect').play(); } // Remove dollar dollar.destroy(); dollars.splice(i, 1); // Increase game speed at certain score thresholds if (score % 100 === 0 && gameSpeed < 3) { gameSpeed += 0.2; speedTxt.setText('Speed: ' + gameSpeed.toFixed(1) + 'x'); LK.getSound('speedIncrease').play(); LK.effects.flashObject(speedTxt, 0x43a047, 500); } continue; } } // Check for game over (optional - can be triggered when reaching score threshold) if (score >= 500) { if (musicChangeTimer) { LK.clearInterval(musicChangeTimer); } LK.showYouWin(); } };
===================================================================
--- original.js
+++ change.js
@@ -84,8 +84,17 @@
});
speedTxt.anchor.set(1, 0);
speedTxt.x = -50; // Offset from right edge
LK.gui.topRight.addChild(speedTxt);
+// Add Glaud text in small orange letters to the top right
+var glaudTxt = new Text2('Glaud', {
+ size: 30,
+ fill: 0xFF8C00 // Orange color
+});
+glaudTxt.anchor.set(1, 0);
+glaudTxt.x = -50; // Offset from right edge
+glaudTxt.y = 70; // Position below speed text
+LK.gui.topRight.addChild(glaudTxt);
// Create game title
var titleTxt = new Text2('Money Rain Collector', {
size: 100,
fill: 0x5D4037