User prompt
In triggerEvent(), after attachAsset and before adding fx to the container, capture the base scale: var baseSX = fx.scale.x; var baseSY = fx.scale.y; Compute a random increase between 1% and 25%: var inc = 0.01 + Math.random() * 0.24; // anywhere from 0.01 to 0.25 var scaleFactor = 1 + inc; // final multiplier Use that scaleFactor in the pulse tween: tween(fx.scale, { x: baseSX * scaleFactor, y: baseSY * scaleFactor }, { duration: 1000, yoyo: true, repeat: 1 });
User prompt
Remove the hard-coded center coordinates: // delete these lines fx.x = 1024; fx.y = 1366; Compute random positions within the game’s bounds (e.g. 0–2048 wide, 0–2732 tall): var maxX = 2048; var maxY = 2732; fx.x = Math.random() * maxX; fx.y = Math.random() * maxY; Add margins so it never spawns half-offscreen: var margin = 100; // half of your effect’s max dimension fx.x = margin + Math.random() * (maxX - margin*2); fx.y = margin + Math.random() * (maxY - margin*2);
User prompt
Create a scheduler function: function scheduleRandomEvent() { // pick a delay between 5 000 and 8 000 ms var delay = 5000 + Math.random() * 3000; LK.setTimeout(() => { triggerEvent(); scheduleRandomEvent(); // loop }, delay); } Define the event spawner: function triggerEvent() { // create a temporary sprite (use any shape or asset you like) var fx = new Container(); var gfx = fx.attachAsset('selectionButton', { anchorX: 0.5, anchorY: 0.5, width:200, height:200 }); fx.x = 1024; // center X fx.y = 1366; // center Y flipRunnerContainer.addChild(fx); // pick spin or pulse at random if (Math.random() < 0.5) { // spin for 2s tween(fx, { rotation: Math.PI*2 }, { duration:2000 }); } else { // grow & shrink for 2s tween(fx.scale, { x:1.5, y:1.5 }, { duration:1000, yoyo: true, repeat: 1 }); } // remove after 2s LK.setTimeout(() => { flipRunnerContainer.removeChild(fx); }, 2000); } Kick off the loop in the setup: function setupFlipRunner() { // ... existing setup ... scheduleRandomEvent(); } ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Delete the HomeButton lines: var homeBtn = new HomeButton(); homeBtn.x = 150; homeBtn.y = 100; ... flipRunnerContainer.addChild(homeBtn);
User prompt
Delete the HomeButton lines: var homeBtn = new HomeButton(); homeBtn.x = 150; homeBtn.y = 100; ... flipRunnerContainer.addChild(homeBtn);
User prompt
In FlipRunnerTunnel.update(), after recalculating wall heights, expose the gap edges: this.topY = this.topWall.height; this.bottomY = this.bottomWall.y - this.bottomWall.height; In setupFlipRunner(), remove the hard-coded player.y = 600; (let the update loop place it). In updateFlipRunner(), immediately after flipTunnel.update();, add: // reposition player to follow the shrinking tunnel var halfPlayer = 60; // half of your catPlayer height (120/2) player.y = player.polarity > 0 ? flipTunnel.topY + halfPlayer : flipTunnel.bottomY - halfPlayer; In spawnObstacle(), replace the fixed y-position with a dynamic one: // decide top or bottom path var isTop = Math.random() > 0.5; var halfObs = 20; // half of obstacle height (40/2) var yPos = isTop ? flipTunnel.topY + halfObs : flipTunnel.bottomY - halfObs; var obstacle = new FlipRunnerObstacle(yPos, tunnelSpeed);
User prompt
Please fix the bug: 'TypeError: highScoreText.setText is not a function' in or related to this line: 'highScoreText.setText("Best: " + storage.highScoreFlipRunner);' Line Number: 844
User prompt
Declare a global flipTunnel variable at the top of the file. In setupFlipRunner(), replace: var tunnel = new FlipRunnerTunnel(); flipRunnerContainer.addChild(tunnel); with: flipTunnel = new FlipRunnerTunnel(); flipRunnerContainer.addChild(flipTunnel); In FlipRunnerTunnel class, after attaching the two wall sprites, add: this.topWall = topWall; this.bottomWall = bottomWall; this.initialGap = bottomWall.y - bottomWall.height - topWall.height; this.gap = this.initialGap; this.shrinkRate = 0.1; // pixels per frame (tweak as desired) this.update = function() { // shrink the gap, but don’t go below 400px this.gap = Math.max(400, this.gap - this.shrinkRate); // recalc each wall’s height so the total gap is correct var newWallHeight = (2732 - this.gap) / 2; this.topWall.height = newWallHeight; this.bottomWall.height = newWallHeight; this.bottomWall.y = 2732; // anchorY=1 keeps it flush to bottom } In updateFlipRunner(), at the very top, call: flipTunnel.update(); before updating the player or loop over obstacles.
User prompt
Create A new global flipScoreText variable to hold the score display. In setupFlipRunner(), add the tunnel and player before the UI. Save scoreText into flipScoreText. In updateFlipRunner(), call flipScoreText.setText(...) directly each frame.
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
/**** * 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; }); // Add prototype method for Button so Button.prototype.up can be called // 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 FlipRunnerObstacle = Container.expand(function (yPosition, speed) { var self = Container.call(this); var obstacleGraphics = self.attachAsset('doodlePlatform', { anchorX: 0.5, anchorY: 0.5, width: 100, height: 40 }); self.polarity = yPosition > 1366 ? -1 : 1; // Determines if obstacle is on top or bottom self.speed = speed || 15; self.x = 2200; // Start just off-screen self.y = yPosition; // Color based on polarity obstacleGraphics.tint = self.polarity > 0 ? 0x27ae60 : 0xe74c3c; self.update = function () { self.x -= self.speed; }; return self; }); var FlipRunnerPlayer = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('catPlayer', { anchorX: 0.5, anchorY: 0.5 }); self.polarity = 1; // 1 for top, -1 for bottom self.speed = 10; self.score = 0; self.isAlive = true; self.flip = function () { if (!self.isAlive) { return; } self.polarity *= -1; LK.getSound('flip').play(); // Animate the flip tween(self, { y: self.polarity > 0 ? 600 : 2132 }, { duration: 300, easing: tween.bounceOut }); // Visual effect when flipping tween(playerGraphics, { rotation: self.polarity > 0 ? 0 : Math.PI }, { duration: 300, easing: tween.bounceOut }); }; self.update = function () { self.score += 0.1; }; self.die = function () { if (!self.isAlive) { return; } self.isAlive = false; LK.effects.flashObject(self, 0xFF0000, 500); }; return self; }); var FlipRunnerTunnel = Container.expand(function () { var self = Container.call(this); // Top wall var topWall = self.attachAsset('doodlePlatform', { anchorX: 0, anchorY: 0, width: 2048, height: 400 }); topWall.tint = 0x34495e; // Bottom wall var bottomWall = self.attachAsset('doodlePlatform', { anchorX: 0, anchorY: 1, width: 2048, height: 400 }); bottomWall.tint = 0x34495e; bottomWall.y = 2732; 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 ****/ // Add prototype method for Button so Button.prototype.up can be called // Background music // Sound effects // CatNinja assets // CoinFlip assets // DoodleJump assets // Game state variables Button.prototype.up = function () { this.children[0].alpha = 1.0; }; 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; var obstacles = []; var tunnelSpeed = 15; var lastObstacleTime = 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(); var flipRunnerContainer = 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("Flip Runner\nPolarity Shift", 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); startFlipRunner(); }; 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!"); if (resultText && resultText.style) { 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!"); if (resultText && resultText.style) { 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 var scoreText = catNinjaContainer.children[1]; if (scoreText && scoreText instanceof Text2) { scoreText.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 setupFlipRunner() { var background = flipRunnerContainer.attachAsset('gameBackground', { anchorX: 0, anchorY: 0 }); background.tint = 0x2c3e50; var homeBtn = new HomeButton(); homeBtn.x = 150; homeBtn.y = 100; flipRunnerContainer.addChild(homeBtn); var scoreText = new Text2("Score: 0", { size: 50, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); scoreText.x = 2048 / 2; scoreText.y = 50; flipRunnerContainer.addChild(scoreText); var highScoreText = new Text2("Best: " + (storage.highScoreFlipRunner || 0), { size: 30, fill: 0xFFFFFF }); highScoreText.anchor.set(0.5, 0); highScoreText.x = 2048 / 2; highScoreText.y = 110; flipRunnerContainer.addChild(highScoreText); var instructionText = new Text2("TAP TO FLIP POLARITY!", { size: 40, fill: 0xFFFFFF }); instructionText.anchor.set(0.5, 0); instructionText.x = 2048 / 2; instructionText.y = 200; flipRunnerContainer.addChild(instructionText); // Add tunnel var tunnel = new FlipRunnerTunnel(); flipRunnerContainer.addChild(tunnel); // Add player player = new FlipRunnerPlayer(); player.x = 500; player.y = 600; // Start at top path flipRunnerContainer.addChild(player); // Initialize obstacles array obstacles = []; tunnelSpeed = 15; lastObstacleTime = 0; // Start the obstacle spawner gameTimer = LK.setInterval(function () { if (tunnelSpeed < 30) { tunnelSpeed += 0.05; // Gradually increase speed } // Random obstacle generation if (Date.now() - lastObstacleTime > 800) { spawnObstacle(); lastObstacleTime = Date.now(); } }, 100); } function startFlipRunner() { clearCurrentScene(); currentScene = "flipRunner"; setupFlipRunner(); game.addChild(flipRunnerContainer); LK.playMusic('gameMusic'); } function spawnObstacle() { if (currentScene !== "flipRunner") { return; } // Decide obstacle position (top or bottom) var isTop = Math.random() > 0.5; var yPos = isTop ? 600 : 2132; var obstacle = new FlipRunnerObstacle(yPos, tunnelSpeed); obstacles.push(obstacle); flipRunnerContainer.addChild(obstacle); } function updateFlipRunner() { if (currentScene !== "flipRunner") { return; } // Update player if (player && player.isAlive) { player.update(); // Update score display var scoreText = flipRunnerContainer.children[1]; var score = Math.floor(player.score); scoreText.setText("Score: " + score); // Check for collisions for (var i = obstacles.length - 1; i >= 0; i--) { var obstacle = obstacles[i]; obstacle.update(); // Remove obstacles that have gone off-screen if (obstacle.x < -100) { flipRunnerContainer.removeChild(obstacle); obstacles.splice(i, 1); continue; } // Check for collision with player (same polarity) if (player.intersects(obstacle) && player.polarity === obstacle.polarity) { player.die(); // Update high score var score = Math.floor(player.score); if (!storage.highScoreFlipRunner || score > storage.highScoreFlipRunner) { storage.highScoreFlipRunner = score; var highScoreText = flipRunnerContainer.children[2]; highScoreText.setText("Best: " + storage.highScoreFlipRunner); } LK.setScore(score); LK.setTimeout(function () { LK.showGameOver(); }, 1000); } } } } 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 = []; } else if (currentScene === "flipRunner") { // Clean up flipRunner specific resources obstacles = []; } } // 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() }; } else if (currentScene === "flipRunner" && player && player.isAlive) { // Flip player polarity on tap player.flip(); } }; 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(); } else if (currentScene === "flipRunner") { updateFlipRunner(); } }; // Initialize game setupMainMenu(); setupGameSelection(); switchToMainMenu();
===================================================================
--- original.js
+++ change.js
@@ -155,8 +155,91 @@
self.y += self.velocityY;
};
return self;
});
+var FlipRunnerObstacle = Container.expand(function (yPosition, speed) {
+ var self = Container.call(this);
+ var obstacleGraphics = self.attachAsset('doodlePlatform', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 100,
+ height: 40
+ });
+ self.polarity = yPosition > 1366 ? -1 : 1; // Determines if obstacle is on top or bottom
+ self.speed = speed || 15;
+ self.x = 2200; // Start just off-screen
+ self.y = yPosition;
+ // Color based on polarity
+ obstacleGraphics.tint = self.polarity > 0 ? 0x27ae60 : 0xe74c3c;
+ self.update = function () {
+ self.x -= self.speed;
+ };
+ return self;
+});
+var FlipRunnerPlayer = Container.expand(function () {
+ var self = Container.call(this);
+ var playerGraphics = self.attachAsset('catPlayer', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.polarity = 1; // 1 for top, -1 for bottom
+ self.speed = 10;
+ self.score = 0;
+ self.isAlive = true;
+ self.flip = function () {
+ if (!self.isAlive) {
+ return;
+ }
+ self.polarity *= -1;
+ LK.getSound('flip').play();
+ // Animate the flip
+ tween(self, {
+ y: self.polarity > 0 ? 600 : 2132
+ }, {
+ duration: 300,
+ easing: tween.bounceOut
+ });
+ // Visual effect when flipping
+ tween(playerGraphics, {
+ rotation: self.polarity > 0 ? 0 : Math.PI
+ }, {
+ duration: 300,
+ easing: tween.bounceOut
+ });
+ };
+ self.update = function () {
+ self.score += 0.1;
+ };
+ self.die = function () {
+ if (!self.isAlive) {
+ return;
+ }
+ self.isAlive = false;
+ LK.effects.flashObject(self, 0xFF0000, 500);
+ };
+ return self;
+});
+var FlipRunnerTunnel = Container.expand(function () {
+ var self = Container.call(this);
+ // Top wall
+ var topWall = self.attachAsset('doodlePlatform', {
+ anchorX: 0,
+ anchorY: 0,
+ width: 2048,
+ height: 400
+ });
+ topWall.tint = 0x34495e;
+ // Bottom wall
+ var bottomWall = self.attachAsset('doodlePlatform', {
+ anchorX: 0,
+ anchorY: 1,
+ width: 2048,
+ height: 400
+ });
+ bottomWall.tint = 0x34495e;
+ bottomWall.y = 2732;
+ return self;
+});
var HomeButton = Container.expand(function () {
var self = Container.call(this);
var buttonShape = self.attachAsset('homeButton', {
anchorX: 0.5,
@@ -212,14 +295,18 @@
var player = null;
var gameTimer = null;
var coinFlipGuess = null;
var coinFlipStreak = 0;
+var obstacles = [];
+var tunnelSpeed = 15;
+var lastObstacleTime = 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();
+var flipRunnerContainer = new Container();
function setupMainMenu() {
var titleText = new Text2("MEME ARCADE MASHUP", {
size: 100,
fill: 0xFFFFFF
@@ -245,9 +332,9 @@
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 300;
- var game1Button = new Button("Doodle Jump\nMeme Edition", 500, 350);
+ var game1Button = new Button("Flip Runner\nPolarity Shift", 500, 350);
game1Button.x = 2048 / 2;
game1Button.y = 800;
var game2Button = new Button("Coin Flip\nChallenge", 500, 350);
game2Button.x = 2048 / 2;
@@ -256,9 +343,9 @@
game3Button.x = 2048 / 2;
game3Button.y = 1800;
game1Button.up = function () {
Button.prototype.up.call(this);
- startDoodleJump();
+ startFlipRunner();
};
game2Button.up = function () {
Button.prototype.up.call(this);
startCoinFlip();
@@ -608,8 +695,123 @@
setupCatNinja();
game.addChild(catNinjaContainer);
LK.playMusic('gameMusic');
}
+function setupFlipRunner() {
+ var background = flipRunnerContainer.attachAsset('gameBackground', {
+ anchorX: 0,
+ anchorY: 0
+ });
+ background.tint = 0x2c3e50;
+ var homeBtn = new HomeButton();
+ homeBtn.x = 150;
+ homeBtn.y = 100;
+ flipRunnerContainer.addChild(homeBtn);
+ var scoreText = new Text2("Score: 0", {
+ size: 50,
+ fill: 0xFFFFFF
+ });
+ scoreText.anchor.set(0.5, 0);
+ scoreText.x = 2048 / 2;
+ scoreText.y = 50;
+ flipRunnerContainer.addChild(scoreText);
+ var highScoreText = new Text2("Best: " + (storage.highScoreFlipRunner || 0), {
+ size: 30,
+ fill: 0xFFFFFF
+ });
+ highScoreText.anchor.set(0.5, 0);
+ highScoreText.x = 2048 / 2;
+ highScoreText.y = 110;
+ flipRunnerContainer.addChild(highScoreText);
+ var instructionText = new Text2("TAP TO FLIP POLARITY!", {
+ size: 40,
+ fill: 0xFFFFFF
+ });
+ instructionText.anchor.set(0.5, 0);
+ instructionText.x = 2048 / 2;
+ instructionText.y = 200;
+ flipRunnerContainer.addChild(instructionText);
+ // Add tunnel
+ var tunnel = new FlipRunnerTunnel();
+ flipRunnerContainer.addChild(tunnel);
+ // Add player
+ player = new FlipRunnerPlayer();
+ player.x = 500;
+ player.y = 600; // Start at top path
+ flipRunnerContainer.addChild(player);
+ // Initialize obstacles array
+ obstacles = [];
+ tunnelSpeed = 15;
+ lastObstacleTime = 0;
+ // Start the obstacle spawner
+ gameTimer = LK.setInterval(function () {
+ if (tunnelSpeed < 30) {
+ tunnelSpeed += 0.05; // Gradually increase speed
+ }
+ // Random obstacle generation
+ if (Date.now() - lastObstacleTime > 800) {
+ spawnObstacle();
+ lastObstacleTime = Date.now();
+ }
+ }, 100);
+}
+function startFlipRunner() {
+ clearCurrentScene();
+ currentScene = "flipRunner";
+ setupFlipRunner();
+ game.addChild(flipRunnerContainer);
+ LK.playMusic('gameMusic');
+}
+function spawnObstacle() {
+ if (currentScene !== "flipRunner") {
+ return;
+ }
+ // Decide obstacle position (top or bottom)
+ var isTop = Math.random() > 0.5;
+ var yPos = isTop ? 600 : 2132;
+ var obstacle = new FlipRunnerObstacle(yPos, tunnelSpeed);
+ obstacles.push(obstacle);
+ flipRunnerContainer.addChild(obstacle);
+}
+function updateFlipRunner() {
+ if (currentScene !== "flipRunner") {
+ return;
+ }
+ // Update player
+ if (player && player.isAlive) {
+ player.update();
+ // Update score display
+ var scoreText = flipRunnerContainer.children[1];
+ var score = Math.floor(player.score);
+ scoreText.setText("Score: " + score);
+ // Check for collisions
+ for (var i = obstacles.length - 1; i >= 0; i--) {
+ var obstacle = obstacles[i];
+ obstacle.update();
+ // Remove obstacles that have gone off-screen
+ if (obstacle.x < -100) {
+ flipRunnerContainer.removeChild(obstacle);
+ obstacles.splice(i, 1);
+ continue;
+ }
+ // Check for collision with player (same polarity)
+ if (player.intersects(obstacle) && player.polarity === obstacle.polarity) {
+ player.die();
+ // Update high score
+ var score = Math.floor(player.score);
+ if (!storage.highScoreFlipRunner || score > storage.highScoreFlipRunner) {
+ storage.highScoreFlipRunner = score;
+ var highScoreText = flipRunnerContainer.children[2];
+ highScoreText.setText("Best: " + storage.highScoreFlipRunner);
+ }
+ LK.setScore(score);
+ LK.setTimeout(function () {
+ LK.showGameOver();
+ }, 1000);
+ }
+ }
+ }
+}
function clearCurrentScene() {
if (gameTimer) {
LK.clearInterval(gameTimer);
gameTimer = null;
@@ -620,8 +822,11 @@
platforms = [];
} else if (currentScene === "catNinja") {
// Clean up catNinja specific resources
cucumbers = [];
+ } else if (currentScene === "flipRunner") {
+ // Clean up flipRunner specific resources
+ obstacles = [];
}
}
// Input handling
game.down = function (x, y, obj) {
@@ -633,8 +838,11 @@
startX: x,
startY: y,
startTime: Date.now()
};
+ } else if (currentScene === "flipRunner" && player && player.isAlive) {
+ // Flip player polarity on tap
+ player.flip();
}
};
game.up = function (x, y, obj) {
if (currentScene === "catNinja" && dragNode) {
@@ -676,8 +884,10 @@
if (currentScene === "doodleJump") {
updateDoodleJump();
} else if (currentScene === "catNinja") {
updateCatNinja();
+ } else if (currentScene === "flipRunner") {
+ updateFlipRunner();
}
};
// Initialize game
setupMainMenu();
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