User prompt
This sound is played when rice_short hits the basket. "High chords with large correct notes" in rice_hit_short
User prompt
Display the word "SAME SHAPE & SIZE ONLY" in the center of the screen.
User prompt
Move the position of the basket at the start of the game up a little
User prompt
Move the position of the basket at the start of the game up a little
User prompt
Move the position of the basket at the start of the game up a little
User prompt
Move the position of the basket at the start of the game up a little
User prompt
Move the position of the basket at the start of the game up a little
User prompt
Display the small word "SAME SHAPE & SIZE ONLY" in the center of the screen before the game starts.
User prompt
Change the title of this game to "SAVE YOUR FELLOW RICE".
User prompt
This sound is played when rice_short hits the basket. "High chords with large correct notes" in rice_hit_short
User prompt
This sound is played when rice_short hits the basket. "High chords with large correct notes" in rice_hit_short
User prompt
This sound is played when rice_long or rice_medium hits the basket. "Explosion sound of meteorite impact" in game_over_sound
User prompt
This sound is played when rice_long or rice_medium hits the basket. "Explosion sound of meteorite impact" in game_over_sound
User prompt
This sound is played when rice_long or rice_medium hits the basket. "Explosion sound of meteorite impact" in game_over_sound
User prompt
This sound is played when rice_short hits the basket. "High chords with large correct notes" in rice_hit_short
User prompt
Play this sound 12 times repeatedly during game play: "Ambient music at 120 BPM" in gameplay_sound
User prompt
Play this sound 12 times repeatedly during game play: "Ambient music at 120 BPM" in gameplay_sound
User prompt
Play this sound 12 times repeatedly during game play: "Ambient music at 120 BPM" in gameplay_sound
User prompt
When the time limit is less than 5 seconds remaining, the amount of falling rice increases further.
User prompt
When the time limit is less than 10 seconds remaining, the amount of falling rice increases further.
User prompt
Add background image
User prompt
Play this sound 12 times repeatedly during game play: "Ambient music at 120 BPM" in gameplay_sound
User prompt
Play this sound 12 times repeatedly during game play: "Ambient music at 120 BPM" in gameplay_sound
User prompt
Play this sound 12 times repeatedly during game play: "Ambient music at 120 BPM" in gameplay_sound
User prompt
Move the position of the basket at the start of the game up a little
/**** * 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 title: "SAVE YOUR FELLOW RICE" }); /**** * Game Code ****/ // Add background image var background = game.attachAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); // 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); // Display the word 'SAME SHAPE & SIZE ONLY' in the center of the screen var gameInstruction = new Text2('SAME SHAPE & SIZE ONLY', { size: 100, fill: "#ffffff" }); gameInstruction.anchor.set(0.5, 0.5); gameInstruction.x = 2048 / 2; gameInstruction.y = 2732 / 2; game.addChild(gameInstruction); // Initialize basket basket = game.addChild(new Basket()); basket.x = 2048 / 2; basket.y = 2200; // 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 () { // Play the gameplay_sound 12 times repeatedly during game play if (LK.ticks % (60 * 5) == 0) { // 60 ticks per second * 5 seconds = 300 ticks var gameplaySound = LK.getSound('gameplay_sound'); for (var i = 0; i < 12; i++) { gameplaySound.play(); } } for (var i = rices.length - 1; i >= 0; i--) { if (rices[i].intersects(basket)) { switch (rices[i].type) { case 'long': score -= 2; LK.getSound('game_over_sound').play(); break; case 'medium': score -= 1; LK.getSound('game_over_sound').play(); break; case 'short': score += 1; LK.getSound('rice_hit_short').play(); LK.getSound('rice_hit_short').play(); break; } scoreTxt.setText(score); rices[i].destroy(); rices.splice(i, 1); } } if (timer > 15 * 60) { if (LK.ticks % 60 == 0) { spawnRice(); } } else if (timer > 10 * 60) { if (LK.ticks % 30 == 0) { spawnRice(); } } else if (timer > 5 * 60) { if (LK.ticks % 15 == 0) { spawnRice(); } } else { if (LK.ticks % 10 == 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
@@ -120,8 +120,9 @@
break;
case 'short':
score += 1;
LK.getSound('rice_hit_short').play();
+ LK.getSound('rice_hit_short').play();
break;
}
scoreTxt.setText(score);
rices[i].destroy();