User prompt
Play this sound 12 times repeatedly during game play: https://beta.frvr.ai/sound/666c598410c85596d3f27647
User prompt
Play this sound 12 times repeatedly during game play: https://beta.frvr.ai/sound/666c55b210c85596d3f275fd
User prompt
Play this sound 12 times repeatedly during game play: https://beta.frvr.ai/sound/666c55b210c85596d3f275fd
User prompt
Play this sound 12 times repeatedly: https://beta.frvr.ai/sound/666c55b210c85596d3f275fd
User prompt
This sound will continue to play repeatedly during gameplay. https://beta.frvr.ai/sound/666c55b210c85596d3f275fd
User prompt
Keep playing this sound over and over until the game is over!
User prompt
This sound will continue to play on a loop during game play. https://beta.frvr.ai/sound/666c55b210c85596d3f275fd
User prompt
Please play the "BGM" sound on a loop while playing.
User prompt
When the time limit is less than 30 seconds, the countdown number turns yellow.
User prompt
When the countdown number of the time limit falls below 30, it turns yellow.
User prompt
Turn the time limit countdown number yellow.
User prompt
Make the font color of Final Score red.
User prompt
Increase the font size in Final Score
User prompt
Please fix the bug: 'TypeError: LK.showLeaderboard is not a function' in or related to this line: 'LK.showLeaderboard(score);' Line Number: 133
User prompt
Display a leaderboard at the end of the game showing points earned.
User prompt
Just before game over, the points earned up to that point should be displayed in the center of the screen.
User prompt
Add a background of many grains of rice arranged vertically
User prompt
Add a background image.
User prompt
Display the points earned at game over in a large size in the center of the screen.
User prompt
When the time limit is less than 30 seconds remaining, the text of the countdown number changes to yellow.
User prompt
When the time limit is less than 30 seconds remaining, the countdown number changes to yellow.
User prompt
When the time limit is less than 15 seconds remaining, the amount of falling rice increases slightly.
User prompt
When the time limit is less than 30 seconds remaining, the speed of the falling rice will increase slightly.
User prompt
When the time limit is less than 30 seconds remaining, the speed of falling rice is increased by 1.5 times.
User prompt
When the game is over, the points earned up to that point should be displayed in a large central area.
/**** * Classes ****/ // Class for Basket var Basket = Container.expand(function () { var self = Container.call(this); var basketGraphics = self.attachAsset('basket', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Basket update logic if needed }; }); //<Assets used in the game will automatically appear here> // Class for Rice var Rice = Container.expand(function (type) { var self = Container.call(this); var assetId = 'rice_' + type; var riceGraphics = self.attachAsset(assetId, { anchorX: 0.5, anchorY: 0.5 }); self.type = type; self.speed = 5; self.update = function () { self.y += self.speed; if (self.y > 2732) { self.destroy(); } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize arrays and variables var rices = []; var basket; var score = 0; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Initialize basket basket = game.addChild(new Basket()); basket.x = 2048 / 2; basket.y = 2500; // Function to handle move events function handleMove(x, y, obj) { basket.x = x; } // Mouse or touch move on game object game.move = handleMove; // Function to spawn rice function spawnRice() { var types = ['short', 'medium', 'long']; var type = types[Math.floor(Math.random() * types.length)]; var newRice = new Rice(type); newRice.x = Math.random() * 2048; newRice.y = -50; rices.push(newRice); game.addChild(newRice); } // Initialize timer var timer = 60 * 60; // 60 seconds * 60 frames per second var timerTxt = new Text2('60', { size: 200, fill: "#ffffff" }); timerTxt.anchor.set(1, 0); LK.gui.topRight.addChild(timerTxt); // Update function game.update = function () { LK.getSound('gameplay_sound').play(); for (var i = rices.length - 1; i >= 0; i--) { if (rices[i].intersects(basket)) { switch (rices[i].type) { case 'long': score -= 2; break; case 'medium': score -= 1; break; case 'short': score += 1; break; } scoreTxt.setText(score); rices[i].destroy(); rices.splice(i, 1); } } if (timer > 15 * 60) { if (LK.ticks % 60 == 0) { spawnRice(); } } else { if (LK.ticks % 30 == 0) { spawnRice(); } } // Update timer if (timer > 0) { timer--; timerTxt.setText(Math.floor(timer / 60)); // Increase the speed of the falling rice when the timer is less than 30 seconds if (timer < 30 * 60) { for (var i = 0; i < rices.length; i++) { rices[i].speed += 0.1; } } } else { // End game when timer reaches 0 if (timer == 0) { LK.setScore(score); LK.showGameOver(); } } };
===================================================================
--- original.js
+++ change.js
@@ -80,14 +80,9 @@
timerTxt.anchor.set(1, 0);
LK.gui.topRight.addChild(timerTxt);
// Update function
game.update = function () {
- if (LK.ticks % (60 * 5) == 0) {
- // every 5 seconds
- for (var i = 0; i < 12; i++) {
- LK.getSound('gameplay_sound').play();
- }
- }
+ LK.getSound('gameplay_sound').play();
for (var i = rices.length - 1; i >= 0; i--) {
if (rices[i].intersects(basket)) {
switch (rices[i].type) {
case 'long':