User prompt
Add the luckpot asset to the screen
User prompt
Make a return home button in the sliding puzzle game
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'self.sendChildToBack(background);' Line Number: 104
User prompt
Add the background back to the connect 4 game
User prompt
Make the connect 4 tokens different assets, the ones that you place, make them meme5 asset, your enemy's tokens make them meme6 asset
User prompt
Make a rock paper scissors game on the create video panel
User prompt
Make it so you have to pay 50 followers in order to spin the wheel ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Make the spin wheel go the same fast soeed everytime you spin it
User prompt
Add wheelmeme1 to the randommeme function
User prompt
Make it so you have a 20% chance to get a new meme for the generaterandomememe function, and that is the wheelmeme1 asset
User prompt
Delete the texts on the wheel
User prompt
Make it so when you press spin, the wheel asset spins because it is the new wheel
User prompt
Delete the shapes in the wheel lf flrtune screen
User prompt
Delete the star shape in the wheel acreen
User prompt
Add the wheel asset as the wheel of fortune
User prompt
Make the wheel look nicer and put the rewards on each side
User prompt
Make it so when you click the spin asset a new screen shows up where you can spin a wheel for rewards ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Mske the spin 1.5x bigger
User prompt
Move the spin asset 70 pixels down
User prompt
Move the spin wheel 30 pixels to the left
User prompt
Move it to the left by 50 pixels
User prompt
Move the spinny wheel to the left by 60 pixels
User prompt
Move it up 500 more pixels
User prompt
Move the spin asset 600 pixels up
User prompt
Move the spin asset 100 pixels to the right
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { money: 100, followers: 0, memeLevel: 1, studioLevel: 1, staffLevel: 0, marketingLevel: 0, autoEarningRate: 0, lastPlayed: "undefined" }); /**** * Classes ****/ var Button = Container.expand(function (text, width, height, color) { var self = Container.call(this); var buttonShape = self.attachAsset('button', { width: width || 600, height: height || 200, color: color || 0x4CAF50, anchorX: 0.5, anchorY: 0.5 }); var buttonText = new Text2(text, { size: 60, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.setText = function (newText) { buttonText.setText(newText); }; self.setColor = function (newColor) { buttonShape.tint = newColor; }; self.down = function (x, y, obj) { tween(buttonShape, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100 }); LK.getSound('click').play(); }; self.up = function (x, y, obj) { tween(buttonShape, { scaleX: 1, scaleY: 1 }, { duration: 100 }); }; return self; }); var Connect4Game = Container.expand(function () { var self = Container.call(this); // Constants var COLS = 7; var ROWS = 6; var CELL_SIZE = 150; var PLAYER_COLOR = 0xff0000; var AI_COLOR = 0xffff00; var BOARD_COLOR = 0x0000ff; var EMPTY = 0; var PLAYER = 1; var AI = 2; // Game state var board = []; var currentPlayer = PLAYER; var gameOver = false; var gameResult = null; // Create board background var boardBackground = self.attachAsset('memeCanvas', { anchorX: 0.5, anchorY: 0.5, width: COLS * CELL_SIZE + 40, height: ROWS * CELL_SIZE + 40, color: BOARD_COLOR }); // Initialize board data function initBoard() { board = []; for (var i = 0; i < COLS; i++) { board[i] = []; for (var j = 0; j < ROWS; j++) { board[i][j] = EMPTY; } } currentPlayer = PLAYER; gameOver = false; gameResult = null; } // Create visual board var cells = []; var circles = []; function createVisualBoard() { // Create cell containers for (var col = 0; col < COLS; col++) { cells[col] = []; circles[col] = []; for (var row = 0; row < ROWS; row++) { var cell = new Container(); cell.x = (col - COLS / 2 + 0.5) * CELL_SIZE; cell.y = (row - ROWS / 2 + 0.5) * CELL_SIZE; var cellCircle = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, width: CELL_SIZE - 20, height: CELL_SIZE - 20, color: 0xffffff }); cell.addChild(cellCircle); self.addChild(cell); cells[col][row] = cell; circles[col][row] = cellCircle; } } } // Create status text var statusText = new Text2("Your turn", { size: 60, fill: 0xffffff }); statusText.anchor.set(0.5, 0.5); statusText.y = -500; self.addChild(statusText); // Create Return Home button var returnHomeButton = new Button("Return Home", 400, 130, 0x9E9E9E); // Grey color returnHomeButton.y = 750; // Position below finish button self.addChild(returnHomeButton); // Create finish button var finishButton = new Button("Finish Recording", 600, 150, 0xff5555); finishButton.y = 600; finishButton.visible = false; self.addChild(finishButton); // Drop piece in column function dropPiece(col) { if (gameOver) { return false; } // Find the first empty row var row = ROWS - 1; while (row >= 0 && board[col][row] !== EMPTY) { row--; } // If column is full if (row < 0) { return false; } // Drop piece board[col][row] = currentPlayer; updateVisualBoard(); // Check for win if (checkWin(col, row)) { gameOver = true; gameResult = currentPlayer; finishButton.visible = true; statusText.setText(currentPlayer === PLAYER ? "You win!" : "AI wins!"); return true; } // Check for draw if (checkDraw()) { gameOver = true; gameResult = 0; finishButton.visible = true; statusText.setText("It's a draw!"); return true; } // Switch player currentPlayer = currentPlayer === PLAYER ? AI : PLAYER; statusText.setText(currentPlayer === PLAYER ? "Your turn" : "AI thinking..."); return true; } // Update the visual representation of the board function updateVisualBoard() { for (var col = 0; col < COLS; col++) { for (var row = 0; row < ROWS; row++) { if (board[col][row] === EMPTY) { circles[col][row].tint = 0xffffff; } else if (board[col][row] === PLAYER) { circles[col][row].tint = PLAYER_COLOR; } else { circles[col][row].tint = AI_COLOR; } } } } // Check if current player won function checkWin(col, row) { var player = board[col][row]; // Check horizontal var count = 0; for (var c = 0; c < COLS; c++) { if (board[c][row] === player) { count++; if (count >= 4) { return true; } } else { count = 0; } } // Check vertical count = 0; for (var r = 0; r < ROWS; r++) { if (board[col][r] === player) { count++; if (count >= 4) { return true; } } else { count = 0; } } // Check diagonal (/) for (var c = 0; c < COLS - 3; c++) { for (var r = 3; r < ROWS; r++) { if (board[c][r] === player && board[c + 1][r - 1] === player && board[c + 2][r - 2] === player && board[c + 3][r - 3] === player) { return true; } } } // Check diagonal (\) for (var c = 0; c < COLS - 3; c++) { for (var r = 0; r < ROWS - 3; r++) { if (board[c][r] === player && board[c + 1][r + 1] === player && board[c + 2][r + 2] === player && board[c + 3][r + 3] === player) { return true; } } } return false; } // Check if the game is a draw function checkDraw() { for (var col = 0; col < COLS; col++) { if (board[col][0] === EMPTY) { return false; } } return true; } // AI move function aiMove() { // Smarter AI using minimax with alpha-beta pruning var validColumns = []; var scores = []; // Get all valid columns for (var col = 0; col < COLS; col++) { if (board[col][0] === EMPTY) { validColumns.push(col); } } // Evaluate each possible move for (var i = 0; i < validColumns.length; i++) { var col = validColumns[i]; var tempBoard = copyBoard(board); var row = dropPieceInTempBoard(tempBoard, col, AI); // Check for immediate win if (checkWinInBoard(tempBoard, col, row, AI)) { // AI can win in this move, take it immediately LK.setTimeout(function () { dropPiece(col); }, 1000); return; } // Otherwise, evaluate this move var score = evaluateMove(tempBoard, col, row, 4); // Look 4 moves ahead scores.push({ col: col, score: score }); } // Find best move var bestMoves = []; var bestScore = -Infinity; for (var i = 0; i < scores.length; i++) { if (scores[i].score > bestScore) { bestScore = scores[i].score; bestMoves = [scores[i].col]; } else if (scores[i].score === bestScore) { bestMoves.push(scores[i].col); } } // Choose randomly among best moves for some unpredictability var bestCol = bestMoves[Math.floor(Math.random() * bestMoves.length)]; LK.setTimeout(function () { dropPiece(bestCol); }, 1000); } // Creates a copy of the current board function copyBoard(originalBoard) { var newBoard = []; for (var i = 0; i < COLS; i++) { newBoard[i] = []; for (var j = 0; j < ROWS; j++) { newBoard[i][j] = originalBoard[i][j]; } } return newBoard; } // Drops a piece in a temporary board for evaluation function dropPieceInTempBoard(tempBoard, col, player) { var row = ROWS - 1; while (row >= 0 && tempBoard[col][row] !== EMPTY) { row--; } if (row >= 0) { tempBoard[col][row] = player; } return row; } // Check for win in temporary board function checkWinInBoard(board, col, row, player) { // Check horizontal var count = 0; for (var c = 0; c < COLS; c++) { if (board[c][row] === player) { count++; if (count >= 4) { return true; } } else { count = 0; } } // Check vertical count = 0; for (var r = 0; r < ROWS; r++) { if (board[col][r] === player) { count++; if (count >= 4) { return true; } } else { count = 0; } } // Check diagonal (/) for (var c = 0; c < COLS - 3; c++) { for (var r = 3; r < ROWS; r++) { if (board[c][r] === player && board[c + 1][r - 1] === player && board[c + 2][r - 2] === player && board[c + 3][r - 3] === player) { return true; } } } // Check diagonal (\) for (var c = 0; c < COLS - 3; c++) { for (var r = 0; r < ROWS - 3; r++) { if (board[c][r] === player && board[c + 1][r + 1] === player && board[c + 2][r + 2] === player && board[c + 3][r + 3] === player) { return true; } } } return false; } // Evaluate the board position using heuristics function evaluateMove(tempBoard, col, row, depth) { // Base score var score = 0; // Check if this is a winning move if (checkWinInBoard(tempBoard, col, row, AI)) { return 1000; } // Look for opponent's winning move and block it for (var c = 0; c < COLS; c++) { if (tempBoard[c][0] === EMPTY) { var tempRow = dropPieceInTempBoard(copyBoard(tempBoard), c, PLAYER); if (tempRow >= 0 && checkWinInBoard(tempBoard, c, tempRow, PLAYER)) { score -= 800; // Prioritize blocking opponent win } } } // Evaluate center control (center column is strategically valuable) var centerCol = Math.floor(COLS / 2); var centerCount = 0; for (var r = 0; r < ROWS; r++) { if (tempBoard[centerCol][r] === AI) { centerCount++; } } score += centerCount * 30; // Evaluate connections (2 in a row, 3 in a row) score += evaluateConnections(tempBoard, AI) * 10; score -= evaluateConnections(tempBoard, PLAYER) * 8; // Prefer lower rows (more stable position) score += (ROWS - row) * 5; // If depth allows, do minimax for deeper evaluation if (depth > 0) { // Simulate player's best response var minScore = Infinity; for (var c = 0; c < COLS; c++) { if (tempBoard[c][0] === EMPTY) { var newBoard = copyBoard(tempBoard); var newRow = dropPieceInTempBoard(newBoard, c, PLAYER); if (newRow >= 0) { // Check if player wins if (checkWinInBoard(newBoard, c, newRow, PLAYER)) { return -900; // Very bad for AI } // Recursive evaluation with reduced depth var moveScore = evaluateMove(newBoard, c, newRow, depth - 1); if (moveScore < minScore) { minScore = moveScore; } } } } // Add minimax result with lower weight score += minScore * 0.5; } return score; } // Evaluate connected pieces (2 or 3 in a row) function evaluateConnections(board, player) { var score = 0; // Check horizontal connections for (var r = 0; r < ROWS; r++) { for (var c = 0; c < COLS - 1; c++) { if (board[c][r] === player && board[c + 1][r] === player) { score += 1; // 2 in a row if (c + 2 < COLS && board[c + 2][r] === player) { score += 5; // 3 in a row } } } } // Check vertical connections for (var c = 0; c < COLS; c++) { for (var r = 0; r < ROWS - 1; r++) { if (board[c][r] === player && board[c][r + 1] === player) { score += 1; // 2 in a row if (r + 2 < ROWS && board[c][r + 2] === player) { score += 5; // 3 in a row } } } } // Diagonal connections would be similar but more complex // Adding them would make the AI even smarter return score; } // Handle column click self.down = function (x, y) { if (currentPlayer !== PLAYER || gameOver) { return; } // Convert coordinates to column var boardX = x; var col = Math.floor((boardX + COLS / 2 * CELL_SIZE) / CELL_SIZE); // Check if valid column if (col >= 0 && col < COLS) { if (dropPiece(col) && !gameOver) { aiMove(); } } }; // Set finish callback self.setFinishCallback = function (callback) { finishButton.up = function () { tween(finishButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { callback(); } }; }; // Set return home callback self.setReturnHomeCallback = function (callback) { returnHomeButton.up = function () { tween(returnHomeButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { callback(); } }; }; // Initialize initBoard(); createVisualBoard(); updateVisualBoard(); return self; }); var GameSelector = Container.expand(function () { var self = Container.call(this); var background = self.attachAsset('studioBackground', { anchorX: 0.5, anchorY: 0.5, width: 2048, height: 2732, color: 0xdddddd }); var titleText = new Text2("Choose A Game To Record", { size: 80, fill: 0x333333 }); titleText.anchor.set(0.5, 0.5); titleText.y = -900; self.addChild(titleText); var connect4Button = new Button("Connect 4", 600, 200, 0x4CAF50); connect4Button.y = -700; self.addChild(connect4Button); var matchingButton = new Button("Memory Match", 600, 200, 0x2196F3); matchingButton.y = -400; self.addChild(matchingButton); var puzzleButton = new Button("Sliding Puzzle", 600, 200, 0x9C27B0); puzzleButton.y = -100; self.addChild(puzzleButton); // Create locked indicator for matching game var lockedText = new Text2("100 followers needed", { size: 60, fill: 0xFF5733 }); lockedText.anchor.set(0.5, 0.5); lockedText.y = -330; lockedText.visible = false; self.addChild(lockedText); // Create locked indicator for puzzle game var puzzleLockedText = new Text2("250 followers needed", { size: 60, fill: 0xFF5733 }); puzzleLockedText.anchor.set(0.5, 0.5); puzzleLockedText.y = -30; puzzleLockedText.visible = false; self.addChild(puzzleLockedText); var backButton = new Button("Go Back", 400, 130, 0xff5555); backButton.y = 900; self.addChild(backButton); // Update lock status based on follower count self.updateLockStatus = function (followerCount) { // Always show matching game as unlocked lockedText.visible = false; // Always show puzzle game as unlocked puzzleLockedText.visible = false; }; self.setGameCallback = function (callback) { connect4Button.up = function (x, y, obj) { tween(connect4Button, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { callback("connect4"); } }; matchingButton.up = function (x, y, obj) { tween(matchingButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { // Allow matching game for all players matchingButton.setColor(0x2196F3); // Set normal color callback("matching"); } }; puzzleButton.up = function (x, y, obj) { tween(puzzleButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { // Allow puzzle game for all players puzzleButton.setColor(0x9C27B0); // Set normal color callback("puzzle"); } }; }; self.setBackCallback = function (callback) { backButton.up = function (x, y, obj) { tween(backButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { callback(); } }; }; return self; }); var MatchingGame = Container.expand(function () { var self = Container.call(this); // Constants var GRID_SIZE = 4; // 4x4 grid var CARD_SIZE = 150; var CARD_MARGIN = 20; var CARD_COLOR = 0x2196F3; var CARD_BACK_COLOR = 0x607D8B; // Game state var cards = []; var flippedCards = []; var matchedPairs = 0; var totalPairs = 8; var canFlip = true; var gameOver = false; // Create background var boardBackground = self.attachAsset('memeCanvas', { anchorX: 0.5, anchorY: 0.5, width: (CARD_SIZE + CARD_MARGIN) * GRID_SIZE + 40, height: (CARD_SIZE + CARD_MARGIN) * GRID_SIZE + 40, color: 0x333333 }); // Create status text var statusText = new Text2("Match all pairs", { size: 60, fill: 0xffffff }); statusText.anchor.set(0.5, 0.5); statusText.y = -500; self.addChild(statusText); // Create finish button var finishButton = new Button("Finish Recording", 600, 150, 0xff5555); finishButton.y = 600; finishButton.visible = false; self.addChild(finishButton); // Create Return Home button var returnHomeButton = new Button("Return Home", 400, 130, 0x9E9E9E); // Grey color returnHomeButton.y = 750; // Position below finish button self.addChild(returnHomeButton); // Symbols for matching (emojis represented as text) var symbols = ["🍎", "🍌", "🍕", "🎮", "🚗", "⚽", "🎵", "🎨"]; // Initialize game function initGame() { cards = []; flippedCards = []; matchedPairs = 0; gameOver = false; canFlip = true; // Create all card pairs var cardValues = []; for (var i = 0; i < totalPairs; i++) { cardValues.push(i); cardValues.push(i); } // Shuffle the cards for (var i = cardValues.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = cardValues[i]; cardValues[i] = cardValues[j]; cardValues[j] = temp; } // Create card grid for (var row = 0; row < GRID_SIZE; row++) { for (var col = 0; col < GRID_SIZE; col++) { var index = row * GRID_SIZE + col; // Create card container var card = new Container(); card.x = (col - GRID_SIZE / 2 + 0.5) * (CARD_SIZE + CARD_MARGIN); card.y = (row - GRID_SIZE / 2 + 0.5) * (CARD_SIZE + CARD_MARGIN); // Card back (shown initially) var cardBack = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, width: CARD_SIZE, height: CARD_SIZE, color: CARD_BACK_COLOR }); // Card front (hidden initially) var cardFront = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, width: CARD_SIZE, height: CARD_SIZE, color: CARD_COLOR }); cardFront.visible = false; // Symbol text var symbolText = new Text2(symbols[cardValues[index]], { size: 60, fill: 0xFFFFFF }); symbolText.anchor.set(0.5, 0.5); symbolText.visible = false; // Add to card container card.addChild(cardBack); card.addChild(cardFront); card.addChild(symbolText); // Store card data card.value = cardValues[index]; card.isFlipped = false; card.isMatched = false; // Add to game self.addChild(card); cards.push(card); // Make clickable card.interactive = true; } } } // Flip a card function flipCard(card) { if (!canFlip || card.isFlipped || card.isMatched || gameOver) { return; } // Flip animation card.isFlipped = true; card.children[0].visible = false; // Hide back card.children[1].visible = true; // Show front card.children[2].visible = true; // Show symbol // Add to flipped cards flippedCards.push(card); // Check for match if we have 2 cards flipped if (flippedCards.length === 2) { canFlip = false; // Check for match if (flippedCards[0].value === flippedCards[1].value) { // Cards match LK.setTimeout(function () { flippedCards[0].isMatched = true; flippedCards[1].isMatched = true; // Highlight matched cards tween(flippedCards[0].children[1], { tint: 0x4CAF50 // Green tint }, { duration: 300 }); tween(flippedCards[1].children[1], { tint: 0x4CAF50 // Green tint }, { duration: 300 }); matchedPairs++; flippedCards = []; canFlip = true; // Check for game over if (matchedPairs === totalPairs) { gameOver = true; statusText.setText("You win!"); finishButton.visible = true; } }, 500); } else { // Cards don't match, flip back LK.setTimeout(function () { flippedCards[0].isFlipped = false; flippedCards[0].children[0].visible = true; // Show back flippedCards[0].children[1].visible = false; // Hide front flippedCards[0].children[2].visible = false; // Hide symbol flippedCards[1].isFlipped = false; flippedCards[1].children[0].visible = true; // Show back flippedCards[1].children[1].visible = false; // Hide front flippedCards[1].children[2].visible = false; // Hide symbol flippedCards = []; canFlip = true; }, 1000); } } } // Handle click self.down = function (x, y) { if (gameOver) { return; } // Convert coordinates to find clicked card for (var i = 0; i < cards.length; i++) { var card = cards[i]; var cardBounds = { x: card.x - CARD_SIZE / 2, y: card.y - CARD_SIZE / 2, width: CARD_SIZE, height: CARD_SIZE }; if (x >= cardBounds.x && x <= cardBounds.x + cardBounds.width && y >= cardBounds.y && y <= cardBounds.y + cardBounds.height) { flipCard(card); break; } } }; // Set finish callback self.setFinishCallback = function (callback) { finishButton.up = function () { tween(finishButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { callback(); } }; }; // Set return home callback self.setReturnHomeCallback = function (callback) { returnHomeButton.up = function () { tween(returnHomeButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { callback(); } }; }; // Initialize the game initGame(); return self; }); // MatchingGame instance (initially null) var MemeStudio = Container.expand(function () { var self = Container.call(this); var studioBackground = self.attachAsset('studioBackground', { anchorX: 0.5, anchorY: 0.5, height: 1800 }); var memeCanvas = self.attachAsset('memeCanvas', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 400, y: -250 }); var memeText = new Text2("Your Meme Here", { size: 54, fill: 0x000000 }); memeText.anchor.set(0.5, 0.5); memeText.y = -250; self.addChild(memeText); // Current displayed meme asset var currentMemeAsset = null; // Function to display a random meme function displayRandomMeme() { // Remove previous meme if exists if (currentMemeAsset) { self.removeChild(currentMemeAsset); } // 20% chance to get wheelmeme1 var memeId; if (Math.random() < 0.2) { memeId = 'Wheelmeme1'; } else { // Generate random number between 1-9 to select a meme var memeNumber = Math.floor(Math.random() * 9) + 1; memeId = 'Meme' + memeNumber; } // Create the new meme asset currentMemeAsset = LK.getAsset(memeId, { anchorX: 0.5, anchorY: 0.5, y: -250, width: 400, height: 400 }); // Add the meme to display self.addChild(currentMemeAsset); } var earningsText = new Text2("Earnings: $0", { size: 48, fill: 0x333333 }); earningsText.anchor.set(0.5, 0.5); earningsText.y = 20; self.addChild(earningsText); var createButton = new Button("Create Meme!", 500, 150, 0x4CAF50); createButton.y = 150; self.addChild(createButton); var createVideoButton = new Button("Create Video", 500, 150, 0x4CAF50); createVideoButton.y = 270; self.addChild(createVideoButton); var upgradesButton = new Button("Upgrades", 500, 150, 0x4CAF50); upgradesButton.y = 390; self.addChild(upgradesButton); // Add Spin button var spinButton = new Container(); var spinButtonAsset = spinButton.attachAsset('Spin', { anchorX: 0.5, anchorY: 0.5, width: 270, // 180 * 1.5 height: 270 // 180 * 1.5 }); spinButton.y = upgradesButton.y + upgradesButton.height / 2 + spinButtonAsset.height / 2 + 30 - 1030; // Position below upgrades, moved down 70px spinButton.x = 460; // Move 460 pixels to the right from the center (was 490) self.addChild(spinButton); // Add interactivity to Spin button spinButton.down = function (x, y, obj) { tween(spinButtonAsset, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100 }); LK.getSound('click').play(); }; // Note: Spin button 'up' handler will be set via setSpinButtonCallback var followerGainText = new Text2("+0 followers", { size: 42, fill: 0xFF5733 }); followerGainText.anchor.set(0.5, 0.5); followerGainText.y = 250; // Adjusted y position, original might conflict visually followerGainText.alpha = 0; self.addChild(followerGainText); // Update the meme canvas based on current studio level self.updateMemeQuality = function (level) { var quality = ["Potato Quality", "Standard Meme", "HD Meme", "Ultra HD Meme", "Viral-Ready Meme"]; var colors = [0xCCCCCC, 0xFFFFFF, 0xFFFFDD, 0xDDFFFF, 0xFFDDFF]; if (level > quality.length) { level = quality.length; } memeText.setText(quality[level - 1]); memeCanvas.tint = colors[level - 1]; // Scale the meme canvas slightly with each level var scale = 1 + (level - 1) * 0.1; memeCanvas.scale.set(scale, scale); }; // Show the earnings animation self.showEarnings = function (amount, followers) { earningsText.setText("Earnings: $" + amount); tween(earningsText, { scaleX: 1.3, scaleY: 1.3 }, { duration: 300, onFinish: function onFinish() { tween(earningsText, { scaleX: 1, scaleY: 1 }, { duration: 300 }); } }); if (followers > 0) { followerGainText.setText("+" + followers + " followers"); followerGainText.alpha = 1; tween(followerGainText, { y: 230, alpha: 0 }, { duration: 1500 }); } }; self.setCreateButtonCallback = function (callback) { createButton.up = function (x, y, obj) { tween(createButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); // Display a random meme when creating a new meme displayRandomMeme(); if (callback) { callback(); } }; }; self.setCreateVideoButtonCallback = function (callback) { createVideoButton.up = function (x, y, obj) { tween(createVideoButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { callback(); } }; }; self.setUpgradesButtonCallback = function (callback) { upgradesButton.up = function (x, y, obj) { tween(upgradesButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { callback(); } }; }; self.setSpinButtonCallback = function (callback) { spinButton.up = function (x, y, obj) { tween(spinButtonAsset, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { callback(); } }; }; return self; }); var PuzzleGame = Container.expand(function () { var self = Container.call(this); // Constants var GRID_SIZE = 4; // 4x4 grid var PUZZLE_SIZE = 600; var TILE_SIZE = PUZZLE_SIZE / GRID_SIZE; var TILE_MARGIN = 5; // Game state var tiles = []; var emptyPos = { row: GRID_SIZE - 1, col: GRID_SIZE - 1 }; var moves = 0; var gameOver = false; // Create board background var boardBackground = self.attachAsset('memeCanvas', { anchorX: 0.5, anchorY: 0.5, width: PUZZLE_SIZE + 40, height: PUZZLE_SIZE + 40, color: 0x333333 }); // Create status text var statusText = new Text2("Slide tiles to order 1-15", { size: 60, fill: 0xffffff }); statusText.anchor.set(0.5, 0.5); statusText.y = -500; self.addChild(statusText); // Create moves counter var movesText = new Text2("Moves: 0", { size: 60, fill: 0xffffff }); movesText.anchor.set(0.5, 0.5); movesText.y = -420; self.addChild(movesText); // Create finish button var finishButton = new Button("Finish Recording", 600, 150, 0xff5555); finishButton.y = 600; finishButton.visible = false; self.addChild(finishButton); // Initialize board function initBoard() { tiles = []; moves = 0; gameOver = false; movesText.setText("Moves: 0"); // Create all tiles var values = []; for (var i = 0; i < GRID_SIZE * GRID_SIZE - 1; i++) { values.push(i + 1); } values.push(0); // Empty tile // Shuffle tiles (ensuring puzzle is solvable) var isSolvable = false; while (!isSolvable) { shuffleArray(values); isSolvable = checkSolvable(values); } // Create visual tiles for (var row = 0; row < GRID_SIZE; row++) { tiles[row] = []; for (var col = 0; col < GRID_SIZE; col++) { var index = row * GRID_SIZE + col; var value = values[index]; if (value === 0) { // Empty tile emptyPos = { row: row, col: col }; tiles[row][col] = null; continue; } // Create tile var tile = new Container(); tile.value = value; // Position tile in grid var x = (col - GRID_SIZE / 2 + 0.5) * TILE_SIZE; var y = (row - GRID_SIZE / 2 + 0.5) * TILE_SIZE; tile.x = x; tile.y = y; // Create tile background var tileBackground = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, width: TILE_SIZE - TILE_MARGIN * 2, height: TILE_SIZE - TILE_MARGIN * 2, color: 0x4CAF50 }); // Create tile number var tileText = new Text2(value.toString(), { size: TILE_SIZE / 3, fill: 0xFFFFFF }); tileText.anchor.set(0.5, 0.5); // Add to tile container tile.addChild(tileBackground); tile.addChild(tileText); // Add tile to game self.addChild(tile); tiles[row][col] = tile; } } } // Check if puzzle is solvable function checkSolvable(values) { var inversions = 0; var emptyRow = 0; // Find empty tile row from the bottom for (var i = 0; i < values.length; i++) { if (values[i] === 0) { emptyRow = Math.floor(i / GRID_SIZE); break; } } // Count inversions for (var i = 0; i < values.length - 1; i++) { if (values[i] === 0) { continue; } for (var j = i + 1; j < values.length; j++) { if (values[j] === 0) { continue; } if (values[i] > values[j]) { inversions++; } } } // Check solvability conditions if (GRID_SIZE % 2 === 1) { // Odd grid size - solvable if inversions is even return inversions % 2 === 0; } else { // Even grid size - solvable if: // - empty on even row from bottom + odd inversions // - empty on odd row from bottom + even inversions var emptyRowFromBottom = GRID_SIZE - emptyRow - 1; return emptyRowFromBottom % 2 === 0 && inversions % 2 === 1 || emptyRowFromBottom % 2 === 1 && inversions % 2 === 0; } } // Shuffle array (Fisher-Yates algorithm) function shuffleArray(array) { for (var i = array.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = array[i]; array[i] = array[j]; array[j] = temp; } } // Check if puzzle is solved function checkWin() { for (var row = 0; row < GRID_SIZE; row++) { for (var col = 0; col < GRID_SIZE; col++) { var expectedValue = row * GRID_SIZE + col + 1; // Skip the last tile (empty) if (row === GRID_SIZE - 1 && col === GRID_SIZE - 1) { continue; } // Check if tile is in correct position if (!tiles[row][col] || tiles[row][col].value !== expectedValue) { return false; } } } return true; } // Determine if a tile can be moved (adjacent to empty) function canMoveTile(row, col) { return row === emptyPos.row && Math.abs(col - emptyPos.col) === 1 || col === emptyPos.col && Math.abs(row - emptyPos.row) === 1; } // Move a tile to the empty position function moveTile(row, col) { if (gameOver || !canMoveTile(row, col)) { return; } // Get the tile var tile = tiles[row][col]; // Calculate new position var newX = (emptyPos.col - GRID_SIZE / 2 + 0.5) * TILE_SIZE; var newY = (emptyPos.row - GRID_SIZE / 2 + 0.5) * TILE_SIZE; // Animate tile movement tween(tile, { x: newX, y: newY }, { duration: 150 }); // Update game state tiles[emptyPos.row][emptyPos.col] = tile; tiles[row][col] = null; // Update empty position var oldEmptyPos = { row: emptyPos.row, col: emptyPos.col }; emptyPos.row = row; emptyPos.col = col; // Increment move counter moves++; movesText.setText("Moves: " + moves); // Check for win if (checkWin()) { gameOver = true; statusText.setText("Puzzle Solved!"); finishButton.visible = true; } } // Handle click/touch on the board self.down = function (x, y) { if (gameOver) { return; } // Convert coordinates to board position for (var row = 0; row < GRID_SIZE; row++) { for (var col = 0; col < GRID_SIZE; col++) { var tileX = (col - GRID_SIZE / 2 + 0.5) * TILE_SIZE; var tileY = (row - GRID_SIZE / 2 + 0.5) * TILE_SIZE; var left = tileX - TILE_SIZE / 2; var right = tileX + TILE_SIZE / 2; var top = tileY - TILE_SIZE / 2; var bottom = tileY + TILE_SIZE / 2; if (x >= left && x < right && y >= top && y < bottom) { if (tiles[row][col]) { moveTile(row, col); } } } } }; // Set finish callback self.setFinishCallback = function (callback) { finishButton.up = function () { tween(finishButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { callback(); } }; }; // Initialize the game initBoard(); return self; }); var SpinWheel = Container.expand(function () { var self = Container.call(this); // Constants var WHEEL_RADIUS = 400; var NUM_SEGMENTS = 8; var SPIN_DURATION = 5000; var PRIZES = [{ name: "100 coins", value: 100, color: 0xf44336, icon: "💰" }, { name: "200 coins", value: 200, color: 0x2196f3, icon: "💰" }, { name: "50 followers", value: 50, color: 0x4caf50, isFollowers: true, icon: "👥" }, { name: "500 coins", value: 500, color: 0xffeb3b, icon: "💰" }, { name: "25 followers", value: 25, color: 0xff9800, isFollowers: true, icon: "👥" }, { name: "150 coins", value: 150, color: 0x9c27b0, icon: "💰" }, { name: "300 coins", value: 300, color: 0x00bcd4, icon: "💰" }, { name: "75 followers", value: 75, color: 0x8bc34a, isFollowers: true, icon: "👥" }]; // Wheel outer ring var wheelRim = self.attachAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, width: WHEEL_RADIUS * 2 + 20, height: WHEEL_RADIUS * 2 + 20, color: 0x222222 }); // Wheel background - use actual wheel asset var wheelBackground = self.attachAsset('Wheel', { anchorX: 0.5, anchorY: 0.5, width: WHEEL_RADIUS * 2, height: WHEEL_RADIUS * 2 }); // Create wheel segments container var wheelSegmentsContainer = new Container(); self.addChild(wheelSegmentsContainer); // Create wheel segments var segments = []; for (var i = 0; i < NUM_SEGMENTS; i++) { var segment = new Container(); var angle = i / NUM_SEGMENTS * Math.PI * 2; // Calculate segment positions var segmentAngle = Math.PI * 2 / NUM_SEGMENTS; // Position the segment container segment.rotation = angle; // Prize icon removed // Segment text removed // Value text removed wheelSegmentsContainer.addChild(segment); segments.push(segment); } // Add decorative outer dots for (var i = 0; i < NUM_SEGMENTS * 2; i++) { var dotAngle = i / (NUM_SEGMENTS * 2) * Math.PI * 2; var dot = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, width: 15, height: 15, color: 0xFFD700 // Gold dots }); dot.x = Math.cos(dotAngle) * (WHEEL_RADIUS + 10); dot.y = Math.sin(dotAngle) * (WHEEL_RADIUS + 10); self.addChild(dot); } // Create center point with decorative rings var centerPointOuter = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, width: 80, height: 80, color: 0xFFD700 // Gold }); self.addChild(centerPointOuter); var centerPoint = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, width: 60, height: 60, color: 0xFF5733 // Orange-red }); self.addChild(centerPoint); // Add pointer (indicator) var pointerBase = LK.getAsset('centerCircle', { anchorX: 0.5, anchorY: 0.5, width: 60, height: 60, color: 0xFF0000 }); pointerBase.y = -WHEEL_RADIUS - 20; self.addChild(pointerBase); var pointer = LK.getAsset('Girrafe', { anchorX: 0.5, anchorY: 0, width: 40, height: 80, color: 0xFF0000 }); pointer.y = -WHEEL_RADIUS - 50; self.addChild(pointer); // Add close button var closeButton = new Button("Close", 200, 80, 0xff5555); closeButton.y = WHEEL_RADIUS + 100; self.addChild(closeButton); // Add result text (initially hidden) var resultText = new Text2("", { size: 60, fill: 0xFFD700 }); resultText.anchor.set(0.5, 0.5); resultText.y = WHEEL_RADIUS + 180; resultText.alpha = 0; self.addChild(resultText); // Spinning state var isSpinning = false; // Spin the wheel self.spin = function (callback) { if (isSpinning) { return; } isSpinning = true; // Reset result text resultText.alpha = 0; // Play spinning sound LK.getSound('click').play(); // Determine winning segment (random) var targetSegment = Math.floor(Math.random() * NUM_SEGMENTS); var targetAngle = targetSegment / NUM_SEGMENTS * Math.PI * 2; // Add extra rotations and randomness var extraRotations = 5 + Math.random() * 3; // 5-8 full rotations var finalRotation = extraRotations * Math.PI * 2 + targetAngle; // Animate the wheel spinning (target the wheelBackground now) tween(wheelBackground, { rotation: finalRotation }, { duration: SPIN_DURATION, easing: tween.easeOutCubic, onFinish: function onFinish() { isSpinning = false; // Show result var prize = PRIZES[targetSegment]; resultText.setText("You won: " + prize.name + "!"); // Flash the pointer tween(pointerBase, { scaleX: 1.5, scaleY: 1.5, alpha: 0.7 }, { duration: 200, yoyo: true, repeat: 3 }); // Fade in result text tween(resultText, { alpha: 1 }, { duration: 500 }); // Play reward sound LK.getSound('coin').play(); // Callback with prize if (callback) { callback(prize); } } }); }; // Set close button callback self.setCloseCallback = function (callback) { closeButton.up = function () { tween(closeButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { callback(); } }; }; return self; }); var TabSystem = Container.expand(function (tabs) { var self = Container.call(this); var tabButtons = []; var tabContents = []; var activeTab = 0; // Create tab buttons for (var i = 0; i < tabs.length; i++) { var tab = tabs[i]; var index = i; var tabButton = new Button(tab.name, 240, 80, 0x607D8B); tabButton.x = i * 320 - (tabs.length - 1) * 160; tabButton.y = -1300 / 2 + 30; tabButton.up = function (x, y, obj) { tween(tabButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); setActiveTab(index); }; self.addChild(tabButton); tabButtons.push(tabButton); // Create and add content container var content = tab.content; content.visible = i === 0; // Only first tab visible initially self.addChild(content); tabContents.push(content); } function setActiveTab(index) { if (index === activeTab) { return; } // Update button colors tabButtons[activeTab].setColor(0x607D8B); tabButtons[index].setColor(0x2196F3); // Hide old content, show new tabContents[activeTab].visible = false; tabContents[index].visible = true; activeTab = index; } // Initialize first tab as active setActiveTab(0); return self; }); var UpgradeButton = Container.expand(function (title, description, price, level, onUpgrade) { var self = Container.call(this); var buttonShape = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5, width: 420, height: 140 }); var titleText = new Text2(title, { size: 42, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0); titleText.y = -buttonShape.height / 2 + 15; self.addChild(titleText); var descText = new Text2(description, { size: 30, fill: 0xFFFFFF }); descText.anchor.set(0.5, 0); descText.y = -buttonShape.height / 2 + 50; self.addChild(descText); var levelText = new Text2("Level: " + level, { size: 34, fill: 0xFFD700 }); levelText.anchor.set(0, 1); levelText.x = -buttonShape.width / 2 + 15; levelText.y = buttonShape.height / 2 - 10; self.addChild(levelText); var priceText = new Text2("$" + price, { size: 36, fill: 0xFFD700 }); priceText.anchor.set(1, 1); priceText.x = buttonShape.width / 2 - 15; priceText.y = buttonShape.height / 2 - 10; self.addChild(priceText); self.updateLevel = function (newLevel) { levelText.setText("Level: " + newLevel); }; self.updatePrice = function (newPrice) { priceText.setText("$" + newPrice); }; self.disable = function () { buttonShape.tint = 0x888888; self.interactive = false; }; self.enable = function () { buttonShape.tint = 0x2196F3; self.interactive = true; }; self.down = function (x, y, obj) { tween(buttonShape, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100 }); LK.getSound('click').play(); }; self.up = function (x, y, obj) { tween(buttonShape, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (onUpgrade) { onUpgrade(); } }; return self; }); var UpgradePanel = Container.expand(function () { var self = Container.call(this); var background = self.attachAsset('studioBackground', { anchorX: 0.5, anchorY: 0.5, width: 1800, height: 1300, color: 0xdddddd }); var titleText = new Text2("Upgrade Your Channel", { size: 64, fill: 0x333333 }); titleText.anchor.set(0.5, 0); titleText.y = -background.height / 2 + 50; self.addChild(titleText); var closeButton = new Button("Close", 240, 80, 0xff5555); closeButton.x = background.width / 2 - 130; closeButton.y = -background.height / 2 + 50; self.addChild(closeButton); self.setCloseCallback = function (callback) { closeButton.up = function (x, y, obj) { tween(closeButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { callback(); } }; }; self.addUpgradeButton = function (title, description, price, level, maxLevel, x, y, onUpgrade) { var button = new UpgradeButton(title, description, price, level, function () { if (onUpgrade) { onUpgrade(button); } }); // Make upgrade buttons bigger button.scale.set(1.4, 1.4); button.x = x; button.y = y; if (maxLevel !== undefined && level >= maxLevel) { button.updatePrice("MAXED"); button.disable(); } self.addChild(button); return button; }; return self; }); var WheelScreen = Container.expand(function () { var self = Container.call(this); // Add background var background = self.attachAsset('studioBackground', { anchorX: 0.5, anchorY: 0.5, width: 2048, height: 2732, color: 0xdddddd }); // Add title var titleText = new Text2("Spin the Wheel for Prizes!", { size: 80, fill: 0x333333 }); titleText.anchor.set(0.5, 0.5); titleText.y = -900; self.addChild(titleText); // Create spin wheel var spinWheel = new SpinWheel(); spinWheel.y = 0; // Center of screen self.addChild(spinWheel); // Create spin button var spinButton = new Button("SPIN!", 300, 100, 0x4CAF50); spinButton.y = 600; self.addChild(spinButton); // Set spin button callback spinButton.up = function () { tween(spinButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); // Disable spin button during spin spinButton.visible = false; // Spin the wheel spinWheel.spin(function (prize) { // Process the prize if (self.onPrizeWon) { self.onPrizeWon(prize); } // Re-enable spin button after delay LK.setTimeout(function () { spinButton.visible = true; }, 2000); }); }; // Store callback for prize handling self.setPrizeCallback = function (callback) { self.onPrizeWon = callback; }; // Set close callback self.setCloseCallback = function (callback) { spinWheel.setCloseCallback(callback); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ // Game variables if (!tween.stopTweensOf) { tween.stopTweensOf = function (target) { // Simple implementation of stopTweensOf if not provided by the tween library if (target && target._tweens) { target._tweens.forEach(function (t) { t.stop(); }); target._tweens = []; } }; } var money = storage.money || 100; var followers = storage.followers || 0; var memeLevel = storage.memeLevel || 1; var studioLevel = storage.studioLevel || 1; var staffLevel = storage.staffLevel || 0; var marketingLevel = storage.marketingLevel || 0; var autoEarningRate = storage.autoEarningRate || 0; var lastPlayed = storage.lastPlayed || Date.now(); var membershipLevel = storage.membershipLevel || 0; var equipmentLevel = storage.equipmentLevel || 1; // Upgrade prices var upgradePrices = { quality: parseInt(calculateUpgradeCost(1, memeLevel)) || 100, membership: 500, staff: parseInt(calculateUpgradeCost(3, staffLevel)) || 300, equipment: parseInt(calculateUpgradeCost(2, studioLevel)) || 200 }; // Function to start Puzzle game function startPuzzleGame() { // Hide game selector gameSelector.visible = false; // Create new PuzzleGame or reset existing one if (!puzzleGame) { puzzleGame = new PuzzleGame(); puzzleGame.x = 2048 / 2; puzzleGame.y = 2732 / 2; game.addChild(puzzleGame); } else { // Remove existing game and create a new one game.removeChild(puzzleGame); puzzleGame = new PuzzleGame(); puzzleGame.x = 2048 / 2; puzzleGame.y = 2732 / 2; game.addChild(puzzleGame); } // Show the game puzzleGame.visible = true; // Set callback for when game finishes puzzleGame.setFinishCallback(function () { // Hide Puzzle game puzzleGame.visible = false; // Show main screen hideGameSelector(); // Give rewards for completing video game - puzzle games give balanced rewards var videoEarnings = MEME_BASE_INCOME * memeLevel * studioLevel * 6.4; // Doubled from 3.2 to 6.4 var videoFollowers = MEME_BASE_FOLLOWERS * memeLevel * 3.5; // Apply membership bonus if active if (membershipLevel > 0) { videoEarnings = Math.floor(videoEarnings * 1.5); } // Apply randomness var randomFactor = 0.9 + Math.random() * 0.2; videoEarnings = Math.floor(videoEarnings * randomFactor); // Update game state money += videoEarnings; followers += videoFollowers; // Show earnings memeStudio.showEarnings(videoEarnings, videoFollowers); // Play coin sound LK.getSound('coin').play(); // Update storage updateStorage(); }); } // Upgrade levels var upgradeLevels = { quality: memeLevel, membership: membershipLevel, staff: staffLevel, equipment: studioLevel }; // Constants var MEME_BASE_INCOME = 10; var MEME_BASE_FOLLOWERS = 5; var UPGRADE_BASE_COST = 100; var AUTO_EARNINGS_INTERVAL = 20000; // ms (20 seconds) var OFFLINE_EARNINGS_MAX_HOURS = 24; // Calculate offline earnings function calculateOfflineEarnings() { var now = Date.now(); var timeDiff = now - lastPlayed; var secondsDiff = timeDiff / 1000; var periods = secondsDiff / 20; // How many 20-second periods elapsed // Cap at max hours (converted to 20-second periods) var maxPeriods = OFFLINE_EARNINGS_MAX_HOURS * 60 * 60 / 20; if (periods > maxPeriods) { periods = maxPeriods; } // Only calculate if we have auto earnings if (autoEarningRate > 0 && periods > 0) { var hourlyRate = autoEarningRate; var periodRate = hourlyRate / 180; // Convert from hourly to per 20-second period var earnings = Math.floor(periodRate * periods); money += earnings; // Show welcome back message here if needed console.log("Welcome back! You earned $" + earnings + " while away."); } lastPlayed = now; storage.lastPlayed = now; } // Calculate costs for upgrades function calculateUpgradeCost(baseLevel, currentLevel) { return Math.floor(UPGRADE_BASE_COST * baseLevel * Math.pow(1.5, currentLevel)); } // Update storage function updateStorage() { storage.money = money; storage.followers = followers; storage.memeLevel = memeLevel; storage.studioLevel = studioLevel; storage.staffLevel = staffLevel; storage.marketingLevel = marketingLevel; storage.autoEarningRate = autoEarningRate; storage.membershipLevel = membershipLevel; } // Calculate meme creation result function createMeme() { // Base earnings affected by meme quality and studio level var earnings = MEME_BASE_INCOME * memeLevel * (1 + studioLevel * 0.5); // Followers gained affected by marketing level var newFollowers = Math.floor(MEME_BASE_FOLLOWERS * (1 + marketingLevel * 0.5)); // Boost from followers (virality factor) var followerBoost = 1 + followers / 1000; earnings = Math.floor(earnings * followerBoost); // Apply membership bonus if active if (membershipLevel > 0) { earnings = Math.floor(earnings * 1.5); } // Apply randomness for variability (80% to 120% of calculated value) var randomFactor = 0.8 + Math.random() * 0.4; earnings = Math.floor(earnings * randomFactor); // Small chance for meme to go viral if (Math.random() < 0.05) { earnings *= 5; newFollowers *= 3; console.log("Your meme went viral!"); } // Update game state money += earnings; followers += newFollowers; // Update storage updateStorage(); // Return results return { earnings: earnings, followers: newFollowers }; } // Update auto earnings rate based on staff function updateAutoEarningRate() { autoEarningRate = staffLevel * 250 * memeLevel * studioLevel; // MASSIVELY increased earning rate storage.autoEarningRate = autoEarningRate; } // Create game selector screen (initially hidden) var gameSelector = new GameSelector(); gameSelector.x = 2048 / 2; gameSelector.y = 2732 / 2; gameSelector.visible = false; game.addChild(gameSelector); // Function to show game selector function showGameSelector() { gameSelector.visible = true; memeStudio.visible = false; statsContainer.visible = false; studioContent.visible = false; // Update matching game lock status based on current follower count gameSelector.updateLockStatus(followers); } // Function to hide game selector and show the main screen function hideGameSelector() { gameSelector.visible = false; memeStudio.visible = true; statsContainer.visible = true; studioContent.visible = true; } // Set callbacks for game selector gameSelector.setGameCallback(function (gameType) { if (gameType === "connect4") { startConnect4Game(); } else if (gameType === "matching") { startMatchingGame(); } else if (gameType === "puzzle") { startPuzzleGame(); } }); gameSelector.setBackCallback(function () { hideGameSelector(); }); // Connect4 game instance (initially null) var connect4Game = null; // Function to start Connect4 game function startConnect4Game() { // Hide game selector gameSelector.visible = false; // Create new Connect4 game or reset existing one if (!connect4Game) { connect4Game = new Connect4Game(); connect4Game.x = 2048 / 2; connect4Game.y = 2732 / 2; game.addChild(connect4Game); } else { // Remove existing game and create a new one game.removeChild(connect4Game); connect4Game = new Connect4Game(); connect4Game.x = 2048 / 2; connect4Game.y = 2732 / 2; game.addChild(connect4Game); } // Show the game connect4Game.visible = true; // Set callback for return home button connect4Game.setReturnHomeCallback(function () { // Hide Connect4 game connect4Game.visible = false; // Show main screen hideGameSelector(); // Use existing function to return to main view }); // Set callback for when game finishes connect4Game.setFinishCallback(function () { // Hide Connect4 game connect4Game.visible = false; // Show main screen hideGameSelector(); // Give rewards for completing video game var videoEarnings = MEME_BASE_INCOME * memeLevel * studioLevel * 6; // Doubled from 3 to 6 var videoFollowers = MEME_BASE_FOLLOWERS * memeLevel * 3; // Apply membership bonus if active if (membershipLevel > 0) { videoEarnings = Math.floor(videoEarnings * 1.5); } // Apply randomness var randomFactor = 0.9 + Math.random() * 0.2; videoEarnings = Math.floor(videoEarnings * randomFactor); // Update game state money += videoEarnings; followers += videoFollowers; // Show earnings memeStudio.showEarnings(videoEarnings, videoFollowers); // Play coin sound LK.getSound('coin').play(); // Update storage updateStorage(); }); } // Create UI elements // Main studio // Create rent button using the rent asset var rentButton = new Container(); var rentButtonAsset = rentButton.attachAsset('Rent', { anchorX: 0.5, anchorY: 0.5, width: 600, height: 180 }); var rentButtonText = new Text2("Pay Rent: $200", { size: 54, fill: 0xFFFFFF }); rentButtonText.anchor.set(0.5, 0.5); rentButton.addChild(rentButtonText); rentButton.x = 2048 / 2; rentButton.y = 300; // Create rent bar under the rent button var rentBar = new Container(); var rentBarAsset = rentBar.attachAsset('Girrafe', { anchorX: 0.5, anchorY: 0.5, width: 600, height: 100 }); rentBar.x = 2048 / 2; rentBar.y = 380; game.addChild(rentBar); // Animate the rent bar slowly draining to the left tween(rentBarAsset, { scaleX: 0, x: -300 }, { duration: 60000, // 60 seconds (one minute) duration for slow drain easing: tween.linear, onFinish: function onFinish() { // When rent bar runs out, lose half the money money = Math.floor(money / 2); // Reset the rent bar after losing money tween.stopTweensOf(rentBarAsset); rentBarAsset.scaleX = 1; rentBarAsset.x = 0; // Start draining again tween(rentBarAsset, { scaleX: 0, x: -300 }, { duration: 60000, easing: tween.linear, onFinish: arguments.callee // Use same function for next time }); // Update storage after losing money updateStorage(); // Play sound to indicate rent is due LK.getSound('click').play(); } }); rentButton.down = function (x, y, obj) { tween(rentButtonAsset, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100 }); LK.getSound('click').play(); }; rentButton.up = function (x, y, obj) { tween(rentButtonAsset, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (money >= 200) { money -= 200; LK.getSound('coin').play(); tween(rentButton, { y: 280, alpha: 0.5 }, { duration: 300, onFinish: function onFinish() { tween(rentButton, { y: 300, alpha: 1 }, { duration: 300 }); } }); // Reset the rent bar by creating a new tween // Stop any existing tween on the rent bar tween.stopTweensOf(rentBarAsset); // Reset the bar's scale and position rentBarAsset.scaleX = 1; rentBarAsset.x = 0; // Start a new tween to drain it again tween(rentBarAsset, { scaleX: 0, x: -300 }, { duration: 60000, // 60 seconds (one minute) duration for slow drain easing: tween.linear }); updateStorage(); } }; game.addChild(rentButton); var memeStudio = new MemeStudio(); memeStudio.x = 2048 / 2; memeStudio.y = 2732 / 2; game.addChild(memeStudio); // Initialize with current meme quality memeStudio.updateMemeQuality(memeLevel); // Reset Progress button var resetButton = new Button("Reset Progress", 300, 100, 0xff5555); resetButton.x = 200; // Position in bottom left resetButton.y = 2732 - 100; // Position near bottom resetButton.up = function (x, y, obj) { tween(resetButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); // Reset all progress money = 100; followers = 0; memeLevel = 1; studioLevel = 1; staffLevel = 0; marketingLevel = 0; autoEarningRate = 0; membershipLevel = 0; // Reset upgrade levels upgradeLevels.quality = memeLevel; upgradeLevels.membership = membershipLevel; upgradeLevels.staff = staffLevel; upgradeLevels.equipment = studioLevel; // Reset upgrade prices upgradePrices.quality = calculateUpgradeCost(1, memeLevel); upgradePrices.membership = 500; upgradePrices.staff = calculateUpgradeCost(3, staffLevel); upgradePrices.equipment = calculateUpgradeCost(2, studioLevel); // Update storage updateStorage(); // Update UI memeStudio.updateMemeQuality(memeLevel); // Play sound LK.getSound('levelUp').play(); }; game.addChild(resetButton); // Stats display var statsContainer = new Container(); statsContainer.x = 2048 / 2; statsContainer.y = 180; game.addChild(statsContainer); var moneyIcon = LK.getAsset('moneyIcon', { anchorX: 0.5, anchorY: 0.5, x: -600 }); statsContainer.addChild(moneyIcon); var moneyText = new Text2("$" + money, { size: 54, fill: 0x000000 }); moneyText.anchor.set(0, 0.5); moneyText.x = -570; statsContainer.addChild(moneyText); var followerIcon = LK.getAsset('followerIcon', { anchorX: 0.5, anchorY: 0.5, x: 400 }); statsContainer.addChild(followerIcon); var followerText = new Text2(followers + " followers", { size: 54, fill: 0x000000 }); followerText.anchor.set(0, 0.5); followerText.x = 430; statsContainer.addChild(followerText); var autoEarningText = new Text2("", { size: 36, fill: 0x333333 }); autoEarningText.anchor.set(0.5, 0.5); autoEarningText.y = 80; statsContainer.addChild(autoEarningText); // Create upgrade tab contents var studioContent = new Container(); // Meme Quality Upgrade button removed // No studio equipment upgrade // Staff Upgrade removed // Studio content is displayed directly without tabs studioContent.x = 2048 / 2; studioContent.y = 2732 / 2 + 400; game.addChild(studioContent); // Set callback for create meme button memeStudio.setCreateButtonCallback(function () { var result = createMeme(); memeStudio.showEarnings(result.earnings, result.followers); LK.getSound('coin').play(); }); // Create upgrade panel (initially hidden) var upgradePanel = new UpgradePanel(); upgradePanel.x = 2048 / 2; upgradePanel.y = 2732 / 2; upgradePanel.visible = false; game.addChild(upgradePanel); // Function to show upgrade panel function showUpgradePanel() { upgradePanel.visible = true; memeStudio.visible = false; statsContainer.visible = false; studioContent.visible = false; // Add meme quality upgrade button var memeQualityUpgrade = upgradePanel.addUpgradeButton("Meme Quality", "Better memes = more $$$", upgradePrices.quality, upgradeLevels.quality, 10, // Max level 0, // X position -300, // Y position function (button) { if (money >= upgradePrices.quality) { // Pay for upgrade money -= upgradePrices.quality; // Increase level memeLevel++; upgradeLevels.quality = memeLevel; // Update studio memeStudio.updateMemeQuality(memeLevel); // Update price upgradePrices.quality = calculateUpgradeCost(1, memeLevel); button.updateLevel(memeLevel); button.updatePrice(upgradePrices.quality); // Check if max level reached if (memeLevel >= 10) { button.updatePrice("MAXED"); button.disable(); } // Play level up sound LK.getSound('levelUp').play(); // Update storage updateStorage(); } }); // Add staff upgrade button var staffUpgradeButton = upgradePanel.addUpgradeButton("Hire Staff", "Staff generates income", upgradePrices.staff, upgradeLevels.staff, 10, // Max level 0, // X position 0, // Y position function (button) { if (money >= upgradePrices.staff) { // Pay for upgrade money -= upgradePrices.staff; // Increase level staffLevel++; upgradeLevels.staff = staffLevel; // Update auto earning rate updateAutoEarningRate(); // Update price upgradePrices.staff = calculateUpgradeCost(3, staffLevel); button.updateLevel(staffLevel); button.updatePrice(upgradePrices.staff); // Check if max level reached if (staffLevel >= 10) { button.updatePrice("MAXED"); button.disable(); } // Play level up sound LK.getSound('levelUp').play(); // Update storage updateStorage(); } }); } // Function to hide upgrade panel function hideUpgradePanel() { upgradePanel.visible = false; memeStudio.visible = true; statsContainer.visible = true; studioContent.visible = true; } // Set up close callback for upgrade panel upgradePanel.setCloseCallback(function () { hideUpgradePanel(); }); // Set callback for create video button memeStudio.setCreateVideoButtonCallback(function () { showGameSelector(); }); // Set callback for upgrades button memeStudio.setUpgradesButtonCallback(function () { showUpgradePanel(); }); // Initialize wheel screen (initially null) var wheelScreen = null; // Function to show wheel screen function showWheelScreen() { // Hide main elements memeStudio.visible = false; statsContainer.visible = false; studioContent.visible = false; // Create wheel screen if it doesn't exist if (!wheelScreen) { wheelScreen = new WheelScreen(); wheelScreen.x = 2048 / 2; wheelScreen.y = 2732 / 2; game.addChild(wheelScreen); // Set prize callback wheelScreen.setPrizeCallback(function (prize) { // Process the prize if (prize.isFollowers) { // Add followers followers += prize.value; // Show followers gained memeStudio.showEarnings(0, prize.value); } else { // Add money money += prize.value; // Show money gained memeStudio.showEarnings(prize.value, 0); } // Update storage updateStorage(); }); // Set close callback wheelScreen.setCloseCallback(function () { // Hide wheel screen wheelScreen.visible = false; // Show main elements memeStudio.visible = true; statsContainer.visible = true; studioContent.visible = true; }); } else { // Show existing wheel screen wheelScreen.visible = true; } } // Set callback for spin button memeStudio.setSpinButtonCallback(function () { showWheelScreen(); LK.getSound('click').play(); }); // Start background music LK.playMusic('bgMusic', { fade: { start: 0, end: 0.4, duration: 1000 } }); // Calculate any offline earnings when game starts calculateOfflineEarnings(); // Set up auto earning timer var lastAutoEarningTime = Date.now(); // Update UI with current values function updateUI() { moneyText.setText("$" + Math.floor(money)); followerText.setText(Math.floor(followers) + " followers"); if (autoEarningRate > 0) { autoEarningText.setText("Auto earning: $" + Math.floor(autoEarningRate / 180) + " / 20 seconds"); } else { autoEarningText.setText(""); } } // Add game reference to global scope so it can be accessed from upgradeScreen game.money = money; game.memeLevel = memeLevel; game.studioLevel = studioLevel; game.staffLevel = staffLevel; game.levels = upgradeLevels; game.updateStorage = updateStorage; game.updateAutoEarningRate = updateAutoEarningRate; // Main game update loop game.update = function () { // Handle auto earnings var now = Date.now(); var elapsed = now - lastAutoEarningTime; if (elapsed >= AUTO_EARNINGS_INTERVAL && autoEarningRate > 0) { // Calculate earnings for this period (20 seconds is 1/180th of an hour) var earnings = Math.floor(autoEarningRate / 180); if (earnings > 0) { money += earnings; lastAutoEarningTime = now; updateStorage(); } } // Update UI elements updateUI(); // Sync game reference values game.money = money; // Enable/disable upgrade buttons based on available money // All upgrade buttons removed }; // MatchingGame instance (initially null) var matchingGame = null; // PuzzleGame instance (initially null) var puzzleGame = null; // Function to start Matching game function startMatchingGame() { // Hide game selector gameSelector.visible = false; // Create new MatchingGame or reset existing one if (!matchingGame) { matchingGame = new MatchingGame(); matchingGame.x = 2048 / 2; matchingGame.y = 2732 / 2; game.addChild(matchingGame); } else { // Remove existing game and create a new one game.removeChild(matchingGame); matchingGame = new MatchingGame(); matchingGame.x = 2048 / 2; matchingGame.y = 2732 / 2; game.addChild(matchingGame); } // Show the game matchingGame.visible = true; // Set callback for return home button matchingGame.setReturnHomeCallback(function () { // Hide MatchingGame matchingGame.visible = false; // Show main screen hideGameSelector(); // Use existing function to return to main view }); // Set callback for when game finishes matchingGame.setFinishCallback(function () { // Hide Matching game matchingGame.visible = false; // Show main screen hideGameSelector(); // Give rewards for completing video game - memory games give a bit more followers var videoEarnings = MEME_BASE_INCOME * memeLevel * studioLevel * 7; // Doubled from 3.5 to 7 var videoFollowers = MEME_BASE_FOLLOWERS * memeLevel * 4; // Apply membership bonus if active if (membershipLevel > 0) { videoEarnings = Math.floor(videoEarnings * 1.5); } // Apply randomness var randomFactor = 0.9 + Math.random() * 0.2; videoEarnings = Math.floor(videoEarnings * randomFactor); // Update game state money += videoEarnings; followers += videoFollowers; // Show earnings memeStudio.showEarnings(videoEarnings, videoFollowers); // Play coin sound LK.getSound('coin').play(); // Update storage updateStorage(); }); }
===================================================================
--- original.js
+++ change.js
@@ -849,11 +849,17 @@
// Remove previous meme if exists
if (currentMemeAsset) {
self.removeChild(currentMemeAsset);
}
- // Generate random number between 1-9 to select a meme
- var memeNumber = Math.floor(Math.random() * 9) + 1;
- var memeId = 'Meme' + memeNumber;
+ // 20% chance to get wheelmeme1
+ var memeId;
+ if (Math.random() < 0.2) {
+ memeId = 'Wheelmeme1';
+ } else {
+ // Generate random number between 1-9 to select a meme
+ var memeNumber = Math.floor(Math.random() * 9) + 1;
+ memeId = 'Meme' + memeNumber;
+ }
// Create the new meme asset
currentMemeAsset = LK.getAsset(memeId, {
anchorX: 0.5,
anchorY: 0.5,
Modern App Store icon, high definition, square with rounded corners, for a game titled "Meme Empire Tycoon" and with the description "Build your meme empire from scratch in this addictive tycoon game! Create viral content, hire talented staff, upgrade your studio, and strategically expand your meme business across multiple platforms to become the internet's most influential meme creator.". No text on icon!
Green button. In-Game asset. 2d. High contrast. No shadows
Youtube silver play button. In-Game asset. 2d. High contrast. No shadows
Wheel of fortune. In-Game asset. 2d. High contrast. No shadows
Wheel of fortune without the stand. In-Game asset. 2d. High contrast. No shadows
Coin potion. In-Game asset. 2d. High contrast. No shadows
Diamond. In-Game asset. 2d. High contrast. No shadows
Archery target. In-Game asset. 2d. High contrast. No shadows
Arrow. In-Game asset. 2d. High contrast. No shadows
Fish. In-Game asset. 2d. High contrast. No shadows
Purple fish. In-Game asset. 2d. High contrast. No shadows
Golden fish. In-Game asset. 2d. High contrast. No shadows
Red cup. In-Game asset. 2d. High contrast. No shadows
Mute music logo. In-Game asset. 2d. High contrast. No shadows