User prompt
Fanfare sounds if the Final score is 20 points or more.
User prompt
Every time you hit rice_short 5 times, the basket gets a little bigger.
User prompt
Every time you hit rice_short three times, the basket gets a little bigger.
User prompt
Play this sound when the game is over https://beta.frvr.ai/sound/666c714610c85596d3f2792e
User prompt
basket gets a little bigger every time it hits rice_short
User prompt
Play this sound at the end of the game https://beta.frvr.ai/sound/666c714610c85596d3f2792e
User prompt
Play this sound when "Game Over" is displayed https://beta.frvr.ai/sound/666c714610c85596d3f2792e
User prompt
Play this sound when game over. https://beta.frvr.ai/sound/666c714610c85596d3f2792e
User prompt
Enlarge the letters and numbers in the Final score.
User prompt
This sound is played when rice_short hits the basket. https://beta.frvr.ai/sound/666c714610c85596d3f2792e
User prompt
This sound is played when rice_short hits the basket. https://beta.frvr.ai/sound/666c70ce10c85596d3f27926
User prompt
This sound is played when rice_short hits the basket. https://beta.frvr.ai/sound/666c704110c85596d3f2791c
User prompt
This sound is played when rice_short hits the basket. https://beta.frvr.ai/sound/666c6fb510c85596d3f27917
User prompt
This sound is played when rice_short hits the basket. https://beta.frvr.ai/sound/666c6f2810c85596d3f27910
User prompt
This sound is played when rice_short hits the basket. https://beta.frvr.ai/sound/666c6ca310c85596d3f278da
User prompt
This sound is played when rice_long or rice_medium hits the basket. https://beta.frvr.ai/sound/666c64c910c85596d3f27831
User prompt
This sound is played when rice_short hits the basket. https://beta.frvr.ai/sound/666c65b610c85596d3f2784c
User prompt
This sound is played when rice_long or rice_medium hits the basket. https://beta.frvr.ai/sound/666c64c910c85596d3f27833
User prompt
This sound is played when rice_short hits the basket. https://beta.frvr.ai/sound/666c65b610c85596d3f2784c
User prompt
This sound is played when rice_long or rice_medium hits the basket. https://beta.frvr.ai/sound/666c64c910c85596d3f27833
User prompt
Add background image
User prompt
Add background image
User prompt
Add background image
User prompt
Add background image
User prompt
Add background image of the universe
/**** * 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({ backgroundImage: 'universe' }); /**** * 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(); } } };
/****
* 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({
backgroundImage: 'universe'
});
/****
* 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();
}
}
};