Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: scoreText.setText is not a function' in or related to this line: 'scoreText.setText("Score: " + score);' Line Number: 806
User prompt
in fliprunner, the score is not visible on screen, fix it
User prompt
Please fix the bug: 'TypeError: scoreText.setText is not a function' in or related to this line: 'scoreText.setText("Score: " + score);' Line Number: 806
User prompt
var scoreText = flipRunnerContainer.children[1]; should be visible
User prompt
polarity shift game needs a score visible on the screen
User prompt
Please fix the bug: 'TypeError: scoreText.setText is not a function' in or related to this line: 'scoreText.setText("Score: " + score);' Line Number: 805
User prompt
game #1 should be not doodle jump but it should be an endless sidescroller runner in a tunnel where the goal is to tap the screen to flip polarity ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: catNinjaContainer.children[1].setText is not a function' in or related to this line: 'catNinjaContainer.children[1].setText("Score: " + player.score);' Line Number: 594
User prompt
Please fix the bug: 'Timeout.tick error: Cannot set properties of undefined (setting 'fill')' in or related to this line: 'resultText.style.fill = "#E74C3C";' Line Number: 492
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'call')' in or related to this line: 'Button.prototype.up.call(this);' Line Number: 249
Code edit (1 edits merged)
Please save this source code
User prompt
Meme Arcade Mashup
User prompt
we are making a 3 in 1 game, all three available games are meme based, there will be a splash screen, follow by a game selection screen where there will be 3 game options available on screen each will boot to their own respective meme game
User prompt
i don't like the stonks meme game idea
User prompt
the three games will be meme cultured base
User prompt
Please continue polishing my design document.
Initial prompt
we are making a 3 in 1 game, there will be a splash screen, follow by a game selection screen where there will be 3 options available on screen each will boot to their own respective game
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { highScore1: 0, highScore2: 0, highScore3: 0 }); /**** * Classes ****/ var Button = Container.expand(function (text, width, height) { var self = Container.call(this); var buttonShape = self.attachAsset('selectionButton', { anchorX: 0.5, anchorY: 0.5, width: width || 400, height: height || 300 }); var buttonText = new Text2(text, { size: 50, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function () { buttonShape.alpha = 0.7; LK.getSound('buttonClick').play(); }; self.up = function () { buttonShape.alpha = 1.0; }; return self; }); // CatNinja classes var CatPlayer = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('catPlayer', { anchorX: 0.5, anchorY: 0.5 }); self.score = 0; self.lives = 3; self.slash = function (cucumber) { LK.getSound('slice').play(); LK.effects.flashObject(cucumber, 0xFFFFFF, 300); self.score += 1; return true; }; return self; }); // CoinFlip classes var Coin = Container.expand(function () { var self = Container.call(this); var coinGraphics = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); self.isHeads = true; self.isFlipping = false; self.flip = function () { if (self.isFlipping) { return; } self.isFlipping = true; LK.getSound('flip').play(); var flips = Math.floor(Math.random() * 10) + 5; var flipDuration = 1500; function doFlip(flipsLeft) { if (flipsLeft <= 0) { self.isFlipping = false; self.isHeads = Math.random() >= 0.5; return; } tween(coinGraphics, { scaleX: 0 }, { duration: flipDuration / (flipsLeft * 2), onFinish: function onFinish() { self.isHeads = !self.isHeads; coinGraphics.tint = self.isHeads ? 0xF1C40F : 0xE67E22; tween(coinGraphics, { scaleX: 1 }, { duration: flipDuration / (flipsLeft * 2), onFinish: function onFinish() { doFlip(flipsLeft - 1); } }); } }); } doFlip(flips); }; return self; }); var Cucumber = Container.expand(function () { var self = Container.call(this); var cucumberGraphics = self.attachAsset('cucumber', { anchorX: 0.5, anchorY: 0.5 }); self.speed = Math.random() * 5 + 5; self.rotationSpeed = (Math.random() - 0.5) * 0.2; self.update = function () { self.y += self.speed; self.rotation += self.rotationSpeed; }; return self; }); var DoodlePlatform = Container.expand(function (x, y) { var self = Container.call(this); var platformGraphics = self.attachAsset('doodlePlatform', { anchorX: 0.5, anchorY: 0.5 }); self.x = x; self.y = y; self.speed = 0; self.isMoving = Math.random() > 0.7; if (self.isMoving) { self.speed = Math.random() * 4 + 2; self.direction = Math.random() > 0.5 ? 1 : -1; platformGraphics.tint = 0xE74C3C; } self.update = function () { if (self.isMoving) { self.x += self.speed * self.direction; if (self.x > 1900 || self.x < 150) { self.direction *= -1; } } }; return self; }); // DoodleJump classes var DoodlePlayer = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('doodlePlayer', { anchorX: 0.5, anchorY: 0.5 }); self.velocityY = 0; self.gravity = 0.5; self.jumpPower = -15; self.jump = function () { self.velocityY = self.jumpPower; LK.getSound('jump').play(); }; self.update = function () { self.velocityY += self.gravity; self.y += self.velocityY; }; return self; }); var HomeButton = Container.expand(function () { var self = Container.call(this); var buttonShape = self.attachAsset('homeButton', { anchorX: 0.5, anchorY: 0.5 }); var buttonText = new Text2("HOME", { size: 40, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function () { buttonShape.alpha = 0.7; LK.getSound('buttonClick').play(); }; self.up = function () { buttonShape.alpha = 1.0; switchToMainMenu(); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2C3E50 }); /**** * Game Code ****/ // Background music // Sound effects // CatNinja assets // CoinFlip assets // DoodleJump assets // Game state variables var currentScene = "mainMenu"; var currentGame = null; var dragNode = null; // Score variables var score = 0; var platformsPassed = 0; // Game-specific variables var platforms = []; var cucumbers = []; var coin = null; var player = null; var gameTimer = null; var coinFlipGuess = null; var coinFlipStreak = 0; // Game backgrounds and containers var mainMenuContainer = new Container(); var gameSelectionContainer = new Container(); var doodleJumpContainer = new Container(); var coinFlipContainer = new Container(); var catNinjaContainer = new Container(); function setupMainMenu() { var titleText = new Text2("MEME ARCADE MASHUP", { size: 100, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = 2048 / 2; titleText.y = 600; var startButton = new Button("START", 400, 150); startButton.x = 2048 / 2; startButton.y = 1300; startButton.up = function () { Button.prototype.up.call(this); switchToGameSelection(); }; mainMenuContainer.addChild(titleText); mainMenuContainer.addChild(startButton); LK.playMusic('menuMusic'); } function setupGameSelection() { var titleText = new Text2("SELECT A GAME", { size: 80, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = 2048 / 2; titleText.y = 300; var game1Button = new Button("Doodle Jump\nMeme Edition", 500, 350); game1Button.x = 2048 / 2; game1Button.y = 800; var game2Button = new Button("Coin Flip\nChallenge", 500, 350); game2Button.x = 2048 / 2; game2Button.y = 1300; var game3Button = new Button("Cat Ninja\nCucumber Escape", 500, 350); game3Button.x = 2048 / 2; game3Button.y = 1800; game1Button.up = function () { Button.prototype.up.call(this); startDoodleJump(); }; game2Button.up = function () { Button.prototype.up.call(this); startCoinFlip(); }; game3Button.up = function () { Button.prototype.up.call(this); startCatNinja(); }; gameSelectionContainer.addChild(titleText); gameSelectionContainer.addChild(game1Button); gameSelectionContainer.addChild(game2Button); gameSelectionContainer.addChild(game3Button); } // DoodleJump game implementation function setupDoodleJump() { var background = doodleJumpContainer.attachAsset('gameBackground', { anchorX: 0, anchorY: 0 }); var homeBtn = new HomeButton(); homeBtn.x = 150; homeBtn.y = 100; doodleJumpContainer.addChild(homeBtn); var scoreText = new Text2("Score: 0", { size: 50, fill: 0x000000 }); scoreText.anchor.set(0.5, 0); scoreText.x = 2048 / 2; scoreText.y = 50; doodleJumpContainer.addChild(scoreText); var highScoreText = new Text2("Best: " + storage.highScore1, { size: 30, fill: 0x000000 }); highScoreText.anchor.set(0.5, 0); highScoreText.x = 2048 / 2; highScoreText.y = 110; doodleJumpContainer.addChild(highScoreText); player = new DoodlePlayer(); player.x = 2048 / 2; player.y = 2000; doodleJumpContainer.addChild(player); // Generate initial platforms platforms = []; for (var i = 0; i < 10; i++) { var platform = new DoodlePlatform(Math.random() * 1800 + 100, 2600 - i * 250); platforms.push(platform); doodleJumpContainer.addChild(platform); } // First platform is directly under player platforms[0].x = player.x; platforms[0].y = player.y + 100; platforms[0].isMoving = false; score = 0; platformsPassed = 0; } function updateDoodleJump() { if (currentScene !== "doodleJump") { return; } player.update(); // Handle platform collision var onPlatform = false; for (var i = 0; i < platforms.length; i++) { var platform = platforms[i]; platform.update(); if (player.velocityY > 0 && player.y < platform.y && player.y + player.velocityY >= platform.y - 70 && Math.abs(player.x - platform.x) < 150) { player.y = platform.y - 70; player.jump(); onPlatform = true; } } // Handle screen wrapping for player if (player.x < 0) { player.x = 2048; } if (player.x > 2048) { player.x = 0; } // Scroll the world when player gets too high if (player.y < 1000) { var diff = 1000 - player.y; player.y = 1000; // Move platforms down for (var i = 0; i < platforms.length; i++) { platforms[i].y += diff; // If platform is off-screen, reposition it at the top if (platforms[i].y > 2732) { platforms[i].y = platforms[i].y - 2732; platforms[i].x = Math.random() * 1800 + 100; platforms[i].isMoving = Math.random() > 0.7; platformsPassed++; score = platformsPassed * 10; } } } // Handle game over if player falls off the bottom if (player.y > 2732) { // Update high score if (score > storage.highScore1) { storage.highScore1 = score; } LK.setScore(score); LK.showGameOver(); } // Update score display var scoreText = doodleJumpContainer.children[2]; scoreText.setText("Score: " + score); } // CoinFlip game implementation function setupCoinFlip() { var background = coinFlipContainer.attachAsset('gameBackground', { anchorX: 0, anchorY: 0 }); var homeBtn = new HomeButton(); homeBtn.x = 150; homeBtn.y = 100; coinFlipContainer.addChild(homeBtn); var titleText = new Text2("COIN FLIP CHALLENGE", { size: 70, fill: 0x000000 }); titleText.anchor.set(0.5, 0); titleText.x = 2048 / 2; titleText.y = 200; coinFlipContainer.addChild(titleText); var streakText = new Text2("Current Streak: 0", { size: 50, fill: 0x000000 }); streakText.anchor.set(0.5, 0); streakText.x = 2048 / 2; streakText.y = 300; coinFlipContainer.addChild(streakText); var highScoreText = new Text2("Best Streak: " + storage.highScore2, { size: 30, fill: 0x000000 }); highScoreText.anchor.set(0.5, 0); highScoreText.x = 2048 / 2; highScoreText.y = 360; coinFlipContainer.addChild(highScoreText); coin = new Coin(); coin.x = 2048 / 2; coin.y = 900; coinFlipContainer.addChild(coin); var instructionText = new Text2("Select your guess before flipping", { size: 40, fill: 0x000000 }); instructionText.anchor.set(0.5, 0); instructionText.x = 2048 / 2; instructionText.y = 1200; coinFlipContainer.addChild(instructionText); var headsButton = new Button("HEADS", 300, 150); headsButton.x = 2048 / 2 - 200; headsButton.y = 1400; coinFlipContainer.addChild(headsButton); var tailsButton = new Button("TAILS", 300, 150); tailsButton.x = 2048 / 2 + 200; tailsButton.y = 1400; coinFlipContainer.addChild(tailsButton); var flipButton = new Button("FLIP COIN", 400, 150); flipButton.x = 2048 / 2; flipButton.y = 1600; coinFlipContainer.addChild(flipButton); var resultText = new Text2("", { size: 60, fill: 0x000000 }); resultText.anchor.set(0.5, 0); resultText.x = 2048 / 2; resultText.y = 1800; coinFlipContainer.addChild(resultText); headsButton.up = function () { Button.prototype.up.call(this); coinFlipGuess = true; instructionText.setText("You chose: HEADS"); }; tailsButton.up = function () { Button.prototype.up.call(this); coinFlipGuess = false; instructionText.setText("You chose: TAILS"); }; flipButton.up = function () { Button.prototype.up.call(this); if (coinFlipGuess === null) { instructionText.setText("Please select HEADS or TAILS first!"); return; } if (coin.isFlipping) { return; } coin.flip(); LK.setTimeout(function () { var result = coin.isHeads; var correct = coinFlipGuess === result; if (correct) { resultText.setText("CORRECT!"); resultText.style.fill = "#27AE60"; coinFlipStreak++; LK.getSound('collect').play(); if (coinFlipStreak > storage.highScore2) { storage.highScore2 = coinFlipStreak; highScoreText.setText("Best Streak: " + storage.highScore2); } } else { resultText.setText("WRONG! You lost your streak!"); resultText.style.fill = "#E74C3C"; LK.setScore(coinFlipStreak); coinFlipStreak = 0; } streakText.setText("Current Streak: " + coinFlipStreak); coinFlipGuess = null; instructionText.setText("Select your guess before flipping"); }, 1500); }; coinFlipStreak = 0; } // CatNinja game implementation function setupCatNinja() { var background = catNinjaContainer.attachAsset('gameBackground', { anchorX: 0, anchorY: 0 }); var homeBtn = new HomeButton(); homeBtn.x = 150; homeBtn.y = 100; catNinjaContainer.addChild(homeBtn); var scoreText = new Text2("Score: 0", { size: 50, fill: 0x000000 }); scoreText.anchor.set(0.5, 0); scoreText.x = 2048 / 2; scoreText.y = 50; catNinjaContainer.addChild(scoreText); var livesText = new Text2("Lives: 3", { size: 50, fill: 0x000000 }); livesText.anchor.set(0, 0); livesText.x = 1600; livesText.y = 50; catNinjaContainer.addChild(livesText); var highScoreText = new Text2("Best: " + storage.highScore3, { size: 30, fill: 0x000000 }); highScoreText.anchor.set(0.5, 0); highScoreText.x = 2048 / 2; highScoreText.y = 110; catNinjaContainer.addChild(highScoreText); var instructionText = new Text2("SWIPE TO SLASH CUCUMBERS!", { size: 40, fill: 0x000000 }); instructionText.anchor.set(0.5, 0); instructionText.x = 2048 / 2; instructionText.y = 200; catNinjaContainer.addChild(instructionText); player = new CatPlayer(); player.x = 2048 / 2; player.y = 2200; catNinjaContainer.addChild(player); cucumbers = []; gameTimer = LK.setInterval(function () { spawnCucumber(); }, 1000); } function spawnCucumber() { if (currentScene !== "catNinja") { return; } var cucumber = new Cucumber(); cucumber.x = Math.random() * 1800 + 100; cucumber.y = -200; cucumbers.push(cucumber); catNinjaContainer.addChild(cucumber); } function updateCatNinja() { if (currentScene !== "catNinja") { return; } for (var i = cucumbers.length - 1; i >= 0; i--) { var cucumber = cucumbers[i]; cucumber.update(); // Remove cucumber if it goes off screen if (cucumber.y > 2900) { catNinjaContainer.removeChild(cucumber); cucumbers.splice(i, 1); // Player loses a life if cucumber not slashed player.lives--; catNinjaContainer.children[2].setText("Lives: " + player.lives); if (player.lives <= 0) { // Game over LK.clearInterval(gameTimer); if (player.score > storage.highScore3) { storage.highScore3 = player.score; } LK.setScore(player.score); LK.showGameOver(); } } } // Update score display catNinjaContainer.children[1].setText("Score: " + player.score); } // Scene management functions function switchToMainMenu() { clearCurrentScene(); currentScene = "mainMenu"; game.addChild(mainMenuContainer); LK.playMusic('menuMusic'); } function switchToGameSelection() { clearCurrentScene(); currentScene = "gameSelection"; game.addChild(gameSelectionContainer); } function startDoodleJump() { clearCurrentScene(); currentScene = "doodleJump"; setupDoodleJump(); game.addChild(doodleJumpContainer); LK.playMusic('gameMusic'); } function startCoinFlip() { clearCurrentScene(); currentScene = "coinFlip"; setupCoinFlip(); game.addChild(coinFlipContainer); LK.playMusic('gameMusic'); } function startCatNinja() { clearCurrentScene(); currentScene = "catNinja"; setupCatNinja(); game.addChild(catNinjaContainer); LK.playMusic('gameMusic'); } function clearCurrentScene() { if (gameTimer) { LK.clearInterval(gameTimer); gameTimer = null; } game.removeChildren(); if (currentScene === "doodleJump") { // Clean up doodleJump specific resources platforms = []; } else if (currentScene === "catNinja") { // Clean up catNinja specific resources cucumbers = []; } } // Input handling game.down = function (x, y, obj) { if (currentScene === "doodleJump") { dragNode = player; } else if (currentScene === "catNinja") { // Start tracking swipe for cat ninja dragNode = { startX: x, startY: y, startTime: Date.now() }; } }; game.up = function (x, y, obj) { if (currentScene === "catNinja" && dragNode) { // Calculate swipe var dx = x - dragNode.startX; var dy = y - dragNode.startY; var distance = Math.sqrt(dx * dx + dy * dy); var time = Date.now() - dragNode.startTime; // If it's a fast swipe (speed threshold) if (distance > 100 && time < 300) { var angle = Math.atan2(dy, dx); // Check for cucumber slashes for (var i = cucumbers.length - 1; i >= 0; i--) { var cucumber = cucumbers[i]; // Simple line intersection with cucumber boundary var hit = false; var mx = dragNode.startX + (x - dragNode.startX) * 0.5; var my = dragNode.startY + (y - dragNode.startY) * 0.5; if (Math.abs(mx - cucumber.x) < 100 && Math.abs(my - cucumber.y) < 150) { hit = true; } if (hit) { player.slash(cucumber); catNinjaContainer.removeChild(cucumber); cucumbers.splice(i, 1); } } } } dragNode = null; }; game.move = function (x, y, obj) { if (currentScene === "doodleJump" && dragNode) { dragNode.x = x; } }; // Main game update loop game.update = function () { if (currentScene === "doodleJump") { updateDoodleJump(); } else if (currentScene === "catNinja") { updateCatNinja(); } }; // Initialize game setupMainMenu(); setupGameSelection(); switchToMainMenu();
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,673 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1", {
+ highScore1: 0,
+ highScore2: 0,
+ highScore3: 0
+});
+
+/****
+* Classes
+****/
+var Button = Container.expand(function (text, width, height) {
+ var self = Container.call(this);
+ var buttonShape = self.attachAsset('selectionButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: width || 400,
+ height: height || 300
+ });
+ var buttonText = new Text2(text, {
+ size: 50,
+ fill: 0xFFFFFF
+ });
+ buttonText.anchor.set(0.5, 0.5);
+ self.addChild(buttonText);
+ self.down = function () {
+ buttonShape.alpha = 0.7;
+ LK.getSound('buttonClick').play();
+ };
+ self.up = function () {
+ buttonShape.alpha = 1.0;
+ };
+ return self;
+});
+// CatNinja classes
+var CatPlayer = Container.expand(function () {
+ var self = Container.call(this);
+ var playerGraphics = self.attachAsset('catPlayer', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.score = 0;
+ self.lives = 3;
+ self.slash = function (cucumber) {
+ LK.getSound('slice').play();
+ LK.effects.flashObject(cucumber, 0xFFFFFF, 300);
+ self.score += 1;
+ return true;
+ };
+ return self;
+});
+// CoinFlip classes
+var Coin = Container.expand(function () {
+ var self = Container.call(this);
+ var coinGraphics = self.attachAsset('coin', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.isHeads = true;
+ self.isFlipping = false;
+ self.flip = function () {
+ if (self.isFlipping) {
+ return;
+ }
+ self.isFlipping = true;
+ LK.getSound('flip').play();
+ var flips = Math.floor(Math.random() * 10) + 5;
+ var flipDuration = 1500;
+ function doFlip(flipsLeft) {
+ if (flipsLeft <= 0) {
+ self.isFlipping = false;
+ self.isHeads = Math.random() >= 0.5;
+ return;
+ }
+ tween(coinGraphics, {
+ scaleX: 0
+ }, {
+ duration: flipDuration / (flipsLeft * 2),
+ onFinish: function onFinish() {
+ self.isHeads = !self.isHeads;
+ coinGraphics.tint = self.isHeads ? 0xF1C40F : 0xE67E22;
+ tween(coinGraphics, {
+ scaleX: 1
+ }, {
+ duration: flipDuration / (flipsLeft * 2),
+ onFinish: function onFinish() {
+ doFlip(flipsLeft - 1);
+ }
+ });
+ }
+ });
+ }
+ doFlip(flips);
+ };
+ return self;
+});
+var Cucumber = Container.expand(function () {
+ var self = Container.call(this);
+ var cucumberGraphics = self.attachAsset('cucumber', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = Math.random() * 5 + 5;
+ self.rotationSpeed = (Math.random() - 0.5) * 0.2;
+ self.update = function () {
+ self.y += self.speed;
+ self.rotation += self.rotationSpeed;
+ };
+ return self;
+});
+var DoodlePlatform = Container.expand(function (x, y) {
+ var self = Container.call(this);
+ var platformGraphics = self.attachAsset('doodlePlatform', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.x = x;
+ self.y = y;
+ self.speed = 0;
+ self.isMoving = Math.random() > 0.7;
+ if (self.isMoving) {
+ self.speed = Math.random() * 4 + 2;
+ self.direction = Math.random() > 0.5 ? 1 : -1;
+ platformGraphics.tint = 0xE74C3C;
+ }
+ self.update = function () {
+ if (self.isMoving) {
+ self.x += self.speed * self.direction;
+ if (self.x > 1900 || self.x < 150) {
+ self.direction *= -1;
+ }
+ }
+ };
+ return self;
+});
+// DoodleJump classes
+var DoodlePlayer = Container.expand(function () {
+ var self = Container.call(this);
+ var playerGraphics = self.attachAsset('doodlePlayer', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.velocityY = 0;
+ self.gravity = 0.5;
+ self.jumpPower = -15;
+ self.jump = function () {
+ self.velocityY = self.jumpPower;
+ LK.getSound('jump').play();
+ };
+ self.update = function () {
+ self.velocityY += self.gravity;
+ self.y += self.velocityY;
+ };
+ return self;
+});
+var HomeButton = Container.expand(function () {
+ var self = Container.call(this);
+ var buttonShape = self.attachAsset('homeButton', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var buttonText = new Text2("HOME", {
+ size: 40,
+ fill: 0xFFFFFF
+ });
+ buttonText.anchor.set(0.5, 0.5);
+ self.addChild(buttonText);
+ self.down = function () {
+ buttonShape.alpha = 0.7;
+ LK.getSound('buttonClick').play();
+ };
+ self.up = function () {
+ buttonShape.alpha = 1.0;
+ switchToMainMenu();
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x2C3E50
+});
+
+/****
+* Game Code
+****/
+// Background music
+// Sound effects
+// CatNinja assets
+// CoinFlip assets
+// DoodleJump assets
+// Game state variables
+var currentScene = "mainMenu";
+var currentGame = null;
+var dragNode = null;
+// Score variables
+var score = 0;
+var platformsPassed = 0;
+// Game-specific variables
+var platforms = [];
+var cucumbers = [];
+var coin = null;
+var player = null;
+var gameTimer = null;
+var coinFlipGuess = null;
+var coinFlipStreak = 0;
+// Game backgrounds and containers
+var mainMenuContainer = new Container();
+var gameSelectionContainer = new Container();
+var doodleJumpContainer = new Container();
+var coinFlipContainer = new Container();
+var catNinjaContainer = new Container();
+function setupMainMenu() {
+ var titleText = new Text2("MEME ARCADE MASHUP", {
+ size: 100,
+ fill: 0xFFFFFF
+ });
+ titleText.anchor.set(0.5, 0.5);
+ titleText.x = 2048 / 2;
+ titleText.y = 600;
+ var startButton = new Button("START", 400, 150);
+ startButton.x = 2048 / 2;
+ startButton.y = 1300;
+ startButton.up = function () {
+ Button.prototype.up.call(this);
+ switchToGameSelection();
+ };
+ mainMenuContainer.addChild(titleText);
+ mainMenuContainer.addChild(startButton);
+ LK.playMusic('menuMusic');
+}
+function setupGameSelection() {
+ var titleText = new Text2("SELECT A GAME", {
+ size: 80,
+ fill: 0xFFFFFF
+ });
+ titleText.anchor.set(0.5, 0.5);
+ titleText.x = 2048 / 2;
+ titleText.y = 300;
+ var game1Button = new Button("Doodle Jump\nMeme Edition", 500, 350);
+ game1Button.x = 2048 / 2;
+ game1Button.y = 800;
+ var game2Button = new Button("Coin Flip\nChallenge", 500, 350);
+ game2Button.x = 2048 / 2;
+ game2Button.y = 1300;
+ var game3Button = new Button("Cat Ninja\nCucumber Escape", 500, 350);
+ game3Button.x = 2048 / 2;
+ game3Button.y = 1800;
+ game1Button.up = function () {
+ Button.prototype.up.call(this);
+ startDoodleJump();
+ };
+ game2Button.up = function () {
+ Button.prototype.up.call(this);
+ startCoinFlip();
+ };
+ game3Button.up = function () {
+ Button.prototype.up.call(this);
+ startCatNinja();
+ };
+ gameSelectionContainer.addChild(titleText);
+ gameSelectionContainer.addChild(game1Button);
+ gameSelectionContainer.addChild(game2Button);
+ gameSelectionContainer.addChild(game3Button);
+}
+// DoodleJump game implementation
+function setupDoodleJump() {
+ var background = doodleJumpContainer.attachAsset('gameBackground', {
+ anchorX: 0,
+ anchorY: 0
+ });
+ var homeBtn = new HomeButton();
+ homeBtn.x = 150;
+ homeBtn.y = 100;
+ doodleJumpContainer.addChild(homeBtn);
+ var scoreText = new Text2("Score: 0", {
+ size: 50,
+ fill: 0x000000
+ });
+ scoreText.anchor.set(0.5, 0);
+ scoreText.x = 2048 / 2;
+ scoreText.y = 50;
+ doodleJumpContainer.addChild(scoreText);
+ var highScoreText = new Text2("Best: " + storage.highScore1, {
+ size: 30,
+ fill: 0x000000
+ });
+ highScoreText.anchor.set(0.5, 0);
+ highScoreText.x = 2048 / 2;
+ highScoreText.y = 110;
+ doodleJumpContainer.addChild(highScoreText);
+ player = new DoodlePlayer();
+ player.x = 2048 / 2;
+ player.y = 2000;
+ doodleJumpContainer.addChild(player);
+ // Generate initial platforms
+ platforms = [];
+ for (var i = 0; i < 10; i++) {
+ var platform = new DoodlePlatform(Math.random() * 1800 + 100, 2600 - i * 250);
+ platforms.push(platform);
+ doodleJumpContainer.addChild(platform);
+ }
+ // First platform is directly under player
+ platforms[0].x = player.x;
+ platforms[0].y = player.y + 100;
+ platforms[0].isMoving = false;
+ score = 0;
+ platformsPassed = 0;
+}
+function updateDoodleJump() {
+ if (currentScene !== "doodleJump") {
+ return;
+ }
+ player.update();
+ // Handle platform collision
+ var onPlatform = false;
+ for (var i = 0; i < platforms.length; i++) {
+ var platform = platforms[i];
+ platform.update();
+ if (player.velocityY > 0 && player.y < platform.y && player.y + player.velocityY >= platform.y - 70 && Math.abs(player.x - platform.x) < 150) {
+ player.y = platform.y - 70;
+ player.jump();
+ onPlatform = true;
+ }
+ }
+ // Handle screen wrapping for player
+ if (player.x < 0) {
+ player.x = 2048;
+ }
+ if (player.x > 2048) {
+ player.x = 0;
+ }
+ // Scroll the world when player gets too high
+ if (player.y < 1000) {
+ var diff = 1000 - player.y;
+ player.y = 1000;
+ // Move platforms down
+ for (var i = 0; i < platforms.length; i++) {
+ platforms[i].y += diff;
+ // If platform is off-screen, reposition it at the top
+ if (platforms[i].y > 2732) {
+ platforms[i].y = platforms[i].y - 2732;
+ platforms[i].x = Math.random() * 1800 + 100;
+ platforms[i].isMoving = Math.random() > 0.7;
+ platformsPassed++;
+ score = platformsPassed * 10;
+ }
+ }
+ }
+ // Handle game over if player falls off the bottom
+ if (player.y > 2732) {
+ // Update high score
+ if (score > storage.highScore1) {
+ storage.highScore1 = score;
+ }
+ LK.setScore(score);
+ LK.showGameOver();
+ }
+ // Update score display
+ var scoreText = doodleJumpContainer.children[2];
+ scoreText.setText("Score: " + score);
+}
+// CoinFlip game implementation
+function setupCoinFlip() {
+ var background = coinFlipContainer.attachAsset('gameBackground', {
+ anchorX: 0,
+ anchorY: 0
+ });
+ var homeBtn = new HomeButton();
+ homeBtn.x = 150;
+ homeBtn.y = 100;
+ coinFlipContainer.addChild(homeBtn);
+ var titleText = new Text2("COIN FLIP CHALLENGE", {
+ size: 70,
+ fill: 0x000000
+ });
+ titleText.anchor.set(0.5, 0);
+ titleText.x = 2048 / 2;
+ titleText.y = 200;
+ coinFlipContainer.addChild(titleText);
+ var streakText = new Text2("Current Streak: 0", {
+ size: 50,
+ fill: 0x000000
+ });
+ streakText.anchor.set(0.5, 0);
+ streakText.x = 2048 / 2;
+ streakText.y = 300;
+ coinFlipContainer.addChild(streakText);
+ var highScoreText = new Text2("Best Streak: " + storage.highScore2, {
+ size: 30,
+ fill: 0x000000
+ });
+ highScoreText.anchor.set(0.5, 0);
+ highScoreText.x = 2048 / 2;
+ highScoreText.y = 360;
+ coinFlipContainer.addChild(highScoreText);
+ coin = new Coin();
+ coin.x = 2048 / 2;
+ coin.y = 900;
+ coinFlipContainer.addChild(coin);
+ var instructionText = new Text2("Select your guess before flipping", {
+ size: 40,
+ fill: 0x000000
+ });
+ instructionText.anchor.set(0.5, 0);
+ instructionText.x = 2048 / 2;
+ instructionText.y = 1200;
+ coinFlipContainer.addChild(instructionText);
+ var headsButton = new Button("HEADS", 300, 150);
+ headsButton.x = 2048 / 2 - 200;
+ headsButton.y = 1400;
+ coinFlipContainer.addChild(headsButton);
+ var tailsButton = new Button("TAILS", 300, 150);
+ tailsButton.x = 2048 / 2 + 200;
+ tailsButton.y = 1400;
+ coinFlipContainer.addChild(tailsButton);
+ var flipButton = new Button("FLIP COIN", 400, 150);
+ flipButton.x = 2048 / 2;
+ flipButton.y = 1600;
+ coinFlipContainer.addChild(flipButton);
+ var resultText = new Text2("", {
+ size: 60,
+ fill: 0x000000
+ });
+ resultText.anchor.set(0.5, 0);
+ resultText.x = 2048 / 2;
+ resultText.y = 1800;
+ coinFlipContainer.addChild(resultText);
+ headsButton.up = function () {
+ Button.prototype.up.call(this);
+ coinFlipGuess = true;
+ instructionText.setText("You chose: HEADS");
+ };
+ tailsButton.up = function () {
+ Button.prototype.up.call(this);
+ coinFlipGuess = false;
+ instructionText.setText("You chose: TAILS");
+ };
+ flipButton.up = function () {
+ Button.prototype.up.call(this);
+ if (coinFlipGuess === null) {
+ instructionText.setText("Please select HEADS or TAILS first!");
+ return;
+ }
+ if (coin.isFlipping) {
+ return;
+ }
+ coin.flip();
+ LK.setTimeout(function () {
+ var result = coin.isHeads;
+ var correct = coinFlipGuess === result;
+ if (correct) {
+ resultText.setText("CORRECT!");
+ resultText.style.fill = "#27AE60";
+ coinFlipStreak++;
+ LK.getSound('collect').play();
+ if (coinFlipStreak > storage.highScore2) {
+ storage.highScore2 = coinFlipStreak;
+ highScoreText.setText("Best Streak: " + storage.highScore2);
+ }
+ } else {
+ resultText.setText("WRONG! You lost your streak!");
+ resultText.style.fill = "#E74C3C";
+ LK.setScore(coinFlipStreak);
+ coinFlipStreak = 0;
+ }
+ streakText.setText("Current Streak: " + coinFlipStreak);
+ coinFlipGuess = null;
+ instructionText.setText("Select your guess before flipping");
+ }, 1500);
+ };
+ coinFlipStreak = 0;
+}
+// CatNinja game implementation
+function setupCatNinja() {
+ var background = catNinjaContainer.attachAsset('gameBackground', {
+ anchorX: 0,
+ anchorY: 0
+ });
+ var homeBtn = new HomeButton();
+ homeBtn.x = 150;
+ homeBtn.y = 100;
+ catNinjaContainer.addChild(homeBtn);
+ var scoreText = new Text2("Score: 0", {
+ size: 50,
+ fill: 0x000000
+ });
+ scoreText.anchor.set(0.5, 0);
+ scoreText.x = 2048 / 2;
+ scoreText.y = 50;
+ catNinjaContainer.addChild(scoreText);
+ var livesText = new Text2("Lives: 3", {
+ size: 50,
+ fill: 0x000000
+ });
+ livesText.anchor.set(0, 0);
+ livesText.x = 1600;
+ livesText.y = 50;
+ catNinjaContainer.addChild(livesText);
+ var highScoreText = new Text2("Best: " + storage.highScore3, {
+ size: 30,
+ fill: 0x000000
+ });
+ highScoreText.anchor.set(0.5, 0);
+ highScoreText.x = 2048 / 2;
+ highScoreText.y = 110;
+ catNinjaContainer.addChild(highScoreText);
+ var instructionText = new Text2("SWIPE TO SLASH CUCUMBERS!", {
+ size: 40,
+ fill: 0x000000
+ });
+ instructionText.anchor.set(0.5, 0);
+ instructionText.x = 2048 / 2;
+ instructionText.y = 200;
+ catNinjaContainer.addChild(instructionText);
+ player = new CatPlayer();
+ player.x = 2048 / 2;
+ player.y = 2200;
+ catNinjaContainer.addChild(player);
+ cucumbers = [];
+ gameTimer = LK.setInterval(function () {
+ spawnCucumber();
+ }, 1000);
+}
+function spawnCucumber() {
+ if (currentScene !== "catNinja") {
+ return;
+ }
+ var cucumber = new Cucumber();
+ cucumber.x = Math.random() * 1800 + 100;
+ cucumber.y = -200;
+ cucumbers.push(cucumber);
+ catNinjaContainer.addChild(cucumber);
+}
+function updateCatNinja() {
+ if (currentScene !== "catNinja") {
+ return;
+ }
+ for (var i = cucumbers.length - 1; i >= 0; i--) {
+ var cucumber = cucumbers[i];
+ cucumber.update();
+ // Remove cucumber if it goes off screen
+ if (cucumber.y > 2900) {
+ catNinjaContainer.removeChild(cucumber);
+ cucumbers.splice(i, 1);
+ // Player loses a life if cucumber not slashed
+ player.lives--;
+ catNinjaContainer.children[2].setText("Lives: " + player.lives);
+ if (player.lives <= 0) {
+ // Game over
+ LK.clearInterval(gameTimer);
+ if (player.score > storage.highScore3) {
+ storage.highScore3 = player.score;
+ }
+ LK.setScore(player.score);
+ LK.showGameOver();
+ }
+ }
+ }
+ // Update score display
+ catNinjaContainer.children[1].setText("Score: " + player.score);
+}
+// Scene management functions
+function switchToMainMenu() {
+ clearCurrentScene();
+ currentScene = "mainMenu";
+ game.addChild(mainMenuContainer);
+ LK.playMusic('menuMusic');
+}
+function switchToGameSelection() {
+ clearCurrentScene();
+ currentScene = "gameSelection";
+ game.addChild(gameSelectionContainer);
+}
+function startDoodleJump() {
+ clearCurrentScene();
+ currentScene = "doodleJump";
+ setupDoodleJump();
+ game.addChild(doodleJumpContainer);
+ LK.playMusic('gameMusic');
+}
+function startCoinFlip() {
+ clearCurrentScene();
+ currentScene = "coinFlip";
+ setupCoinFlip();
+ game.addChild(coinFlipContainer);
+ LK.playMusic('gameMusic');
+}
+function startCatNinja() {
+ clearCurrentScene();
+ currentScene = "catNinja";
+ setupCatNinja();
+ game.addChild(catNinjaContainer);
+ LK.playMusic('gameMusic');
+}
+function clearCurrentScene() {
+ if (gameTimer) {
+ LK.clearInterval(gameTimer);
+ gameTimer = null;
+ }
+ game.removeChildren();
+ if (currentScene === "doodleJump") {
+ // Clean up doodleJump specific resources
+ platforms = [];
+ } else if (currentScene === "catNinja") {
+ // Clean up catNinja specific resources
+ cucumbers = [];
+ }
+}
+// Input handling
+game.down = function (x, y, obj) {
+ if (currentScene === "doodleJump") {
+ dragNode = player;
+ } else if (currentScene === "catNinja") {
+ // Start tracking swipe for cat ninja
+ dragNode = {
+ startX: x,
+ startY: y,
+ startTime: Date.now()
+ };
+ }
+};
+game.up = function (x, y, obj) {
+ if (currentScene === "catNinja" && dragNode) {
+ // Calculate swipe
+ var dx = x - dragNode.startX;
+ var dy = y - dragNode.startY;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ var time = Date.now() - dragNode.startTime;
+ // If it's a fast swipe (speed threshold)
+ if (distance > 100 && time < 300) {
+ var angle = Math.atan2(dy, dx);
+ // Check for cucumber slashes
+ for (var i = cucumbers.length - 1; i >= 0; i--) {
+ var cucumber = cucumbers[i];
+ // Simple line intersection with cucumber boundary
+ var hit = false;
+ var mx = dragNode.startX + (x - dragNode.startX) * 0.5;
+ var my = dragNode.startY + (y - dragNode.startY) * 0.5;
+ if (Math.abs(mx - cucumber.x) < 100 && Math.abs(my - cucumber.y) < 150) {
+ hit = true;
+ }
+ if (hit) {
+ player.slash(cucumber);
+ catNinjaContainer.removeChild(cucumber);
+ cucumbers.splice(i, 1);
+ }
+ }
+ }
+ }
+ dragNode = null;
+};
+game.move = function (x, y, obj) {
+ if (currentScene === "doodleJump" && dragNode) {
+ dragNode.x = x;
+ }
+};
+// Main game update loop
+game.update = function () {
+ if (currentScene === "doodleJump") {
+ updateDoodleJump();
+ } else if (currentScene === "catNinja") {
+ updateCatNinja();
+ }
+};
+// Initialize game
+setupMainMenu();
+setupGameSelection();
+switchToMainMenu();
\ No newline at end of file
a ’90s-retro living room: bean-bag, Super Nintendo wired to the tube TV, “3-in-1 Meme Games” written on-screen, while a mix of meme characters crash the couch mashing SNES controllers wired to the super nintendo. In-Game asset. 2d. High contrast. No shadows
retro tube tv with crt scan lines. add a living room background behind the tv, front facing so i can use it as a menu selection screen In-Game asset. 2d. High contrast. No shadows
pointing soyjak meme. In-Game asset. 2d. High contrast. No shadows
hedgehog running fast meme. In-Game asset. 2d. High contrast. No shadows
trollface. In-Game asset. 2d. High contrast. No shadows
doge. In-Game asset. 2d. High contrast. No shadows
fluffy tail. In-Game asset. 2d. High contrast. No shadows
pepe frog. In-Game asset. 2d. High contrast. No shadows
running pepe frog. In-Game asset. 2d. High contrast. No shadows
3d button empty. In-Game asset. 2d. High contrast. No shadows
keyboard cat meme. In-Game asset. 2d. High contrast. No shadows
shiba inu coin. In-Game asset. 2d. High contrast. No shadows