User prompt
make these in different colors:100$, 200$, 300$, 400$, 500$, 600$, 700$, 800$, 900$, 1$, 2$, 3$, 4$, 5$, 6$, 7$, 8$, 9$, 10$, 20$, 30$, 40$, 50$, 60$, 70$, 80$, 90$, 11$, 22$, 33$, 44$, 55$, 66$, 77$, 88$, 99$, 110$, 120$, 12$, 24$, 36$, 48$ 72$, 84$, 96$, 104$, 132$, 144$
User prompt
add all f these 100$, 200$, 300$, 400$, 500$, 600$, 700$, 800$, 900$, 1$, 2$, 3$, 4$, 5$, 6$, 7$, 8$, 9$, 10$, 20$, 30$, 40$, 50$, 60$, 70$, 80$, 90$, 11$, 22$, 33$, 44$, 55$, 66$, 77$, 88$, 99$, 110$, 120$, 12$, 24$, 36$, 48$ 72$, 84$, 96$, 104$, 132$, 144$, 156$
User prompt
make so after collect green money the time will continue when game ends
Code edit (1 edits merged)
Please save this source code
User prompt
Money Rain: Cash Collector
Initial prompt
Money is a game where it raining these 💵 of 100$, 200$, 300$, 400$, 500$, 600$, 700$, 800$, 900$, 1$, 2$, 3$, 4$, 5$, 6$, 7$, 8$, 9$, 10$, 20$, 30$, 40$, 50$, 60$, 70$, 80$, 90$, 11$, 22$, 33$, 44$, 55$, 66$, 77$, 88$, 99$, 110$, 120$, 12$, 24$, 36$, 48$ 72$, 84$, 96$, 104$, 132$, 144$, 156$ and collect these to win bunch of money as possible by clicking on them before the 30min timer goes out and if you collect 🟢gives you 1,000$ and collect 12 of them before time runs out.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Bill = Container.expand(function (value) {
var self = Container.call(this);
// Set properties
self.value = value;
self.speed = 2 + Math.random() * 3;
// Determine which asset to use based on value
var assetId;
switch (value) {
case 1:
assetId = 'dollarBill';
break;
case 5:
assetId = 'fiveDollarBill';
break;
case 10:
assetId = 'tenDollarBill';
break;
case 20:
assetId = 'twentyDollarBill';
break;
case 50:
assetId = 'fiftyDollarBill';
break;
case 100:
assetId = 'hundredDollarBill';
break;
default:
assetId = 'dollarBill';
}
// Create bill graphic
var billGraphic = self.attachAsset(assetId, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
// Create value text
self.valueText = new Text2('$' + value, {
size: 30,
fill: 0xFFFFFF
});
self.valueText.anchor.set(0.5, 0.5);
self.addChild(self.valueText);
// Add interaction
self.interactive = true;
self.down = function (x, y, obj) {
if (!self.collected) {
self.collected = true;
totalMoney += self.value;
moneyText.setText('$' + totalMoney);
// Play collect sound
LK.getSound('collect').play();
// Visual feedback
tween(self, {
alpha: 0,
scaleX: 2,
scaleY: 2
}, {
duration: 300,
onFinish: function onFinish() {
self.destroy();
var index = bills.indexOf(self);
if (index !== -1) {
bills.splice(index, 1);
}
}
});
}
};
self.update = function () {
if (!self.collected) {
self.y += self.speed;
// Rotate slightly while falling
self.rotation += 0.01;
// Check if bill has fallen off screen
if (self.y > 2732 + 100) {
self.destroy();
var index = bills.indexOf(self);
if (index !== -1) {
bills.splice(index, 1);
}
}
}
};
return self;
});
var BonusToken = Container.expand(function () {
var self = Container.call(this);
// Set properties
self.value = 1000;
self.speed = 1 + Math.random() * 2;
// Create token graphic
var tokenGraphic = self.attachAsset('bonusToken', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
// Create value text
self.valueText = new Text2('$1000', {
size: 24,
fill: 0xFFFFFF
});
self.valueText.anchor.set(0.5, 0.5);
self.addChild(self.valueText);
// Add interaction
self.interactive = true;
self.down = function (x, y, obj) {
if (!self.collected) {
self.collected = true;
totalMoney += self.value;
moneyText.setText('$' + totalMoney);
tokensCollected++;
tokensText.setText(tokensCollected + '/12 Tokens');
// Play bonus sound
LK.getSound('bonus').play();
// Visual feedback
tween(self, {
alpha: 0,
scaleX: 3,
scaleY: 3
}, {
duration: 500,
onFinish: function onFinish() {
self.destroy();
var index = tokens.indexOf(self);
if (index !== -1) {
tokens.splice(index, 1);
}
}
});
// Flash screen green for token collection
LK.effects.flashScreen(0x32CD32, 300);
}
};
self.update = function () {
if (!self.collected) {
self.y += self.speed;
// Rotate while falling
self.rotation += 0.02;
// Check if token has fallen off screen
if (self.y > 2732 + 100) {
self.destroy();
var index = tokens.indexOf(self);
if (index !== -1) {
tokens.splice(index, 1);
}
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Sky blue background
});
/****
* Game Code
****/
// Game variables
var totalMoney = 0;
var tokensCollected = 0;
var gameTimeInSeconds = 30 * 60; // 30 minutes
var timeLeft = gameTimeInSeconds;
var bills = [];
var tokens = [];
var lastBillSpawn = 0;
var lastTokenSpawn = 0;
var billSpawnRate = 60; // Frames between normal bill spawns
var tokenSpawnRate = 600; // Frames between token spawns
var maxTokens = 12; // Total tokens in the game
var totalTokensSpawned = 0;
// Create UI elements
var moneyText = new Text2('$0', {
size: 80,
fill: 0x228B22 // Dark green
});
moneyText.anchor.set(0.5, 0);
LK.gui.top.addChild(moneyText);
moneyText.y = 20;
var timeText = new Text2('30:00', {
size: 60,
fill: 0xFF0000 // Red
});
timeText.anchor.set(1, 0);
LK.gui.topRight.addChild(timeText);
timeText.x = -20;
timeText.y = 20;
var tokensText = new Text2('0/12 Tokens', {
size: 50,
fill: 0x32CD32 // Lime green
});
tokensText.anchor.set(0, 0);
LK.gui.topLeft.addChild(tokensText);
tokensText.x = 120; // Leave space for platform menu icon
tokensText.y = 20;
// Function to format time as mm:ss
function formatTime(seconds) {
var minutes = Math.floor(seconds / 60);
var secs = seconds % 60;
return minutes + ':' + (secs < 10 ? '0' : '') + secs;
}
// Function to spawn a bill
function spawnBill() {
// Determine bill value
var random = Math.random();
var value;
if (random < 0.4) {
value = 1;
} else if (random < 0.65) {
value = 5;
} else if (random < 0.8) {
value = 10;
} else if (random < 0.9) {
value = 20;
} else if (random < 0.95) {
value = 50;
} else {
value = 100;
}
var bill = new Bill(value);
bill.x = Math.random() * 2048; // Random x position
bill.y = -100; // Start above screen
bills.push(bill);
game.addChild(bill);
}
// Function to spawn a bonus token
function spawnToken() {
if (totalTokensSpawned < maxTokens) {
var token = new BonusToken();
token.x = Math.random() * 2048; // Random x position
token.y = -100; // Start above screen
tokens.push(token);
game.addChild(token);
totalTokensSpawned++;
}
}
// Start background music
LK.playMusic('bgmusic', {
fade: {
start: 0,
end: 0.3,
duration: 1000
}
});
// Game update function
game.update = function () {
// Update time
if (timeLeft > 0) {
if (LK.ticks % 60 === 0) {
// Update every second
timeLeft--;
timeText.setText(formatTime(timeLeft));
// Warning when time is running out
if (timeLeft <= 60) {
// Last minute
timeText.tint = 0xFF0000; // Red
if (timeLeft % 2 === 0) {
tween(timeText, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 500,
easing: tween.easeOut
});
} else {
tween(timeText, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 500,
easing: tween.easeOut
});
}
}
}
} else {
// Game over when time runs out
LK.setScore(totalMoney);
LK.showGameOver();
return;
}
// Spawn bills
if (LK.ticks - lastBillSpawn >= billSpawnRate) {
spawnBill();
lastBillSpawn = LK.ticks;
// Gradually increase spawn rate
if (billSpawnRate > 20) {
billSpawnRate -= 0.05;
}
}
// Spawn tokens
if (totalTokensSpawned < maxTokens && LK.ticks - lastTokenSpawn >= tokenSpawnRate) {
spawnToken();
lastTokenSpawn = LK.ticks;
}
// Update all bills
for (var i = bills.length - 1; i >= 0; i--) {
// Update is automatically called by the engine
}
// Update all tokens
for (var j = tokens.length - 1; j >= 0; j--) {
// Update is automatically called by the engine
}
// Check for win condition (all tokens collected)
if (tokensCollected === maxTokens && tokens.length === 0) {
// Apply bonus for collecting all tokens
totalMoney += 10000; // $10,000 bonus
moneyText.setText('$' + totalMoney);
LK.effects.flashScreen(0xFFD700, 1000); // Gold flash
// Set final score and show win
LK.setScore(totalMoney);
LK.showYouWin();
}
};
// Game touch event handlers
game.down = function (x, y, obj) {
// This is handled by individual bills and tokens
};
game.move = function (x, y, obj) {
// Not needed for this game
};
game.up = function (x, y, obj) {
// Not needed for this game
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,338 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1");
+
+/****
+* Classes
+****/
+var Bill = Container.expand(function (value) {
+ var self = Container.call(this);
+ // Set properties
+ self.value = value;
+ self.speed = 2 + Math.random() * 3;
+ // Determine which asset to use based on value
+ var assetId;
+ switch (value) {
+ case 1:
+ assetId = 'dollarBill';
+ break;
+ case 5:
+ assetId = 'fiveDollarBill';
+ break;
+ case 10:
+ assetId = 'tenDollarBill';
+ break;
+ case 20:
+ assetId = 'twentyDollarBill';
+ break;
+ case 50:
+ assetId = 'fiftyDollarBill';
+ break;
+ case 100:
+ assetId = 'hundredDollarBill';
+ break;
+ default:
+ assetId = 'dollarBill';
+ }
+ // Create bill graphic
+ var billGraphic = self.attachAsset(assetId, {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 1.5,
+ scaleY: 1.5
+ });
+ // Create value text
+ self.valueText = new Text2('$' + value, {
+ size: 30,
+ fill: 0xFFFFFF
+ });
+ self.valueText.anchor.set(0.5, 0.5);
+ self.addChild(self.valueText);
+ // Add interaction
+ self.interactive = true;
+ self.down = function (x, y, obj) {
+ if (!self.collected) {
+ self.collected = true;
+ totalMoney += self.value;
+ moneyText.setText('$' + totalMoney);
+ // Play collect sound
+ LK.getSound('collect').play();
+ // Visual feedback
+ tween(self, {
+ alpha: 0,
+ scaleX: 2,
+ scaleY: 2
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ self.destroy();
+ var index = bills.indexOf(self);
+ if (index !== -1) {
+ bills.splice(index, 1);
+ }
+ }
+ });
+ }
+ };
+ self.update = function () {
+ if (!self.collected) {
+ self.y += self.speed;
+ // Rotate slightly while falling
+ self.rotation += 0.01;
+ // Check if bill has fallen off screen
+ if (self.y > 2732 + 100) {
+ self.destroy();
+ var index = bills.indexOf(self);
+ if (index !== -1) {
+ bills.splice(index, 1);
+ }
+ }
+ }
+ };
+ return self;
+});
+var BonusToken = Container.expand(function () {
+ var self = Container.call(this);
+ // Set properties
+ self.value = 1000;
+ self.speed = 1 + Math.random() * 2;
+ // Create token graphic
+ var tokenGraphic = self.attachAsset('bonusToken', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 1.5,
+ scaleY: 1.5
+ });
+ // Create value text
+ self.valueText = new Text2('$1000', {
+ size: 24,
+ fill: 0xFFFFFF
+ });
+ self.valueText.anchor.set(0.5, 0.5);
+ self.addChild(self.valueText);
+ // Add interaction
+ self.interactive = true;
+ self.down = function (x, y, obj) {
+ if (!self.collected) {
+ self.collected = true;
+ totalMoney += self.value;
+ moneyText.setText('$' + totalMoney);
+ tokensCollected++;
+ tokensText.setText(tokensCollected + '/12 Tokens');
+ // Play bonus sound
+ LK.getSound('bonus').play();
+ // Visual feedback
+ tween(self, {
+ alpha: 0,
+ scaleX: 3,
+ scaleY: 3
+ }, {
+ duration: 500,
+ onFinish: function onFinish() {
+ self.destroy();
+ var index = tokens.indexOf(self);
+ if (index !== -1) {
+ tokens.splice(index, 1);
+ }
+ }
+ });
+ // Flash screen green for token collection
+ LK.effects.flashScreen(0x32CD32, 300);
+ }
+ };
+ self.update = function () {
+ if (!self.collected) {
+ self.y += self.speed;
+ // Rotate while falling
+ self.rotation += 0.02;
+ // Check if token has fallen off screen
+ if (self.y > 2732 + 100) {
+ self.destroy();
+ var index = tokens.indexOf(self);
+ if (index !== -1) {
+ tokens.splice(index, 1);
+ }
+ }
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB // Sky blue background
+});
+
+/****
+* Game Code
+****/
+// Game variables
+var totalMoney = 0;
+var tokensCollected = 0;
+var gameTimeInSeconds = 30 * 60; // 30 minutes
+var timeLeft = gameTimeInSeconds;
+var bills = [];
+var tokens = [];
+var lastBillSpawn = 0;
+var lastTokenSpawn = 0;
+var billSpawnRate = 60; // Frames between normal bill spawns
+var tokenSpawnRate = 600; // Frames between token spawns
+var maxTokens = 12; // Total tokens in the game
+var totalTokensSpawned = 0;
+// Create UI elements
+var moneyText = new Text2('$0', {
+ size: 80,
+ fill: 0x228B22 // Dark green
+});
+moneyText.anchor.set(0.5, 0);
+LK.gui.top.addChild(moneyText);
+moneyText.y = 20;
+var timeText = new Text2('30:00', {
+ size: 60,
+ fill: 0xFF0000 // Red
+});
+timeText.anchor.set(1, 0);
+LK.gui.topRight.addChild(timeText);
+timeText.x = -20;
+timeText.y = 20;
+var tokensText = new Text2('0/12 Tokens', {
+ size: 50,
+ fill: 0x32CD32 // Lime green
+});
+tokensText.anchor.set(0, 0);
+LK.gui.topLeft.addChild(tokensText);
+tokensText.x = 120; // Leave space for platform menu icon
+tokensText.y = 20;
+// Function to format time as mm:ss
+function formatTime(seconds) {
+ var minutes = Math.floor(seconds / 60);
+ var secs = seconds % 60;
+ return minutes + ':' + (secs < 10 ? '0' : '') + secs;
+}
+// Function to spawn a bill
+function spawnBill() {
+ // Determine bill value
+ var random = Math.random();
+ var value;
+ if (random < 0.4) {
+ value = 1;
+ } else if (random < 0.65) {
+ value = 5;
+ } else if (random < 0.8) {
+ value = 10;
+ } else if (random < 0.9) {
+ value = 20;
+ } else if (random < 0.95) {
+ value = 50;
+ } else {
+ value = 100;
+ }
+ var bill = new Bill(value);
+ bill.x = Math.random() * 2048; // Random x position
+ bill.y = -100; // Start above screen
+ bills.push(bill);
+ game.addChild(bill);
+}
+// Function to spawn a bonus token
+function spawnToken() {
+ if (totalTokensSpawned < maxTokens) {
+ var token = new BonusToken();
+ token.x = Math.random() * 2048; // Random x position
+ token.y = -100; // Start above screen
+ tokens.push(token);
+ game.addChild(token);
+ totalTokensSpawned++;
+ }
+}
+// Start background music
+LK.playMusic('bgmusic', {
+ fade: {
+ start: 0,
+ end: 0.3,
+ duration: 1000
+ }
+});
+// Game update function
+game.update = function () {
+ // Update time
+ if (timeLeft > 0) {
+ if (LK.ticks % 60 === 0) {
+ // Update every second
+ timeLeft--;
+ timeText.setText(formatTime(timeLeft));
+ // Warning when time is running out
+ if (timeLeft <= 60) {
+ // Last minute
+ timeText.tint = 0xFF0000; // Red
+ if (timeLeft % 2 === 0) {
+ tween(timeText, {
+ scaleX: 1.2,
+ scaleY: 1.2
+ }, {
+ duration: 500,
+ easing: tween.easeOut
+ });
+ } else {
+ tween(timeText, {
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 500,
+ easing: tween.easeOut
+ });
+ }
+ }
+ }
+ } else {
+ // Game over when time runs out
+ LK.setScore(totalMoney);
+ LK.showGameOver();
+ return;
+ }
+ // Spawn bills
+ if (LK.ticks - lastBillSpawn >= billSpawnRate) {
+ spawnBill();
+ lastBillSpawn = LK.ticks;
+ // Gradually increase spawn rate
+ if (billSpawnRate > 20) {
+ billSpawnRate -= 0.05;
+ }
+ }
+ // Spawn tokens
+ if (totalTokensSpawned < maxTokens && LK.ticks - lastTokenSpawn >= tokenSpawnRate) {
+ spawnToken();
+ lastTokenSpawn = LK.ticks;
+ }
+ // Update all bills
+ for (var i = bills.length - 1; i >= 0; i--) {
+ // Update is automatically called by the engine
+ }
+ // Update all tokens
+ for (var j = tokens.length - 1; j >= 0; j--) {
+ // Update is automatically called by the engine
+ }
+ // Check for win condition (all tokens collected)
+ if (tokensCollected === maxTokens && tokens.length === 0) {
+ // Apply bonus for collecting all tokens
+ totalMoney += 10000; // $10,000 bonus
+ moneyText.setText('$' + totalMoney);
+ LK.effects.flashScreen(0xFFD700, 1000); // Gold flash
+ // Set final score and show win
+ LK.setScore(totalMoney);
+ LK.showYouWin();
+ }
+};
+// Game touch event handlers
+game.down = function (x, y, obj) {
+ // This is handled by individual bills and tokens
+};
+game.move = function (x, y, obj) {
+ // Not needed for this game
+};
+game.up = function (x, y, obj) {
+ // Not needed for this game
+};
\ No newline at end of file