User prompt
theres a bug where if i fail it plays both sounds
User prompt
make a noise when you click the button
User prompt
make it so it restarts my coins when i play again ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
make it show a image and not a text
User prompt
make it say if you lose money or not
User prompt
Please fix the bug: 'Timeout.tick error: Cannot set properties of undefined (setting 'fill')' in or related to this line: 'resultText.style.fill = "#00AA00";' Line Number: 96
Code edit (1 edits merged)
Please save this source code
User prompt
Meme Millionaire
Initial prompt
make memes to buy a house house cost 100000 coins and you have to click make meme to make a meme and sometimes it will say realey good video and give 1000 coins and sometimes it says bad video witch makes you lose 500 coins and it asol shows a image of what meme you posted
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { coins: 2000, bestScore: 0 }); /**** * Classes ****/ var Button = Container.expand(function () { var self = Container.call(this); var background = self.attachAsset('makeButton', { anchorX: 0.5, anchorY: 0.5 }); var buttonText = new Text2('MAKE MEME', { size: 50, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function () { tween(self.scale, { x: 0.9, y: 0.9 }, { duration: 100, easing: tween.easeOut }); }; self.up = function () { tween(self.scale, { x: 1, y: 1 }, { duration: 100, easing: tween.easeOut }); }; return self; }); var House = Container.expand(function () { var self = Container.call(this); var houseBase = self.attachAsset('house', { anchorX: 0.5, anchorY: 1.0 }); var roof = self.attachAsset('houseRoof', { anchorX: 0.5, anchorY: 1.0, y: -houseBase.height }); // Make roof triangular by scaling down the width at top roof.scale.set(1, 1); return self; }); var MemePost = Container.expand(function () { var self = Container.call(this); var memeBackground = self.attachAsset('memeBackground', { anchorX: 0.5, anchorY: 0.5 }); var memeText = new Text2('', { size: 36, fill: 0x000000 }); memeText.anchor.set(0.5, 0.5); self.addChild(memeText); var resultText = new Text2('', { size: 40, fill: 0x000000 }); resultText.anchor.set(0.5, 0.5); resultText.y = memeBackground.height / 2 + 50; self.addChild(resultText); self.setMeme = function (text, isViral) { memeText.setText(text); if (isViral) { resultText.setText('VIRAL! +1000 COINS', { fill: 0x00AA00 }); } else { resultText.setText('FLOPPED! -500 COINS', { fill: 0xAA0000 }); } // Start with small scale and grow self.scale.set(0.1); tween(self.scale, { x: 1, y: 1 }, { duration: 500, easing: tween.elasticOut }); }; return self; }); var ProgressBar = Container.expand(function () { var self = Container.call(this); var background = self.attachAsset('progressBar', { anchorX: 0, anchorY: 0.5 }); var fill = self.attachAsset('progressBarFill', { anchorX: 0, anchorY: 0.5 }); fill.scale.x = 0; self.updateProgress = function (current, target) { var ratio = current / target; ratio = Math.max(0, Math.min(1, ratio)); tween(fill.scale, { x: ratio }, { duration: 500, easing: tween.easeOut }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xE6F7FF }); /**** * Game Code ****/ // Game variables var coins = storage.coins || 2000; var goalCoins = 100000; var memeTexts = ["One does not simply\nbecome a meme millionaire", "Me: *posts a meme*\nInternet: TAKE MY MONEY", "When your meme\ngoes viral", "Wait, you guys are\nmaking money?", "Meme stonks\nGO BRRRRR", "How it started vs\nHow it's going", "Nobody:\nMe: *making memes for virtual money*", "The house I'll buy\nwith meme coins", "Posting memes until\nI can afford a house", "My bank account after\nmaking memes all day"]; var currentMeme = null; var houseOwned = false; // Create the house (dream goal) var house = new House(); house.x = 2048 / 2; house.y = 800; house.scale.set(0.8); game.addChild(house); // Create UI elements var coinText = new Text2("Coins: " + coins.toLocaleString(), { size: 60, fill: 0x000000 }); coinText.anchor.set(0, 0); coinText.x = 50; coinText.y = 50; LK.gui.addChild(coinText); var goalText = new Text2("Goal: " + goalCoins.toLocaleString() + " coins", { size: 40, fill: 0x000000 }); goalText.anchor.set(1, 0); goalText.x = 2048 - 50; goalText.y = 50; LK.gui.addChild(goalText); // Progress bar var progressBar = new ProgressBar(); progressBar.x = 2048 / 2 - 800; progressBar.y = 150; LK.gui.addChild(progressBar); progressBar.updateProgress(coins, goalCoins); // Create the meme posting area var memeContainer = new Container(); memeContainer.x = 2048 / 2; memeContainer.y = 1500; game.addChild(memeContainer); // Create the meme button var makeButton = new Button(); makeButton.x = 2048 / 2; makeButton.y = 2200; game.addChild(makeButton); // Instructions text var instructionsText = new Text2("Tap the button to make memes.\nViral memes earn 1000 coins, flops cost 500 coins.\nReach 100,000 coins to buy your dream house!", { size: 40, fill: 0x000000 }); instructionsText.anchor.set(0.5, 0.5); instructionsText.x = 2048 / 2; instructionsText.y = 2350; game.addChild(instructionsText); // Handle meme creation function createMeme() { // Remove previous meme if exists if (currentMeme) { memeContainer.removeChild(currentMeme); currentMeme.destroy(); } // Create a new meme post currentMeme = new MemePost(); memeContainer.addChild(currentMeme); // Determine if meme goes viral (60% chance of success) var isViral = Math.random() < 0.6; // Get a random meme text var memeText = memeTexts[Math.floor(Math.random() * memeTexts.length)]; // Update coins if (isViral) { coins += 1000; LK.getSound('success').play(); LK.effects.flashScreen(0x00AA00, 300); var gainText = new Text2("+1000 COINS", { size: 60, fill: 0x00AA00 }); gainText.anchor.set(0.5, 0.5); gainText.x = 2048 / 2; gainText.y = 900; game.addChild(gainText); tween(gainText, { alpha: 0, y: gainText.y - 100 }, { duration: 1000 }); LK.setTimeout(function () { gainText.destroy(); }, 1000); } else { coins -= 500; LK.getSound('fail').play(); LK.effects.flashScreen(0xAA0000, 300); var loseText = new Text2("-500 COINS", { size: 60, fill: 0xAA0000 }); loseText.anchor.set(0.5, 0.5); loseText.x = 2048 / 2; loseText.y = 900; game.addChild(loseText); tween(loseText, { alpha: 0, y: loseText.y - 100 }, { duration: 1000 }); LK.setTimeout(function () { loseText.destroy(); }, 1000); } // Ensure coins don't go below 0 coins = Math.max(0, coins); // Save coins to storage storage.coins = coins; // Update display coinText.setText("Coins: " + coins.toLocaleString()); progressBar.updateProgress(coins, goalCoins); // Set meme content currentMeme.setMeme(memeText, isViral); // Check if player has reached the goal checkGoal(); } // Check if player reached the goal function checkGoal() { if (coins >= goalCoins && !houseOwned) { houseOwned = true; // Update best score if needed if (!storage.bestScore || coins > storage.bestScore) { storage.bestScore = coins; } // Animate house celebration tween(house.scale, { x: 1.2, y: 1.2 }, { duration: 800, easing: tween.elasticOut }); // Show winning message var winText = new Text2("CONGRATULATIONS!\nYou bought your dream house!", { size: 80, fill: 0x009900 }); winText.anchor.set(0.5, 0.5); winText.x = 2048 / 2; winText.y = 1100; game.addChild(winText); // Show confetti effect (simplified) LK.effects.flashScreen(0xFFFF00, 500); // Show you win after a delay LK.setTimeout(function () { LK.showYouWin(); }, 2000); } } // Handle button clicks makeButton.down = function (x, y, obj) { tween(makeButton.scale, { x: 0.9, y: 0.9 }, { duration: 100, easing: tween.easeOut }); }; makeButton.up = function (x, y, obj) { tween(makeButton.scale, { x: 1, y: 1 }, { duration: 100, easing: tween.easeOut }); createMeme(); }; // Game update function game.update = function () { // Game logic that runs every frame }; // Start background music LK.playMusic('backgroundMusic'); // Create initial meme to show the player how it works LK.setTimeout(function () { createMeme(); }, 500);
===================================================================
--- original.js
+++ change.js
@@ -78,15 +78,13 @@
self.addChild(resultText);
self.setMeme = function (text, isViral) {
memeText.setText(text);
if (isViral) {
- resultText.setText('VIRAL! +1000 COINS');
- resultText.setText(resultText.text, {
+ resultText.setText('VIRAL! +1000 COINS', {
fill: 0x00AA00
});
} else {
- resultText.setText('FLOPPED! -500 COINS');
- resultText.setText(resultText.text, {
+ resultText.setText('FLOPPED! -500 COINS', {
fill: 0xAA0000
});
}
// Start with small scale and grow
@@ -206,11 +204,47 @@
// Update coins
if (isViral) {
coins += 1000;
LK.getSound('success').play();
+ LK.effects.flashScreen(0x00AA00, 300);
+ var gainText = new Text2("+1000 COINS", {
+ size: 60,
+ fill: 0x00AA00
+ });
+ gainText.anchor.set(0.5, 0.5);
+ gainText.x = 2048 / 2;
+ gainText.y = 900;
+ game.addChild(gainText);
+ tween(gainText, {
+ alpha: 0,
+ y: gainText.y - 100
+ }, {
+ duration: 1000
+ });
+ LK.setTimeout(function () {
+ gainText.destroy();
+ }, 1000);
} else {
coins -= 500;
LK.getSound('fail').play();
+ LK.effects.flashScreen(0xAA0000, 300);
+ var loseText = new Text2("-500 COINS", {
+ size: 60,
+ fill: 0xAA0000
+ });
+ loseText.anchor.set(0.5, 0.5);
+ loseText.x = 2048 / 2;
+ loseText.y = 900;
+ game.addChild(loseText);
+ tween(loseText, {
+ alpha: 0,
+ y: loseText.y - 100
+ }, {
+ duration: 1000
+ });
+ LK.setTimeout(function () {
+ loseText.destroy();
+ }, 1000);
}
// Ensure coins don't go below 0
coins = Math.max(0, coins);
// Save coins to storage
the chicken jockey meme. In-Game asset. 2d. High contrast. No shadows
tung tung tung shaur meme. In-Game asset. 2d. High contrast. No shadows
banana meme. In-Game asset. 2d. High contrast. No shadows
mewing meme. In-Game asset. 2d. High contrast. No shadows
monkey eating a banana with a face meme. In-Game asset. 2d. High contrast. No shadows