User prompt
Add the assets meme5 and meme6 to the meme assets
User prompt
Found a glitch that when your progress is saved and yoi refresh, the upgrade pirces say NaN, please fix that ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Make the upgrade buttons bigger
User prompt
Make a hire staf upgrade button in the upgrade panel
User prompt
Make it so the meme auality upgrade maxes out at level 10
User prompt
Add a meme quality upgrade button to the upgrade panel. When you buy it, you get more money every time you make a video or upload a meme.
User prompt
Make the upgrade screen bigger
User prompt
Make a new button under the create video button named upgrades
User prompt
Make the create meme and create video buttons a bit bigger
User prompt
Delete the hire staff upgrade button please
User prompt
Please fix the bug: 'ReferenceError: Can't find variable: memeUpgradeButton' in or related to this line: 'memeUpgradeButton.enable();' Line Number: 1790
User prompt
Delete the meme quality upgrade button please
User prompt
Please fix the bug: 'ReferenceError: Can't find variable: studioUpgradeButton' in or related to this line: 'studioUpgradeButton.enable();' Line Number: 1811
User prompt
Delete the studio equipment upgrade button
User prompt
Delete the hire staff upgrade button
User prompt
Delete the upgrade screen
User prompt
Delete the meme wuality upgrade
User prompt
Delete the meme quality upgrdae
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'upgradeScreen.show();' Line Number: 1806
User prompt
Delete the upgrade screen
User prompt
Delete the upgrade tab
User prompt
Move the upgrade tab down by 600 pixels
User prompt
Move the upgrade tab to the right by 250 pixels
User prompt
Please fix the bug: 'TypeError: easing is not a function. (In 'easing(t)', 'easing' is "easeOutBack")' in or related to this line: 'tween(panel, {' Line Number: 1439
User prompt
The upgrade tab needs to be centered
/**** * 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 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(); } }; }; // 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); // 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(); } }; }; // 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); } // Generate random number between 1-4 to select a meme var memeNumber = Math.floor(Math.random() * 4) + 1; var 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!", 420, 130, 0x4CAF50); createButton.y = 150; self.addChild(createButton); var createVideoButton = new Button("Create Video", 420, 130, 0x4CAF50); createVideoButton.y = 270; self.addChild(createVideoButton); var followerGainText = new Text2("+0 followers", { size: 42, fill: 0xFF5733 }); followerGainText.anchor.set(0.5, 0.5); followerGainText.y = 250; 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(); } }; }; 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 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: 1600, height: 1000, 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); } }); button.x = x; button.y = y; if (maxLevel !== undefined && level >= maxLevel) { button.updatePrice("MAXED"); button.disable(); } self.addChild(button); return button; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ // Game variables 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: calculateUpgradeCost(1, memeLevel), membership: 500, staff: calculateUpgradeCost(3, staffLevel), equipment: calculateUpgradeCost(2, studioLevel) }; // 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 * 3.2; 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 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 * 3; 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 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); memeUpgradeButton.updateLevel(memeLevel); memeUpgradeButton.updatePrice(calculateUpgradeCost(1, memeLevel)); studioUpgradeButton.updateLevel(studioLevel); studioUpgradeButton.updatePrice(calculateUpgradeCost(2, studioLevel)); staffUpgradeButton.updateLevel(staffLevel); staffUpgradeButton.updatePrice(calculateUpgradeCost(3, staffLevel)); // 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 var memeUpgradeButton = new UpgradeButton("Meme Quality", "Better memes = more $$$", calculateUpgradeCost(1, memeLevel), memeLevel, function () { var cost = calculateUpgradeCost(1, memeLevel); if (money >= cost) { money -= cost; memeLevel++; memeUpgradeButton.updateLevel(memeLevel); memeUpgradeButton.updatePrice(calculateUpgradeCost(1, memeLevel)); memeStudio.updateMemeQuality(memeLevel); updateAutoEarningRate(); updateStorage(); LK.getSound('levelUp').play(); } }); memeUpgradeButton.x = -700; memeUpgradeButton.y = 0; studioContent.addChild(memeUpgradeButton); // Studio Upgrade var studioUpgradeButton = new UpgradeButton("Studio Equipment", "Better equipment = better production", calculateUpgradeCost(2, studioLevel), studioLevel, function () { var cost = calculateUpgradeCost(2, studioLevel); if (money >= cost) { money -= cost; studioLevel++; studioUpgradeButton.updateLevel(studioLevel); studioUpgradeButton.updatePrice(calculateUpgradeCost(2, studioLevel)); updateStorage(); LK.getSound('levelUp').play(); } }); studioUpgradeButton.x = 0; studioUpgradeButton.y = 0; studioContent.addChild(studioUpgradeButton); // Staff Upgrade var staffUpgradeButton = new UpgradeButton("Hire Staff", "More staff = MASSIVE auto-income", calculateUpgradeCost(3, staffLevel), staffLevel, function () { var cost = calculateUpgradeCost(3, staffLevel); if (money >= cost) { money -= cost; staffLevel++; staffUpgradeButton.updateLevel(staffLevel); staffUpgradeButton.updatePrice(calculateUpgradeCost(3, staffLevel)); updateAutoEarningRate(); updateStorage(); LK.getSound('levelUp').play(); } }); staffUpgradeButton.x = 700; staffUpgradeButton.y = 0; studioContent.addChild(staffUpgradeButton); // 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(); }); // Set callback for create video button memeStudio.setCreateVideoButtonCallback(function () { showGameSelector(); }); // 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 if (money >= calculateUpgradeCost(1, memeLevel)) { memeUpgradeButton.enable(); } else { memeUpgradeButton.disable(); } if (money >= calculateUpgradeCost(2, studioLevel)) { studioUpgradeButton.enable(); } else { studioUpgradeButton.disable(); } if (money >= calculateUpgradeCost(3, staffLevel)) { staffUpgradeButton.enable(); } else { staffUpgradeButton.disable(); } }; // 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 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 * 3.5; 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
@@ -1340,111 +1340,8 @@
return button;
};
return self;
});
-var UpgradeScreen = Container.expand(function () {
- var self = Container.call(this);
- // Semi-transparent background
- var overlay = LK.getAsset('studioBackground', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: 2048,
- height: 2732,
- color: 0x000000
- });
- overlay.alpha = 0.7;
- self.addChild(overlay);
- var panel = new UpgradePanel();
- panel.y = 0;
- self.addChild(panel);
- var qualityButton, membershipButton, staffButton, equipmentButton;
- self.initialize = function (game, prices, levels) {
- // Membership upgrade button
- membershipButton = panel.addUpgradeButton("Membership", "One-time: +50% money per video", prices.membership, levels.membership, 1, -600, 250, function (button) {
- if (game.money >= prices.membership && levels.membership === 0) {
- game.money -= prices.membership;
- levels.membership = 1;
- button.updateLevel(levels.membership);
- button.updatePrice("MAXED");
- button.disable();
- LK.getSound('levelUp').play();
- game.updateStorage();
- }
- });
- // Staff upgrade button - centered in the screen (x: 0)
- staffButton = panel.addUpgradeButton("Hire Staff", "More staff = faster auto-uploads", prices.staff, levels.staff, undefined, 600, 100, function (button) {
- if (game.money >= prices.staff) {
- game.money -= prices.staff;
- levels.staff++;
- prices.staff = Math.floor(prices.staff * 1.5);
- button.updateLevel(levels.staff);
- button.updatePrice(prices.staff);
- LK.getSound('levelUp').play();
- game.staffLevel = levels.staff;
- game.updateAutoEarningRate();
- game.updateStorage();
- }
- });
- // Equipment upgrade button - centered in the screen (x: 0)
- equipmentButton = panel.addUpgradeButton("Equipment", "Better gear = quality & income boost", prices.equipment, levels.equipment, undefined, 600, 250, function (button) {
- if (game.money >= prices.equipment) {
- game.money -= prices.equipment;
- levels.equipment++;
- prices.equipment = Math.floor(prices.equipment * 1.5);
- button.updateLevel(levels.equipment);
- button.updatePrice(prices.equipment);
- LK.getSound('levelUp').play();
- game.studioLevel = levels.equipment;
- game.updateStorage();
- }
- });
- panel.setCloseCallback(function () {
- self.visible = false;
- });
- };
- self.show = function () {
- self.visible = true;
- tween(panel, {
- scaleX: 1,
- scaleY: 1,
- alpha: 1
- }, {
- duration: 300
- });
- };
- self.updateButtons = function (game, prices) {
- // Enable/disable buttons based on available money
- if (qualityButton) {
- if (game.money >= prices.quality) {
- qualityButton.enable();
- } else {
- qualityButton.disable();
- }
- }
- if (staffButton) {
- if (game.money >= prices.staff) {
- staffButton.enable();
- } else {
- staffButton.disable();
- }
- }
- if (equipmentButton) {
- if (game.money >= prices.equipment) {
- equipmentButton.enable();
- } else {
- equipmentButton.disable();
- }
- }
- if (membershipButton && game.levels.membership === 0) {
- if (game.money >= prices.membership) {
- membershipButton.enable();
- } else {
- membershipButton.disable();
- }
- }
- };
- return self;
-});
/****
* Initialize Game
****/
@@ -1832,14 +1729,8 @@
});
staffUpgradeButton.x = 700;
staffUpgradeButton.y = 0;
studioContent.addChild(staffUpgradeButton);
-// Create upgrade screen (initially hidden)
-var upgradeScreen = new UpgradeScreen();
-upgradeScreen.visible = false;
-game.addChild(upgradeScreen);
-// Initialize upgrade screen
-upgradeScreen.initialize(game, upgradePrices, upgradeLevels);
// Studio content is displayed directly without tabs
studioContent.x = 2048 / 2;
studioContent.y = 2732 / 2 + 400;
game.addChild(studioContent);
@@ -1900,12 +1791,8 @@
// Update UI elements
updateUI();
// Sync game reference values
game.money = money;
- // Update upgrade screen buttons if visible
- if (upgradeScreen.visible) {
- upgradeScreen.updateButtons(game, upgradePrices);
- }
// Enable/disable upgrade buttons based on available money
if (money >= calculateUpgradeCost(1, memeLevel)) {
memeUpgradeButton.enable();
} else {
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