User prompt
mejor quita todo y que se aun juego con minijeugos
User prompt
que el boton play cuando le des te mande a un menu que tenga 4 minijuegos
Code edit (1 edits merged)
Please save this source code
User prompt
Pet Care Buddy
User prompt
mejor un juego estilo pou
Initial prompt
un juego que sea un clicker
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var ActionButton = Container.expand(function (text, action) { var self = Container.call(this); var buttonBg = self.attachAsset('button', { anchorX: 0.5, anchorY: 0.5 }); var buttonText = new Text2(text, { size: 48, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.action = action; self.down = function (x, y, obj) { tween(self, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 100, easing: tween.easeOut }); } }); if (self.action) { self.action(); } }; return self; }); var Ball = Container.expand(function () { var self = Container.call(this); var ballGraphics = self.attachAsset('ball', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = 0; self.speedY = 0; self.update = function () { self.x += self.speedX; self.y += self.speedY; // Bounce off walls if (self.x <= 30 || self.x >= 2018) { self.speedX = -self.speedX; } if (self.y <= 30) { self.speedY = -self.speedY; } // Check if ball went off bottom if (self.y > 2732) { self.shouldDestroy = true; } }; return self; }); var Bird = Container.expand(function () { var self = Container.call(this); var birdGraphics = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5 }); self.speedY = 0; self.update = function () { self.speedY += 0.5; self.y += self.speedY; if (self.y > 2732) { self.shouldDestroy = true; } }; return self; }); var Block = Container.expand(function () { var self = Container.call(this); var blockGraphics = self.attachAsset('block', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Bomb = Container.expand(function () { var self = Container.call(this); var bombGraphics = self.attachAsset('bomb', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = (Math.random() - 0.5) * 8; self.speedY = -Math.random() * 8 - 5; self.gravity = 0.3; self.sliced = false; self.update = function () { self.x += self.speedX; self.y += self.speedY; self.speedY += self.gravity; // Make bombs spin bombGraphics.rotation += 0.1; if (self.y > 2800) { self.shouldDestroy = true; } }; self.down = function (x, y, obj) { if (!self.sliced) { self.sliced = true; LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('score').play(); self.shouldDestroy = true; // Spawn 3 fruits that launch very high when bomb explodes if (gameState === 'game17') { for (var i = 0; i < 3; i++) { var fruit = new Fruit(); fruit.x = self.x + (Math.random() - 0.5) * 200; fruit.y = self.y; fruit.speedX = (Math.random() - 0.5) * 20; fruit.speedY = -Math.random() * 30 - 25; // Launch very high fruits.push(fruit); game.addChild(fruit); gameObjects.push(fruit); } } } }; return self; }); var BoxingGlove = Container.expand(function () { var self = Container.call(this); var gloveGraphics = self.attachAsset('glove', { anchorX: 0.5, anchorY: 0.5 }); self.speedY = 2; self.update = function () { self.y += self.speedY; if (self.y > 2732) { self.shouldDestroy = true; } }; self.down = function (x, y, obj) { LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('hit').play(); self.shouldDestroy = true; }; return self; }); var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speedY = -10; self.update = function () { self.y += self.speedY; if (self.y < -50) { self.shouldDestroy = true; } }; return self; }); var Coin = Container.expand(function () { var self = Container.call(this); var coinGraphics = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = -5; self.update = function () { self.x += self.speedX; if (self.x < -100) { self.shouldDestroy = true; } }; self.down = function (x, y, obj) { LK.setScore(LK.getScore() + 5); scoreText.setText(LK.getScore()); LK.getSound('score').play(); self.shouldDestroy = true; }; return self; }); var Crab = Container.expand(function () { var self = Container.call(this); var crabGraphics = self.attachAsset('crab', { anchorX: 0.5, anchorY: 0.5 }); self.isMoving = false; self.lastY = 0; self.update = function () { // Track movement during red light if (self.lastY === undefined) self.lastY = self.y; if (isRedLight && Math.abs(self.y - self.lastY) > 5) { self.isMoving = true; } else if (isGreenLight) { self.isMoving = false; } self.lastY = self.y; }; return self; }); var Dot = Container.expand(function () { var self = Container.call(this); var dotGraphics = self.attachAsset('dot', { anchorX: 0.5, anchorY: 0.5 }); self.collected = false; self.down = function (x, y, obj) { if (!self.collected) { self.collected = true; LK.setScore(LK.getScore() + 1); scoreText.setText(LK.getScore()); LK.getSound('score').play(); dotGraphics.alpha = 0.3; } }; return self; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.speedY = 3; self.update = function () { self.y += self.speedY; if (self.y > 2732) { self.shouldDestroy = true; } }; return self; }); var Food = Container.expand(function () { var self = Container.call(this); var foodGraphics = self.attachAsset('food', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Football = Container.expand(function () { var self = Container.call(this); var footballGraphics = self.attachAsset('football', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = 0; self.speedY = 0; self.kicked = false; self.update = function () { if (self.kicked) { self.x += self.speedX; self.y += self.speedY; if (self.y < -50 || self.x < -50 || self.x > 2098) { self.shouldDestroy = true; } } }; return self; }); var Fruit = Container.expand(function () { var self = Container.call(this); var fruitGraphics = self.attachAsset('fruit', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = (Math.random() - 0.5) * 16; self.speedY = -Math.random() * 25 - 20; self.gravity = 0.3; self.sliced = false; self.update = function () { self.x += self.speedX; self.y += self.speedY; self.speedY += self.gravity; if (self.y > 2800) { self.shouldDestroy = true; } }; self.down = function (x, y, obj) { if (!self.sliced) { self.sliced = true; LK.getSound('hit').play(); LK.showGameOver(); } }; return self; }); var Goal = Container.expand(function () { var self = Container.call(this); var goalGraphics = self.attachAsset('goal', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Goalkeeper = Container.expand(function () { var self = Container.call(this); var keeperGraphics = self.attachAsset('goalkeeper', { anchorX: 0.5, anchorY: 0.5 }); self.direction = 1; self.update = function () { self.x += self.direction * 2; if (self.x <= 724 || self.x >= 1324) { self.direction = -self.direction; } }; return self; }); var GunEnemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('gunEnemy', { anchorX: 0.5, anchorY: 0.5 }); self.speedY = 2; self.update = function () { self.y += self.speedY; if (self.y > 2732) { self.shouldDestroy = true; } }; self.down = function (x, y, obj) { LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('hit').play(); self.shouldDestroy = true; }; return self; }); var Hole = Container.expand(function () { var self = Container.call(this); var holeGraphics = self.attachAsset('hole', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Light = Container.expand(function () { var self = Container.call(this); var lightGraphics = self.attachAsset('light', { anchorX: 0.5, anchorY: 0.5 }); self.isRed = false; self.setRed = function () { self.isRed = true; lightGraphics.tint = 0xff0000; }; self.setGreen = function () { self.isRed = false; lightGraphics.tint = 0x00ff00; }; return self; }); var Missile = Container.expand(function () { var self = Container.call(this); var missileGraphics = self.attachAsset('missile', { anchorX: 0.5, anchorY: 0.5 }); self.speedY = -8; self.update = function () { self.y += self.speedY; if (self.y < -50) { self.shouldDestroy = true; } }; return self; }); var Mole = Container.expand(function () { var self = Container.call(this); var moleGraphics = self.attachAsset('mole', { anchorX: 0.5, anchorY: 0.5 }); self.isUp = false; self.down = function (x, y, obj) { if (self.isUp) { LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('hit').play(); self.isUp = false; self.y += 30; } }; return self; }); var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = -5; self.update = function () { self.x += self.speedX; if (self.x < -100) { self.shouldDestroy = true; } }; return self; }); var PacBall = Container.expand(function () { var self = Container.call(this); var ballGraphics = self.attachAsset('pacBall', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = 0; self.speedY = 0; self.update = function () { self.x += self.speedX; self.y += self.speedY; if (self.x < -50 || self.x > 2098 || self.y < -50 || self.y > 2782) { self.shouldDestroy = true; } }; return self; }); var Paddle = Container.expand(function () { var self = Container.call(this); var paddleGraphics = self.attachAsset('paddle', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Pipe = Container.expand(function () { var self = Container.call(this); var pipeGraphics = self.attachAsset('pipe', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = -3; self.update = function () { self.x += self.speedX; if (self.x < -100) { self.shouldDestroy = true; } }; return self; }); var Platform = Container.expand(function () { var self = Container.call(this); var platformGraphics = self.attachAsset('platform', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Pointer = Container.expand(function () { var self = Container.call(this); var pointerGraphics = self.attachAsset('pointer', { anchorX: 0.5, anchorY: 1 }); return self; }); var Punch = Container.expand(function () { var self = Container.call(this); var punchGraphics = self.attachAsset('punch', { anchorX: 0.5, anchorY: 0.5 }); self.speedY = -10; self.update = function () { self.y += self.speedY; if (self.y < -50) { self.shouldDestroy = true; } }; return self; }); var Rope = Container.expand(function () { var self = Container.call(this); var ropeGraphics = self.attachAsset('rope', { anchorX: 0.5, anchorY: 0.5 }); self.isDragging = false; self.update = function () { // No automatic movement - only moves when dragged }; self.down = function (x, y, obj) { self.isDragging = true; }; self.up = function (x, y, obj) { self.isDragging = false; }; return self; }); var Roulette = Container.expand(function () { var self = Container.call(this); var rouletteGraphics = self.attachAsset('roulette', { anchorX: 0.5, anchorY: 0.5 }); self.colors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0xff00ff, 0x00ffff]; self.currentColor = 0; self.rotation = 0; self.spinning = false; self.spinSpeed = 0; self.changeColor = function () { self.currentColor = (self.currentColor + 1) % self.colors.length; rouletteGraphics.tint = self.colors[self.currentColor]; }; self.spin = function () { self.spinning = true; self.spinSpeed = 0.2; }; self.update = function () { if (self.spinning) { self.rotation += self.spinSpeed; rouletteGraphics.rotation = self.rotation; self.spinSpeed *= 0.98; if (self.spinSpeed < 0.01) { self.spinning = false; self.spinSpeed = 0; } } }; self.down = function (x, y, obj) { if (!self.spinning) { self.spin(); LK.setScore(LK.getScore() + 1); scoreText.setText(LK.getScore()); LK.getSound('score').play(); } }; return self; }); var Runner = Container.expand(function () { var self = Container.call(this); var runnerGraphics = self.attachAsset('runner', { anchorX: 0.5, anchorY: 0.5 }); self.speedY = 0; self.grounded = false; self.update = function () { self.speedY += 0.8; self.y += self.speedY; if (self.y > 2732) { self.shouldDestroy = true; } }; return self; }); var SnakeSegment = Container.expand(function () { var self = Container.call(this); var segmentGraphics = self.attachAsset('snake', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Target = Container.expand(function () { var self = Container.call(this); var targetGraphics = self.attachAsset('target', { anchorX: 0.5, anchorY: 0.5 }); self.down = function (x, y, obj) { LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('score').play(); self.shouldDestroy = true; }; return self; }); var Tile = Container.expand(function () { var self = Container.call(this); var tileGraphics = self.attachAsset('tile', { anchorX: 0.5, anchorY: 0.5 }); self.originalColor = 0x8a2be2; self.targetColor = 0xffd700; self.isTarget = false; self.setAsTarget = function () { self.isTarget = true; tileGraphics.tint = self.targetColor; }; self.down = function (x, y, obj) { if (self.isTarget) { LK.setScore(LK.getScore() + 5); scoreText.setText(LK.getScore()); LK.getSound('score').play(); self.isTarget = false; tileGraphics.tint = self.originalColor; } }; return self; }); var Wall = Container.expand(function () { var self = Container.call(this); var wallGraphics = self.attachAsset('wall', { anchorX: 0.5, anchorY: 0.5 }); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ // Score display var scoreText = new Text2('0', { size: 72, fill: 0x333333 }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); // Game state variables var gameState = 'menu'; // 'menu', 'game1' to 'game45' - Complete collection of innovative mini-games var gameTimer = 0; var gameObjects = []; var snakeSegments = []; var snakeDirection = 'right'; var food; var pipes = []; var bird; var moles = []; var holes = []; var missiles = []; var enemies = []; var player; var obstacles = []; var coins = []; var dots = []; var pacmanX = 1024; var pacmanY = 1366; var football; var goal; var goalkeeper; var gloves = []; var punches = []; var roulette; var pointer; var bullets = []; var gunEnemies = []; var walls = []; var pacBalls = []; var platforms = []; var runner; var runnerSpeed = 0; var runnerY = 2000; var bombs = []; var fruits = []; var crab; var light; var isRedLight = false; var isGreenLight = true; var lightTimer = 0; var finishLine; var rope; var jumpCount = 0; var ropeJumpTimer = 0; var crabJumpSpeed = 0; var crabGrounded = true; var combaRope; var combaPlayer; var combaJumpCount = 0; var combaPlayerJumpSpeed = 0; var combaPlayerGrounded = true; var combaEnemies = []; var combaPoles = []; var draggedPole = null; var combaKillCountText = null; // Game 21: Mariano el Brosiano (Parkour) variables var marianoPlayer; var marianoObstacles = []; var marianoCoins = []; var marianoJumps = []; var marianoSpeed = 5; var marianoJumpSpeed = 0; var marianoGrounded = true; var marianoDistance = 0; var marianoDistanceText = null; // Game 22-27 variables var colorTargets = []; var currentTargetColor = 0; var ballSpeed = 8; var speedTapTimer = 0; var circleChaser; var circleTarget; var stackBlocks = []; var stackHeight = 0; var mazeWalls = []; var mazePlayer; var mazeExit; // Menu title var menuTitle = new Text2('Ultimate Games Collection - 45 Games!', { size: 64, fill: 0x333333 }); menuTitle.anchor.set(0.5, 0.5); menuTitle.x = 1024; menuTitle.y = 400; game.addChild(menuTitle); // All original mini-game buttons var game1Button = new ActionButton('Target Shooter', function () { startGame1(); }); game1Button.x = 300; game1Button.y = 600; game.addChild(game1Button); var game2Button = new ActionButton('Breakout', function () { startGame2(); }); game2Button.x = 700; game2Button.y = 600; game.addChild(game2Button); var game3Button = new ActionButton('Memory Tiles', function () { startGame3(); }); game3Button.x = 1100; game3Button.y = 600; game.addChild(game3Button); var game4Button = new ActionButton('Tap Challenge', function () { startGame4(); }); game4Button.x = 1500; game4Button.y = 600; game.addChild(game4Button); var game5Button = new ActionButton('Snake', function () { startGame5(); }); game5Button.x = 300; game5Button.y = 800; game.addChild(game5Button); var game6Button = new ActionButton('Flappy Bird', function () { startGame6(); }); game6Button.x = 700; game6Button.y = 800; game.addChild(game6Button); var game7Button = new ActionButton('Whack-a-Mole', function () { startGame7(); }); game7Button.x = 1100; game7Button.y = 800; game.addChild(game7Button); var game8Button = new ActionButton('Space Shooter', function () { startGame8(); }); game8Button.x = 1500; game8Button.y = 800; game.addChild(game8Button); var game9Button = new ActionButton('Endless Runner', function () { startGame9(); }); game9Button.x = 300; game9Button.y = 1000; game.addChild(game9Button); var game10Button = new ActionButton('Pac-Dots', function () { startGame10(); }); game10Button.x = 700; game10Button.y = 1000; game.addChild(game10Button); var game11Button = new ActionButton('FootMe', function () { startGame11(); }); game11Button.x = 1100; game11Button.y = 1000; game.addChild(game11Button); var game12Button = new ActionButton('Punch Me', function () { startGame12(); }); game12Button.x = 1500; game12Button.y = 1000; game.addChild(game12Button); var game13Button = new ActionButton('Roulette', function () { startGame13(); }); game13Button.x = 300; game13Button.y = 1200; game.addChild(game13Button); var game14Button = new ActionButton('Gun Bomb', function () { startGame14(); }); game14Button.x = 700; game14Button.y = 1200; game.addChild(game14Button); var game15Button = new ActionButton('Pac The', function () { startGame15(); }); game15Button.x = 1100; game15Button.y = 1200; game.addChild(game15Button); var game16Button = new ActionButton('Speed Mob', function () { startGame16(); }); game16Button.x = 1500; game16Button.y = 1200; game.addChild(game16Button); var game17Button = new ActionButton('Canon True', function () { startGame17(); }); game17Button.x = 300; game17Button.y = 1400; game.addChild(game17Button); var game18Button = new ActionButton('El Cangrejo', function () { startGame18(); }); game18Button.x = 700; game18Button.y = 1400; game.addChild(game18Button); var game20Button = new ActionButton('Comba', function () { startGame20(); }); game20Button.x = 1100; game20Button.y = 1400; game.addChild(game20Button); var game21Button = new ActionButton('Mariano el Brosiano', function () { startGame21(); }); game21Button.x = 1500; game21Button.y = 1400; game.addChild(game21Button); var game22Button = new ActionButton('Color Match', function () { startGame22(); }); game22Button.x = 300; game22Button.y = 1600; game.addChild(game22Button); var game23Button = new ActionButton('Ball Bounce', function () { startGame23(); }); game23Button.x = 700; game23Button.y = 1600; game.addChild(game23Button); var game24Button = new ActionButton('Speed Tap', function () { startGame24(); }); game24Button.x = 1100; game24Button.y = 1600; game.addChild(game24Button); var game25Button = new ActionButton('Circle Chase', function () { startGame25(); }); game25Button.x = 1500; game25Button.y = 1600; game.addChild(game25Button); var game26Button = new ActionButton('Block Stack', function () { startGame26(); }); game26Button.x = 300; game26Button.y = 1800; game.addChild(game26Button); var game27Button = new ActionButton('Maze Runner', function () { startGame27(); }); game27Button.x = 700; game27Button.y = 1800; game.addChild(game27Button); var game28Button = new ActionButton('Bubble Pop', function () { startGame28(); }); game28Button.x = 1100; game28Button.y = 1800; game.addChild(game28Button); var game29Button = new ActionButton('Memory Flash', function () { startGame29(); }); game29Button.x = 1500; game29Button.y = 1800; game.addChild(game29Button); var game30Button = new ActionButton('Time Warp', function () { startGame30(); }); game30Button.x = 300; game30Button.y = 2000; game.addChild(game30Button); var game31Button = new ActionButton('Color Storm', function () { startGame31(); }); game31Button.x = 700; game31Button.y = 2000; game.addChild(game31Button); var game32Button = new ActionButton('Gravity Fall', function () { startGame32(); }); game32Button.x = 1100; game32Button.y = 2000; game.addChild(game32Button); var game33Button = new ActionButton('Laser Beam', function () { startGame33(); }); game33Button.x = 1500; game33Button.y = 2000; game.addChild(game33Button); var game34Button = new ActionButton('Shape Match', function () { startGame34(); }); game34Button.x = 300; game34Button.y = 2200; game.addChild(game34Button); var game35Button = new ActionButton('Rhythm Tap', function () { startGame35(); }); game35Button.x = 700; game35Button.y = 2200; game.addChild(game35Button); var game36Button = new ActionButton('Twisty Turn', function () { startGame36(); }); game36Button.x = 1100; game36Button.y = 2200; game.addChild(game36Button); var game37Button = new ActionButton('Power Surge', function () { startGame37(); }); game37Button.x = 1500; game37Button.y = 2200; game.addChild(game37Button); var game38Button = new ActionButton('Mirror Magic', function () { startGame38(); }); game38Button.x = 300; game38Button.y = 2300; game.addChild(game38Button); var game39Button = new ActionButton('Chain React', function () { startGame39(); }); game39Button.x = 700; game39Button.y = 2300; game.addChild(game39Button); var game40Button = new ActionButton('Eclipse Phase', function () { startGame40(); }); game40Button.x = 1100; game40Button.y = 2300; game.addChild(game40Button); var game41Button = new ActionButton('Neon Rush', function () { startGame41(); }); game41Button.x = 1500; game41Button.y = 2300; game.addChild(game41Button); var game42Button = new ActionButton('Orbit Strike', function () { startGame42(); }); game42Button.x = 300; game42Button.y = 2350; game.addChild(game42Button); var game43Button = new ActionButton('Void Walker', function () { startGame43(); }); game43Button.x = 700; game43Button.y = 2350; game.addChild(game43Button); var game44Button = new ActionButton('Prism Break', function () { startGame44(); }); game44Button.x = 1100; game44Button.y = 2350; game.addChild(game44Button); var game45Button = new ActionButton('Quantum Leap', function () { startGame45(); }); game45Button.x = 1500; game45Button.y = 2350; game.addChild(game45Button); // Back button var backButton = new ActionButton('Back to Menu', function () { returnToMenu(); }); backButton.x = 1024; backButton.y = 2400; game.addChild(backButton); // Game 1: Target Shooter function startGame1() { gameState = 'game1'; gameTimer = 0; hideMenu(); showBackButton(); // Spawn targets periodically var targetInterval = LK.setInterval(function () { if (gameState === 'game1') { var target = new Target(); target.x = 200 + Math.random() * 1648; target.y = 600 + Math.random() * 1500; gameObjects.push(target); game.addChild(target); } else { LK.clearInterval(targetInterval); } }, 1000); } // Game 2: Breakout var paddle; var ball; var blocks = []; function startGame2() { gameState = 'game2'; gameTimer = 0; hideMenu(); showBackButton(); // Create paddle paddle = new Paddle(); paddle.x = 1024; paddle.y = 2400; game.addChild(paddle); gameObjects.push(paddle); // Create ball ball = new Ball(); ball.x = 1024; ball.y = 2200; ball.speedX = 8; ball.speedY = -8; game.addChild(ball); gameObjects.push(ball); // Create blocks for (var i = 0; i < 8; i++) { for (var j = 0; j < 5; j++) { var block = new Block(); block.x = 200 + i * 200; block.y = 400 + j * 80; blocks.push(block); game.addChild(block); gameObjects.push(block); } } } // Game 3: Memory Tiles var tiles = []; var targetTileIndex = 0; var tilesClicked = 0; function startGame3() { gameState = 'game3'; gameTimer = 0; hideMenu(); showBackButton(); // Create 4x4 grid of tiles for (var i = 0; i < 4; i++) { for (var j = 0; j < 4; j++) { var tile = new Tile(); tile.x = 400 + i * 200; tile.y = 800 + j * 200; tiles.push(tile); game.addChild(tile); gameObjects.push(tile); } } // Set first target tiles[0].setAsTarget(); } // Game 4: Tap Challenge var tapCount = 0; var tapTimer = 600; // 10 seconds at 60fps function startGame4() { gameState = 'game4'; gameTimer = 0; hideMenu(); showBackButton(); tapCount = 0; tapTimer = 600; // Create tap instruction var tapInstruction = new Text2('Tap anywhere as fast as you can!', { size: 48, fill: 0x333333 }); tapInstruction.anchor.set(0.5, 0.5); tapInstruction.x = 1024; tapInstruction.y = 1000; game.addChild(tapInstruction); gameObjects.push(tapInstruction); var tapCountText = new Text2('Taps: 0', { size: 56, fill: 0x333333 }); tapCountText.anchor.set(0.5, 0.5); tapCountText.x = 1024; tapCountText.y = 1200; game.addChild(tapCountText); gameObjects.push(tapCountText); var timerText = new Text2('Time: 10', { size: 56, fill: 0x333333 }); timerText.anchor.set(0.5, 0.5); timerText.x = 1024; timerText.y = 1400; game.addChild(timerText); gameObjects.push(timerText); } // Game 5: Snake function startGame5() { gameState = 'game5'; gameTimer = 0; hideMenu(); showBackButton(); snakeSegments = []; snakeDirection = 'right'; // Create initial snake var head = new SnakeSegment(); head.x = 1024; head.y = 1366; snakeSegments.push(head); game.addChild(head); gameObjects.push(head); // Create food food = new Food(); food.x = 500 + Math.random() * 1048; food.y = 500 + Math.random() * 1732; game.addChild(food); gameObjects.push(food); } // Game 6: Flappy Bird function startGame6() { gameState = 'game6'; gameTimer = 0; hideMenu(); showBackButton(); pipes = []; // Create bird bird = new Bird(); bird.x = 300; bird.y = 1366; game.addChild(bird); gameObjects.push(bird); // Spawn pipes var pipeInterval = LK.setInterval(function () { if (gameState === 'game6') { var gap = 200; var gapY = 300 + Math.random() * 1000; var topPipe = new Pipe(); topPipe.x = 2148; topPipe.y = gapY - gap / 2 - 150; pipes.push(topPipe); game.addChild(topPipe); gameObjects.push(topPipe); var bottomPipe = new Pipe(); bottomPipe.x = 2148; bottomPipe.y = gapY + gap / 2 + 150; pipes.push(bottomPipe); game.addChild(bottomPipe); gameObjects.push(bottomPipe); } else { LK.clearInterval(pipeInterval); } }, 2000); } // Game 7: Whack-a-Mole function startGame7() { gameState = 'game7'; gameTimer = 0; hideMenu(); showBackButton(); moles = []; holes = []; // Create holes and moles for (var i = 0; i < 3; i++) { for (var j = 0; j < 3; j++) { var hole = new Hole(); hole.x = 400 + i * 400; hole.y = 900 + j * 300; holes.push(hole); game.addChild(hole); gameObjects.push(hole); var mole = new Mole(); mole.x = hole.x; mole.y = hole.y + 30; moles.push(mole); game.addChild(mole); gameObjects.push(mole); } } // Mole popup timer var moleInterval = LK.setInterval(function () { if (gameState === 'game7') { var randomMole = moles[Math.floor(Math.random() * moles.length)]; if (!randomMole.isUp) { randomMole.isUp = true; randomMole.y -= 30; LK.setTimeout(function () { if (randomMole.isUp) { randomMole.isUp = false; randomMole.y += 30; } }, 1500); } } else { LK.clearInterval(moleInterval); } }, 800); } // Game 8: Space Shooter function startGame8() { gameState = 'game8'; gameTimer = 0; hideMenu(); showBackButton(); missiles = []; enemies = []; // Create player player = new Player(); player.x = 1024; player.y = 2400; game.addChild(player); gameObjects.push(player); // Spawn enemies var enemyInterval = LK.setInterval(function () { if (gameState === 'game8') { var enemy = new Enemy(); enemy.x = 200 + Math.random() * 1648; enemy.y = 100; enemies.push(enemy); game.addChild(enemy); gameObjects.push(enemy); } else { LK.clearInterval(enemyInterval); } }, 1000); } // Game 9: Endless Runner function startGame9() { gameState = 'game9'; gameTimer = 0; hideMenu(); showBackButton(); obstacles = []; coins = []; // Create player player = new Player(); player.x = 300; player.y = 2000; game.addChild(player); gameObjects.push(player); // Spawn obstacles and coins var spawnInterval = LK.setInterval(function () { if (gameState === 'game9') { if (Math.random() < 0.7) { var obstacle = new Obstacle(); obstacle.x = 2148; obstacle.y = 2000; obstacles.push(obstacle); game.addChild(obstacle); gameObjects.push(obstacle); } else { var coin = new Coin(); coin.x = 2148; coin.y = 1800 + Math.random() * 400; coins.push(coin); game.addChild(coin); gameObjects.push(coin); } } else { LK.clearInterval(spawnInterval); } }, 1500); } // Game 10: Pac-Dots function startGame10() { gameState = 'game10'; gameTimer = 0; hideMenu(); showBackButton(); dots = []; pacmanX = 1024; pacmanY = 1366; // Create player player = new Player(); player.x = pacmanX; player.y = pacmanY; game.addChild(player); gameObjects.push(player); // Create dots in grid for (var i = 0; i < 15; i++) { for (var j = 0; j < 20; j++) { var dot = new Dot(); dot.x = 200 + i * 100; dot.y = 600 + j * 100; dots.push(dot); game.addChild(dot); gameObjects.push(dot); } } } // Game 11: FootMe (Penalty Game) function startGame11() { gameState = 'game11'; gameTimer = 0; hideMenu(); showBackButton(); // Create goal goal = new Goal(); goal.x = 1024; goal.y = 400; game.addChild(goal); gameObjects.push(goal); // Create goalkeeper goalkeeper = new Goalkeeper(); goalkeeper.x = 1024; goalkeeper.y = 450; game.addChild(goalkeeper); gameObjects.push(goalkeeper); // Create football football = new Football(); football.x = 1024; football.y = 2200; game.addChild(football); gameObjects.push(football); } // Game 12: Punch Me (Boxing Glove Destruction) function startGame12() { gameState = 'game12'; gameTimer = 0; hideMenu(); showBackButton(); gloves = []; punches = []; // Spawn gloves periodically var gloveInterval = LK.setInterval(function () { if (gameState === 'game12') { var glove = new BoxingGlove(); glove.x = 200 + Math.random() * 1648; glove.y = 100; gloves.push(glove); game.addChild(glove); gameObjects.push(glove); } else { LK.clearInterval(gloveInterval); } }, 1000); } // Game 13: Roulette (Color Clicker) function startGame13() { gameState = 'game13'; gameTimer = 0; hideMenu(); showBackButton(); // Create roulette roulette = new Roulette(); roulette.x = 1024; roulette.y = 1366; game.addChild(roulette); gameObjects.push(roulette); // Create pointer pointer = new Pointer(); pointer.x = 1024; pointer.y = 1066; game.addChild(pointer); gameObjects.push(pointer); // Change color periodically var colorInterval = LK.setInterval(function () { if (gameState === 'game13') { roulette.changeColor(); } else { LK.clearInterval(colorInterval); } }, 2000); } // Game 14: Gun Bomb (Enemy Shooting) function startGame14() { gameState = 'game14'; gameTimer = 0; hideMenu(); showBackButton(); bullets = []; gunEnemies = []; // Create player player = new Player(); player.x = 1024; player.y = 2400; game.addChild(player); gameObjects.push(player); // Spawn enemies periodically var gunEnemyInterval = LK.setInterval(function () { if (gameState === 'game14') { var gunEnemy = new GunEnemy(); gunEnemy.x = 200 + Math.random() * 1648; gunEnemy.y = 100; gunEnemies.push(gunEnemy); game.addChild(gunEnemy); gameObjects.push(gunEnemy); } else { LK.clearInterval(gunEnemyInterval); } }, 1500); } // Game 15: Pac The (Labyrinth Ball Throwing) function startGame15() { gameState = 'game15'; gameTimer = 0; hideMenu(); showBackButton(); walls = []; pacBalls = []; // Create player player = new Player(); player.x = 200; player.y = 1366; game.addChild(player); gameObjects.push(player); // Create maze walls var wallPositions = [{ x: 400, y: 800 }, { x: 500, y: 800 }, { x: 600, y: 800 }, { x: 800, y: 1000 }, { x: 900, y: 1000 }, { x: 1000, y: 1000 }, { x: 1200, y: 1200 }, { x: 1300, y: 1200 }, { x: 1400, y: 1200 }, { x: 600, y: 1400 }, { x: 700, y: 1400 }, { x: 800, y: 1400 }, { x: 1000, y: 1600 }, { x: 1100, y: 1600 }, { x: 1200, y: 1600 }]; for (var i = 0; i < wallPositions.length; i++) { var wall = new Wall(); wall.x = wallPositions[i].x; wall.y = wallPositions[i].y; walls.push(wall); game.addChild(wall); gameObjects.push(wall); } // Create targets for (var i = 0; i < 5; i++) { var target = new Target(); target.x = 1500 + Math.random() * 400; target.y = 800 + Math.random() * 1200; game.addChild(target); gameObjects.push(target); } } // Game 16: Speed Mob (Parkour) function startGame16() { gameState = 'game16'; gameTimer = 0; hideMenu(); showBackButton(); platforms = []; runnerSpeed = 0; runnerY = 2000; // Create runner runner = new Runner(); runner.x = 300; runner.y = runnerY; game.addChild(runner); gameObjects.push(runner); // Create platforms var platformPositions = [{ x: 500, y: 1800 }, { x: 800, y: 1600 }, { x: 1100, y: 1400 }, { x: 1400, y: 1200 }, { x: 1700, y: 1000 }, { x: 2000, y: 800 }, { x: 2300, y: 600 }, { x: 2600, y: 400 }, { x: 2900, y: 200 }]; for (var i = 0; i < platformPositions.length; i++) { var platform = new Platform(); platform.x = platformPositions[i].x; platform.y = platformPositions[i].y; platforms.push(platform); game.addChild(platform); gameObjects.push(platform); } } // Game 17: Canon True (Fruit Ninja style - slice bombs, avoid fruits) function startGame17() { gameState = 'game17'; gameTimer = 0; hideMenu(); showBackButton(); bombs = []; fruits = []; // Spawn bombs and fruits periodically var spawnInterval = LK.setInterval(function () { if (gameState === 'game17') { if (Math.random() < 0.7) { // Spawn bomb (good object) var bomb = new Bomb(); bomb.x = 200 + Math.random() * 1648; bomb.y = 2800; bombs.push(bomb); game.addChild(bomb); gameObjects.push(bomb); } else { // Spawn fruit (bad object) var fruit = new Fruit(); fruit.x = 200 + Math.random() * 1648; fruit.y = 2800; fruits.push(fruit); game.addChild(fruit); gameObjects.push(fruit); } } else { LK.clearInterval(spawnInterval); } }, 800); } // Game 18: El Cangrejo (Red Light Green Light) function startGame18() { gameState = 'game18'; gameTimer = 0; hideMenu(); showBackButton(); isRedLight = false; isGreenLight = true; lightTimer = 0; // Create crab player crab = new Crab(); crab.x = 1024; crab.y = 2400; game.addChild(crab); gameObjects.push(crab); // Create light indicator light = new Light(); light.x = 1024; light.y = 300; light.setGreen(); game.addChild(light); gameObjects.push(light); // Create finish line finishLine = new Text2('FINISH LINE', { size: 80, fill: 0xffd700 }); finishLine.anchor.set(0.5, 0.5); finishLine.x = 1024; finishLine.y = 600; game.addChild(finishLine); gameObjects.push(finishLine); // Light switching timer var lightInterval = LK.setInterval(function () { if (gameState === 'game18') { if (isGreenLight) { // Switch to red light isRedLight = true; isGreenLight = false; light.setRed(); lightTimer = 120 + Math.random() * 180; // 2-5 seconds } else { // Switch to green light isRedLight = false; isGreenLight = true; light.setGreen(); lightTimer = 180 + Math.random() * 240; // 3-6 seconds } } else { LK.clearInterval(lightInterval); } }, 3000); } // Game 19: Rope Jumping (second part of El Cangrejo) function startGame19() { gameState = 'game19'; gameTimer = 0; jumpCount = 0; ropeJumpTimer = 0; crabJumpSpeed = 0; crabGrounded = true; // Keep the crab from previous game if (crab) { crab.x = 1024; crab.y = 2000; } // Create rope rope = new Rope(); rope.x = 1024; rope.y = 1800; game.addChild(rope); gameObjects.push(rope); // Create jump count display var jumpCountText = new Text2('Jumps: 0', { size: 80, fill: 0x333333 }); jumpCountText.anchor.set(0.5, 0.5); jumpCountText.x = 1024; jumpCountText.y = 1000; game.addChild(jumpCountText); gameObjects.push(jumpCountText); // Create instruction text var instructionText = new Text2('Jump 10 times to win!', { size: 64, fill: 0x333333 }); instructionText.anchor.set(0.5, 0.5); instructionText.x = 1024; instructionText.y = 1200; game.addChild(instructionText); gameObjects.push(instructionText); } // Game 20: Comba (Jump Rope Game) function startGame20() { gameState = 'game20'; gameTimer = 0; combaJumpCount = 0; combaPlayerJumpSpeed = 0; combaPlayerGrounded = true; combaEnemies = []; combaPoles = []; draggedPole = null; hideMenu(); showBackButton(); // Create poles for combat for (var i = 0; i < 3; i++) { var pole = new Rope(); pole.x = 400 + i * 600; pole.y = 1800; combaPoles.push(pole); game.addChild(pole); gameObjects.push(pole); } // Spawn enemies periodically var enemySpawnInterval = LK.setInterval(function () { if (gameState === 'game20') { var enemy = new Enemy(); enemy.x = 200 + Math.random() * 1648; enemy.y = 100; combaEnemies.push(enemy); game.addChild(enemy); gameObjects.push(enemy); } else { LK.clearInterval(enemySpawnInterval); } }, 2000); // Create kill count display combaKillCountText = new Text2('Kills: 0', { size: 80, fill: 0x333333 }); combaKillCountText.anchor.set(0.5, 0.5); combaKillCountText.x = 1024; combaKillCountText.y = 1000; game.addChild(combaKillCountText); gameObjects.push(combaKillCountText); // Create instruction text var combaInstructionText = new Text2('Move poles to kill enemies! Drag to move poles', { size: 64, fill: 0x333333 }); combaInstructionText.anchor.set(0.5, 0.5); combaInstructionText.x = 1024; combaInstructionText.y = 1200; game.addChild(combaInstructionText); gameObjects.push(combaInstructionText); } // Game 21: Mariano el Brosiano (Parkour) function startGame21() { gameState = 'game21'; gameTimer = 0; marianoDistance = 0; marianoSpeed = 5; marianoJumpSpeed = 0; marianoGrounded = true; marianoObstacles = []; marianoCoins = []; marianoJumps = []; hideMenu(); showBackButton(); // Create mariano player marianoPlayer = new Player(); marianoPlayer.x = 300; marianoPlayer.y = 2000; game.addChild(marianoPlayer); gameObjects.push(marianoPlayer); // Create initial platforms var platformPositions = [{ x: 600, y: 1900 }, { x: 900, y: 1700 }, { x: 1300, y: 1500 }, { x: 1700, y: 1300 }, { x: 2100, y: 1100 }, { x: 2500, y: 900 }, { x: 2900, y: 700 }, { x: 3300, y: 500 }]; for (var i = 0; i < platformPositions.length; i++) { var platform = new Platform(); platform.x = platformPositions[i].x; platform.y = platformPositions[i].y; marianoJumps.push(platform); game.addChild(platform); gameObjects.push(platform); } // Create obstacles for (var i = 0; i < 5; i++) { var obstacle = new Obstacle(); obstacle.x = 800 + i * 500; obstacle.y = 2000; marianoObstacles.push(obstacle); game.addChild(obstacle); gameObjects.push(obstacle); } // Create coins for (var i = 0; i < 8; i++) { var coin = new Coin(); coin.x = 700 + i * 400; coin.y = 1400 + Math.random() * 400; marianoCoins.push(coin); game.addChild(coin); gameObjects.push(coin); } // Create distance display marianoDistanceText = new Text2('Distance: 0m', { size: 50, fill: 0x333333 }); marianoDistanceText.anchor.set(0.5, 0.5); marianoDistanceText.x = 1024; marianoDistanceText.y = 1000; game.addChild(marianoDistanceText); gameObjects.push(marianoDistanceText); // Create instruction text var marianoInstructionText = new Text2('Tap to jump! Avoid obstacles, collect coins!', { size: 40, fill: 0x333333 }); marianoInstructionText.anchor.set(0.5, 0.5); marianoInstructionText.x = 1024; marianoInstructionText.y = 1200; game.addChild(marianoInstructionText); gameObjects.push(marianoInstructionText); } // Game 22: Color Match function startGame22() { gameState = 'game22'; gameTimer = 0; colorTargets = []; currentTargetColor = 0; hideMenu(); showBackButton(); var colors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0xff00ff, 0x00ffff]; // Create colored targets for (var i = 0; i < 6; i++) { var target = new Target(); target.x = 200 + i % 3 * 600; target.y = 800 + Math.floor(i / 3) * 300; target.tint = colors[i]; target.colorIndex = i; colorTargets.push(target); game.addChild(target); gameObjects.push(target); } // Create instruction var colorInstruction = new Text2('Tap colors in order: Red, Green, Blue, Yellow, Magenta, Cyan', { size: 40, fill: 0x333333 }); colorInstruction.anchor.set(0.5, 0.5); colorInstruction.x = 1024; colorInstruction.y = 1500; game.addChild(colorInstruction); gameObjects.push(colorInstruction); } // Game 23: Ball Bounce function startGame23() { gameState = 'game23'; gameTimer = 0; ballSpeed = 8; hideMenu(); showBackButton(); // Create bouncing ball var bounceBall = new Ball(); bounceBall.x = 1024; bounceBall.y = 1366; bounceBall.speedX = ballSpeed; bounceBall.speedY = ballSpeed; game.addChild(bounceBall); gameObjects.push(bounceBall); // Create targets to hit for (var i = 0; i < 8; i++) { var target = new Target(); target.x = 300 + i % 4 * 400; target.y = 600 + Math.floor(i / 4) * 300; game.addChild(target); gameObjects.push(target); } var bounceInstruction = new Text2('Let the ball hit all targets!', { size: 40, fill: 0x333333 }); bounceInstruction.anchor.set(0.5, 0.5); bounceInstruction.x = 1024; bounceInstruction.y = 2000; game.addChild(bounceInstruction); gameObjects.push(bounceInstruction); } // Game 24: Speed Tap function startGame24() { gameState = 'game24'; gameTimer = 0; speedTapTimer = 1800; // 30 seconds hideMenu(); showBackButton(); var speedInstruction = new Text2('Tap as many targets as possible in 30 seconds!', { size: 40, fill: 0x333333 }); speedInstruction.anchor.set(0.5, 0.5); speedInstruction.x = 1024; speedInstruction.y = 1000; game.addChild(speedInstruction); gameObjects.push(speedInstruction); var speedTimer = new Text2('Time: 30', { size: 50, fill: 0x333333 }); speedTimer.anchor.set(0.5, 0.5); speedTimer.x = 1024; speedTimer.y = 1200; game.addChild(speedTimer); gameObjects.push(speedTimer); // Spawn targets continuously var targetSpawnInterval = LK.setInterval(function () { if (gameState === 'game24') { var target = new Target(); target.x = 200 + Math.random() * 1648; target.y = 600 + Math.random() * 1500; game.addChild(target); gameObjects.push(target); } else { LK.clearInterval(targetSpawnInterval); } }, 500); } // Game 25: Circle Chase function startGame25() { gameState = 'game25'; gameTimer = 0; hideMenu(); showBackButton(); // Create chaser (player) circleChaser = new Player(); circleChaser.x = 200; circleChaser.y = 1366; game.addChild(circleChaser); gameObjects.push(circleChaser); // Create target to chase circleTarget = new Target(); circleTarget.x = 1500; circleTarget.y = 1000; game.addChild(circleTarget); gameObjects.push(circleTarget); var chaseInstruction = new Text2('Chase the red circle! Drag to move', { size: 40, fill: 0x333333 }); chaseInstruction.anchor.set(0.5, 0.5); chaseInstruction.x = 1024; chaseInstruction.y = 2200; game.addChild(chaseInstruction); gameObjects.push(chaseInstruction); } // Game 26: Block Stack function startGame26() { gameState = 'game26'; gameTimer = 0; stackBlocks = []; stackHeight = 0; hideMenu(); showBackButton(); // Create base platform var basePlatform = new Platform(); basePlatform.x = 1024; basePlatform.y = 2400; game.addChild(basePlatform); gameObjects.push(basePlatform); var stackInstruction = new Text2('Tap to drop blocks and stack them!', { size: 40, fill: 0x333333 }); stackInstruction.anchor.set(0.5, 0.5); stackInstruction.x = 1024; stackInstruction.y = 1000; game.addChild(stackInstruction); gameObjects.push(stackInstruction); var heightText = new Text2('Height: 0', { size: 50, fill: 0x333333 }); heightText.anchor.set(0.5, 0.5); heightText.x = 1024; heightText.y = 1200; game.addChild(heightText); gameObjects.push(heightText); } // Game 27: Maze Runner function startGame27() { gameState = 'game27'; gameTimer = 0; mazeWalls = []; hideMenu(); showBackButton(); // Create maze player mazePlayer = new Player(); mazePlayer.x = 200; mazePlayer.y = 2400; game.addChild(mazePlayer); gameObjects.push(mazePlayer); // Create maze exit mazeExit = new Target(); mazeExit.x = 1800; mazeExit.y = 600; mazeExit.tint = 0x00ff00; game.addChild(mazeExit); gameObjects.push(mazeExit); // Create maze walls var wallPositions = [{ x: 400, y: 800 }, { x: 500, y: 800 }, { x: 600, y: 800 }, { x: 800, y: 1000 }, { x: 900, y: 1000 }, { x: 1000, y: 1000 }, { x: 1200, y: 1200 }, { x: 1300, y: 1200 }, { x: 1400, y: 1200 }, { x: 600, y: 1400 }, { x: 700, y: 1400 }, { x: 800, y: 1400 }, { x: 1000, y: 1600 }, { x: 1100, y: 1600 }, { x: 1200, y: 1600 }, { x: 400, y: 1800 }, { x: 500, y: 1800 }, { x: 600, y: 1800 }, { x: 1400, y: 1800 }, { x: 1500, y: 1800 }, { x: 1600, y: 1800 }]; for (var i = 0; i < wallPositions.length; i++) { var wall = new Wall(); wall.x = wallPositions[i].x; wall.y = wallPositions[i].y; mazeWalls.push(wall); game.addChild(wall); gameObjects.push(wall); } var mazeInstruction = new Text2('Navigate to the green exit!', { size: 40, fill: 0x333333 }); mazeInstruction.anchor.set(0.5, 0.5); mazeInstruction.x = 1024; mazeInstruction.y = 500; game.addChild(mazeInstruction); gameObjects.push(mazeInstruction); } // Game 28: Bubble Pop function startGame28() { gameState = 'game28'; gameTimer = 0; bubbles = []; bubbleTimer = 0; hideMenu(); showBackButton(); var bubbleInstruction = new Text2('Pop the bubbles before they reach the top!', { size: 40, fill: 0x333333 }); bubbleInstruction.anchor.set(0.5, 0.5); bubbleInstruction.x = 1024; bubbleInstruction.y = 500; game.addChild(bubbleInstruction); gameObjects.push(bubbleInstruction); } // Game 29: Memory Flash function startGame29() { gameState = 'game29'; gameTimer = 0; memorySequence = []; memoryIndex = 0; hideMenu(); showBackButton(); // Create 4 memory buttons var memoryColors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00]; for (var i = 0; i < 4; i++) { var memoryButton = new Target(); memoryButton.x = 400 + i * 300; memoryButton.y = 1366; memoryButton.tint = memoryColors[i]; memoryButton.memoryIndex = i; game.addChild(memoryButton); gameObjects.push(memoryButton); } // Generate first sequence memorySequence.push(Math.floor(Math.random() * 4)); var memoryInstruction = new Text2('Watch the sequence, then repeat it!', { size: 40, fill: 0x333333 }); memoryInstruction.anchor.set(0.5, 0.5); memoryInstruction.x = 1024; memoryInstruction.y = 800; game.addChild(memoryInstruction); gameObjects.push(memoryInstruction); } // Game 30: Time Warp function startGame30() { gameState = 'game30'; gameTimer = 0; timeWarpSpeed = 1; timeWarpTargets = []; hideMenu(); showBackButton(); // Create time-based targets for (var i = 0; i < 5; i++) { var target = new Target(); target.x = 300 + i * 300; target.y = 1000 + Math.random() * 800; target.timeSpeed = 1 + Math.random() * 3; timeWarpTargets.push(target); game.addChild(target); gameObjects.push(target); } var timeInstruction = new Text2('Hit targets as time warps around you!', { size: 40, fill: 0x333333 }); timeInstruction.anchor.set(0.5, 0.5); timeInstruction.x = 1024; timeInstruction.y = 600; game.addChild(timeInstruction); gameObjects.push(timeInstruction); } // Game 31: Color Storm function startGame31() { gameState = 'game31'; gameTimer = 0; colorStormBalls = []; currentStormColor = 0; hideMenu(); showBackButton(); var stormInstruction = new Text2('Match the color! Only hit balls of the current color', { size: 40, fill: 0x333333 }); stormInstruction.anchor.set(0.5, 0.5); stormInstruction.x = 1024; stormInstruction.y = 500; game.addChild(stormInstruction); gameObjects.push(stormInstruction); var colorDisplay = new Target(); colorDisplay.x = 1024; colorDisplay.y = 800; colorDisplay.tint = stormColors[currentStormColor]; game.addChild(colorDisplay); gameObjects.push(colorDisplay); } // Game 32: Gravity Fall function startGame32() { gameState = 'game32'; gameTimer = 0; gravityObjects = []; gravityDirection = 1; hideMenu(); showBackButton(); // Create gravity-affected objects for (var i = 0; i < 8; i++) { var obj = new Target(); obj.x = 200 + i * 200; obj.y = 1366; obj.gravitySpeed = 0; gravityObjects.push(obj); game.addChild(obj); gameObjects.push(obj); } var gravityInstruction = new Text2('Tap to reverse gravity! Collect the falling objects', { size: 40, fill: 0x333333 }); gravityInstruction.anchor.set(0.5, 0.5); gravityInstruction.x = 1024; gravityInstruction.y = 600; game.addChild(gravityInstruction); gameObjects.push(gravityInstruction); } // Game 33: Laser Beam function startGame33() { gameState = 'game33'; gameTimer = 0; laserBeams = []; laserTargets = []; hideMenu(); showBackButton(); // Create laser source var laserSource = new Player(); laserSource.x = 1024; laserSource.y = 2400; game.addChild(laserSource); gameObjects.push(laserSource); // Create targets for (var i = 0; i < 6; i++) { var target = new Target(); target.x = 300 + i * 250; target.y = 600 + Math.random() * 1000; laserTargets.push(target); game.addChild(target); gameObjects.push(target); } var laserInstruction = new Text2('Drag to aim laser, tap to fire!', { size: 40, fill: 0x333333 }); laserInstruction.anchor.set(0.5, 0.5); laserInstruction.x = 1024; laserInstruction.y = 500; game.addChild(laserInstruction); gameObjects.push(laserInstruction); } // Game 34: Shape Match function startGame34() { gameState = 'game34'; gameTimer = 0; currentShape = 0; shapesToMatch = []; hideMenu(); showBackButton(); // Create shape matching game for (var i = 0; i < 6; i++) { var shape = new Target(); shape.x = 300 + i % 3 * 400; shape.y = 800 + Math.floor(i / 3) * 300; shape.shapeType = Math.floor(Math.random() * 2); if (shape.shapeType === 1) { // Make it look different for ellipse shape.scaleY = 0.6; } shape.shapeIndex = i; shapesToMatch.push(shape); game.addChild(shape); gameObjects.push(shape); } var shapeInstruction = new Text2('Match shapes in order: Circles then Squares!', { size: 40, fill: 0x333333 }); shapeInstruction.anchor.set(0.5, 0.5); shapeInstruction.x = 1024; shapeInstruction.y = 1600; game.addChild(shapeInstruction); gameObjects.push(shapeInstruction); } // Game 35: Rhythm Tap function startGame35() { gameState = 'game35'; gameTimer = 0; rhythmBeats = []; rhythmTimer = 0; hideMenu(); showBackButton(); var rhythmInstruction = new Text2('Tap the beats as they reach the line!', { size: 40, fill: 0x333333 }); rhythmInstruction.anchor.set(0.5, 0.5); rhythmInstruction.x = 1024; rhythmInstruction.y = 500; game.addChild(rhythmInstruction); gameObjects.push(rhythmInstruction); // Create rhythm line var rhythmLine = new Platform(); rhythmLine.x = 1024; rhythmLine.y = 1800; rhythmLine.scaleY = 0.2; game.addChild(rhythmLine); gameObjects.push(rhythmLine); } // Game 36: Twisty Turn function startGame36() { gameState = 'game36'; gameTimer = 0; twistyAngle = 0; hideMenu(); showBackButton(); // Create twisty player twistyPlayer = new Player(); twistyPlayer.x = 1024; twistyPlayer.y = 1366; game.addChild(twistyPlayer); gameObjects.push(twistyPlayer); // Create rotating obstacles for (var i = 0; i < 8; i++) { var obstacle = new Obstacle(); obstacle.x = 1024; obstacle.y = 1366; obstacle.orbitRadius = 200 + i * 50; obstacle.orbitSpeed = 0.02 + i * 0.01; obstacle.orbitAngle = i * Math.PI / 4; game.addChild(obstacle); gameObjects.push(obstacle); } var twistyInstruction = new Text2('Rotate around center, avoid obstacles!', { size: 40, fill: 0x333333 }); twistyInstruction.anchor.set(0.5, 0.5); twistyInstruction.x = 1024; twistyInstruction.y = 800; game.addChild(twistyInstruction); gameObjects.push(twistyInstruction); } // Game 37: Power Surge function startGame37() { gameState = 'game37'; gameTimer = 0; powerCells = []; powerLevel = 0; hideMenu(); showBackButton(); // Create power collection grid for (var i = 0; i < 12; i++) { var cell = new Coin(); cell.x = 300 + i % 4 * 300; cell.y = 800 + Math.floor(i / 4) * 250; cell.powered = false; powerCells.push(cell); game.addChild(cell); gameObjects.push(cell); } var powerInstruction = new Text2('Collect power cells to charge up!', { size: 40, fill: 0x333333 }); powerInstruction.anchor.set(0.5, 0.5); powerInstruction.x = 1024; powerInstruction.y = 500; game.addChild(powerInstruction); gameObjects.push(powerInstruction); var powerDisplay = new Text2('Power: 0%', { size: 50, fill: 0x333333 }); powerDisplay.anchor.set(0.5, 0.5); powerDisplay.x = 1024; powerDisplay.y = 2000; game.addChild(powerDisplay); gameObjects.push(powerDisplay); } // Game 38: Mirror Magic function startGame38() { gameState = 'game38'; gameTimer = 0; mirrorObjects = []; mirrorSide = 'left'; hideMenu(); showBackButton(); // Create mirror objects on left side for (var i = 0; i < 5; i++) { var obj = new Target(); obj.x = 300; obj.y = 600 + i * 200; obj.mirrorX = 1724; // Right side mirror position obj.mirrorY = obj.y; mirrorObjects.push(obj); game.addChild(obj); gameObjects.push(obj); // Create mirror copy on right side var mirror = new Target(); mirror.x = obj.mirrorX; mirror.y = obj.mirrorY; mirror.alpha = 0.5; mirror.isMirror = true; game.addChild(mirror); gameObjects.push(mirror); } var mirrorInstruction = new Text2('Touch left objects to activate their mirrors!', { size: 40, fill: 0x333333 }); mirrorInstruction.anchor.set(0.5, 0.5); mirrorInstruction.x = 1024; mirrorInstruction.y = 500; game.addChild(mirrorInstruction); gameObjects.push(mirrorInstruction); } // Game 39: Chain React function startGame39() { gameState = 'game39'; gameTimer = 0; chainNodes = []; chainConnections = []; hideMenu(); showBackButton(); // Create chain nodes for (var i = 0; i < 15; i++) { var node = new Target(); node.x = 200 + Math.random() * 1648; node.y = 600 + Math.random() * 1500; node.activated = false; node.chainLevel = 0; chainNodes.push(node); game.addChild(node); gameObjects.push(node); } var chainInstruction = new Text2('Start a chain reaction! Touch nodes to activate neighbors', { size: 40, fill: 0x333333 }); chainInstruction.anchor.set(0.5, 0.5); chainInstruction.x = 1024; chainInstruction.y = 500; game.addChild(chainInstruction); gameObjects.push(chainInstruction); } // Game 40: Eclipse Phase function startGame40() { gameState = 'game40'; gameTimer = 0; eclipsePhase = 0; eclipseTimer = 0; hideMenu(); showBackButton(); // Create eclipse objects var sun = new Target(); sun.x = 300; sun.y = 1366; sun.tint = 0xffff00; sun.scaleX = 2; sun.scaleY = 2; game.addChild(sun); gameObjects.push(sun); var moon = new Target(); moon.x = 1724; moon.y = 1366; moon.tint = 0x808080; moon.scaleX = 1.5; moon.scaleY = 1.5; game.addChild(moon); gameObjects.push(moon); var eclipseInstruction = new Text2('Align the moon and sun to create an eclipse!', { size: 40, fill: 0x333333 }); eclipseInstruction.anchor.set(0.5, 0.5); eclipseInstruction.x = 1024; eclipseInstruction.y = 800; game.addChild(eclipseInstruction); gameObjects.push(eclipseInstruction); } // Game 41: Neon Rush function startGame41() { gameState = 'game41'; gameTimer = 0; neonTrails = []; neonSpeed = 8; hideMenu(); showBackButton(); // Create neon player var neonPlayer = new Player(); neonPlayer.x = 200; neonPlayer.y = 1366; neonPlayer.tint = 0x00ffff; game.addChild(neonPlayer); gameObjects.push(neonPlayer); var neonInstruction = new Text2('Race through the neon highway! Avoid the walls', { size: 40, fill: 0x333333 }); neonInstruction.anchor.set(0.5, 0.5); neonInstruction.x = 1024; neonInstruction.y = 600; game.addChild(neonInstruction); gameObjects.push(neonInstruction); } // Game 42: Orbit Strike function startGame42() { gameState = 'game42'; gameTimer = 0; orbitObjects = []; orbitAngle = 0; hideMenu(); showBackButton(); // Create orbit center orbitCenter = new Target(); orbitCenter.x = 1024; orbitCenter.y = 1366; orbitCenter.tint = 0xffffff; orbitCenter.scaleX = 0.5; orbitCenter.scaleY = 0.5; game.addChild(orbitCenter); gameObjects.push(orbitCenter); // Create orbiting objects for (var i = 0; i < 6; i++) { var orbitObj = new Enemy(); orbitObj.orbitRadius = 200 + i * 80; orbitObj.orbitSpeed = 0.03 - i * 0.005; orbitObj.orbitAngle = i * Math.PI / 3; orbitObjects.push(orbitObj); game.addChild(orbitObj); gameObjects.push(orbitObj); } var orbitInstruction = new Text2('Destroy orbiting enemies! Time your shots carefully', { size: 40, fill: 0x333333 }); orbitInstruction.anchor.set(0.5, 0.5); orbitInstruction.x = 1024; orbitInstruction.y = 800; game.addChild(orbitInstruction); gameObjects.push(orbitInstruction); } // Game 43: Void Walker function startGame43() { gameState = 'game43'; gameTimer = 0; voidPlatforms = []; hideMenu(); showBackButton(); // Create void player voidPlayer = new Player(); voidPlayer.x = 300; voidPlayer.y = 2000; voidPlayer.speedY = 0; game.addChild(voidPlayer); gameObjects.push(voidPlayer); // Create disappearing platforms for (var i = 0; i < 8; i++) { var platform = new Platform(); platform.x = 400 + i * 200; platform.y = 1800 - i * 150; platform.disappearTimer = 300 + i * 60; platform.solid = true; voidPlatforms.push(platform); game.addChild(platform); gameObjects.push(platform); } var voidInstruction = new Text2('Jump across void! Platforms disappear over time', { size: 40, fill: 0x333333 }); voidInstruction.anchor.set(0.5, 0.5); voidInstruction.x = 1024; voidInstruction.y = 500; game.addChild(voidInstruction); gameObjects.push(voidInstruction); } // Game 44: Prism Break function startGame44() { gameState = 'game44'; gameTimer = 0; prismColors = []; prismBeams = []; hideMenu(); showBackButton(); // Create prism objects var prismColors = [0xff0000, 0x00ff00, 0x0000ff]; for (var i = 0; i < 3; i++) { var prism = new Target(); prism.x = 300 + i * 600; prism.y = 1000; prism.tint = prismColors[i]; prism.colorIndex = i; game.addChild(prism); gameObjects.push(prism); } var prismInstruction = new Text2('Break prisms in the right color order: Red, Green, Blue!', { size: 40, fill: 0x333333 }); prismInstruction.anchor.set(0.5, 0.5); prismInstruction.x = 1024; prismInstruction.y = 1500; game.addChild(prismInstruction); gameObjects.push(prismInstruction); } // Game 45: Quantum Leap function startGame45() { gameState = 'game45'; gameTimer = 0; quantumDimensions = []; currentDimension = 0; hideMenu(); showBackButton(); // Create quantum player quantumPlayer = new Player(); quantumPlayer.x = 200; quantumPlayer.y = 1366; game.addChild(quantumPlayer); gameObjects.push(quantumPlayer); // Create dimension portals var dimensionColors = [0xff0000, 0x00ff00, 0x0000ff]; for (var i = 0; i < 3; i++) { var portal = new Target(); portal.x = 600 + i * 400; portal.y = 800 + i * 200; portal.tint = dimensionColors[i]; portal.dimension = i; quantumDimensions.push(portal); game.addChild(portal); gameObjects.push(portal); } var quantumInstruction = new Text2('Leap between quantum dimensions! Each has different rules', { size: 40, fill: 0x333333 }); quantumInstruction.anchor.set(0.5, 0.5); quantumInstruction.x = 1024; quantumInstruction.y = 500; game.addChild(quantumInstruction); gameObjects.push(quantumInstruction); } function hideMenu() { menuTitle.visible = false; game1Button.visible = false; game2Button.visible = false; game3Button.visible = false; game4Button.visible = false; game5Button.visible = false; game6Button.visible = false; game7Button.visible = false; game8Button.visible = false; game9Button.visible = false; game10Button.visible = false; game11Button.visible = false; game12Button.visible = false; game13Button.visible = false; game14Button.visible = false; game15Button.visible = false; game16Button.visible = false; game17Button.visible = false; game18Button.visible = false; game20Button.visible = false; game21Button.visible = false; game22Button.visible = false; game23Button.visible = false; game24Button.visible = false; game25Button.visible = false; game26Button.visible = false; game27Button.visible = false; game28Button.visible = false; game29Button.visible = false; game30Button.visible = false; game31Button.visible = false; game32Button.visible = false; game33Button.visible = false; game34Button.visible = false; game35Button.visible = false; game36Button.visible = false; game37Button.visible = false; game38Button.visible = false; game39Button.visible = false; game40Button.visible = false; game41Button.visible = false; game42Button.visible = false; game43Button.visible = false; game44Button.visible = false; game45Button.visible = false; } function showMenu() { menuTitle.visible = true; game1Button.visible = true; game2Button.visible = true; game3Button.visible = true; game4Button.visible = true; game5Button.visible = true; game6Button.visible = true; game7Button.visible = true; game8Button.visible = true; game9Button.visible = true; game10Button.visible = true; game11Button.visible = true; game12Button.visible = true; game13Button.visible = true; game14Button.visible = true; game15Button.visible = true; game16Button.visible = true; game17Button.visible = true; game18Button.visible = true; game20Button.visible = true; game21Button.visible = true; game22Button.visible = true; game23Button.visible = true; game24Button.visible = true; game25Button.visible = true; game26Button.visible = true; game27Button.visible = true; game28Button.visible = true; game29Button.visible = true; game30Button.visible = true; game31Button.visible = true; game32Button.visible = true; game33Button.visible = true; game34Button.visible = true; game35Button.visible = true; game36Button.visible = true; game37Button.visible = true; game38Button.visible = true; game39Button.visible = true; game40Button.visible = true; game41Button.visible = true; game42Button.visible = true; game43Button.visible = true; game44Button.visible = true; game45Button.visible = true; } function showBackButton() { backButton.visible = true; } function hideBackButton() { backButton.visible = false; } function returnToMenu() { gameState = 'menu'; // Clean up game objects for (var i = gameObjects.length - 1; i >= 0; i--) { gameObjects[i].destroy(); } gameObjects = []; blocks = []; tiles = []; snakeSegments = []; pipes = []; moles = []; holes = []; missiles = []; enemies = []; obstacles = []; coins = []; dots = []; gloves = []; punches = []; bullets = []; gunEnemies = []; walls = []; pacBalls = []; platforms = []; bombs = []; fruits = []; jumpCount = 0; ropeJumpTimer = 0; crabJumpSpeed = 0; crabGrounded = true; combaJumpCount = 0; combaPlayerJumpSpeed = 0; combaPlayerGrounded = true; combaEnemies = []; combaPoles = []; draggedPole = null; combaKillCountText = null; // Game 21 cleanup marianoObstacles = []; marianoCoins = []; marianoJumps = []; marianoSpeed = 5; marianoJumpSpeed = 0; marianoGrounded = true; marianoDistance = 0; marianoDistanceText = null; // Games 22-27 cleanup colorTargets = []; currentTargetColor = 0; ballSpeed = 8; speedTapTimer = 0; circleChaser = null; circleTarget = null; stackBlocks = []; stackHeight = 0; mazeWalls = []; mazePlayer = null; mazeExit = null; // Games 28-45 cleanup bubbles = []; bubbleTimer = 0; memorySequence = []; memoryIndex = 0; timeWarpSpeed = 1; timeWarpTargets = []; colorStormBalls = []; currentStormColor = 0; gravityObjects = []; gravityDirection = 1; laserBeams = []; laserTargets = []; currentShape = 0; shapesToMatch = []; rhythmBeats = []; rhythmTimer = 0; twistyPlayer = null; twistyAngle = 0; powerCells = []; powerLevel = 0; mirrorObjects = []; mirrorSide = 'left'; chainNodes = []; chainConnections = []; eclipsePhase = 0; eclipseTimer = 0; neonTrails = []; neonSpeed = 8; orbitCenter = null; orbitObjects = []; orbitAngle = 0; voidPlayer = null; voidPlatforms = []; prismColors = []; prismBeams = []; quantumPlayer = null; quantumDimensions = []; currentDimension = 0; // Games 28-45 variables var bubbles = []; var bubbleTimer = 0; var memorySequence = []; var memoryIndex = 0; var timeWarpSpeed = 1; var timeWarpTargets = []; var colorStormBalls = []; var stormColors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0xff00ff, 0x00ffff]; var currentStormColor = 0; var gravityObjects = []; var gravityDirection = 1; var laserBeams = []; var laserTargets = []; var shapeTypes = ['box', 'ellipse']; var currentShape = 0; var shapesToMatch = []; var rhythmBeats = []; var rhythmTimer = 0; var twistyPlayer; var twistyAngle = 0; var powerCells = []; var powerLevel = 0; var mirrorObjects = []; var mirrorSide = 'left'; var chainNodes = []; var chainConnections = []; var eclipsePhase = 0; var eclipseTimer = 0; var neonTrails = []; var neonSpeed = 8; var orbitCenter; var orbitObjects = []; var orbitAngle = 0; var voidPlayer; var voidPlatforms = []; var prismColors = []; var prismBeams = []; var quantumPlayer; var quantumDimensions = []; var currentDimension = 0; hideBackButton(); showMenu(); } // Game controls game.move = function (x, y, obj) { if (gameState === 'game2' && paddle) { paddle.x = x; if (paddle.x < 60) paddle.x = 60; if (paddle.x > 1988) paddle.x = 1988; } if (gameState === 'game8' && player) { player.x = x; if (player.x < 50) player.x = 50; if (player.x > 1998) player.x = 1998; } if (gameState === 'game9' && player) { player.y = y; if (player.y < 1800) player.y = 1800; if (player.y > 2200) player.y = 2200; } if (gameState === 'game10' && player) { pacmanX = x; pacmanY = y; if (pacmanX < 50) pacmanX = 50; if (pacmanX > 1998) pacmanX = 1998; if (pacmanY < 50) pacmanY = 50; if (pacmanY > 2682) pacmanY = 2682; player.x = pacmanX; player.y = pacmanY; } if (gameState === 'game14' && player) { player.x = x; if (player.x < 50) player.x = 50; if (player.x > 1998) player.x = 1998; } if (gameState === 'game15' && player) { player.x = x; player.y = y; if (player.x < 50) player.x = 50; if (player.x > 1998) player.x = 1998; if (player.y < 50) player.y = 50; if (player.y > 2682) player.y = 2682; } if (gameState === 'game16' && runner) { runner.x = x; if (runner.x < 50) runner.x = 50; if (runner.x > 2998) runner.x = 2998; } if (gameState === 'game18' && crab && isGreenLight) { crab.x = x; crab.y = y; if (crab.x < 50) crab.x = 50; if (crab.x > 1998) crab.x = 1998; if (crab.y < 700) crab.y = 700; if (crab.y > 2682) crab.y = 2682; } if (gameState === 'game20' && draggedPole) { draggedPole.x = x; draggedPole.y = y; if (draggedPole.x < 50) draggedPole.x = 50; if (draggedPole.x > 1998) draggedPole.x = 1998; if (draggedPole.y < 50) draggedPole.y = 50; if (draggedPole.y > 2682) draggedPole.y = 2682; } if (gameState === 'game25' && circleChaser) { circleChaser.x = x; circleChaser.y = y; if (circleChaser.x < 50) circleChaser.x = 50; if (circleChaser.x > 1998) circleChaser.x = 1998; if (circleChaser.y < 50) circleChaser.y = 50; if (circleChaser.y > 2682) circleChaser.y = 2682; } if (gameState === 'game27' && mazePlayer) { mazePlayer.x = x; mazePlayer.y = y; if (mazePlayer.x < 50) mazePlayer.x = 50; if (mazePlayer.x > 1998) mazePlayer.x = 1998; if (mazePlayer.y < 50) mazePlayer.y = 50; if (mazePlayer.y > 2682) mazePlayer.y = 2682; } }; game.down = function (x, y, obj) { if (gameState === 'game4') { tapCount++; LK.setScore(LK.getScore() + 1); scoreText.setText(LK.getScore()); // Update tap count display if (gameObjects.length > 1) { gameObjects[1].setText('Taps: ' + tapCount); } } if (gameState === 'game5') { // Change snake direction based on tap position if (x < 1024) { snakeDirection = 'left'; } else { snakeDirection = 'right'; } } if (gameState === 'game6' && bird) { bird.speedY = -10; } if (gameState === 'game8' && player) { var missile = new Missile(); missile.x = player.x; missile.y = player.y - 50; missiles.push(missile); game.addChild(missile); gameObjects.push(missile); } if (gameState === 'game11' && football && !football.kicked) { var targetX = x; var targetY = y; football.speedX = (targetX - football.x) * 0.1; football.speedY = (targetY - football.y) * 0.1; football.kicked = true; LK.getSound('hit').play(); } if (gameState === 'game12') { var punch = new Punch(); punch.x = x; punch.y = y; punches.push(punch); game.addChild(punch); gameObjects.push(punch); LK.getSound('hit').play(); } if (gameState === 'game14' && player) { var bullet = new Bullet(); bullet.x = player.x; bullet.y = player.y - 50; bullets.push(bullet); game.addChild(bullet); gameObjects.push(bullet); LK.getSound('shoot').play(); } if (gameState === 'game15' && player) { var pacBall = new PacBall(); pacBall.x = player.x; pacBall.y = player.y; pacBall.speedX = (x - player.x) * 0.1; pacBall.speedY = (y - player.y) * 0.1; pacBalls.push(pacBall); game.addChild(pacBall); gameObjects.push(pacBall); LK.getSound('shoot').play(); } if (gameState === 'game16' && runner) { runner.speedY = -15; runner.grounded = false; LK.getSound('jump').play(); } if (gameState === 'game19' && crab && crabGrounded) { crabJumpSpeed = -15; crabGrounded = false; LK.getSound('jump').play(); } if (gameState === 'game20') { // Check if tapping on a pole draggedPole = null; for (var i = 0; i < combaPoles.length; i++) { if (Math.abs(combaPoles[i].x - x) < 100 && Math.abs(combaPoles[i].y - y) < 100) { draggedPole = combaPoles[i]; break; } } } if (gameState === 'game21' && marianoPlayer && marianoGrounded) { marianoJumpSpeed = -18; marianoGrounded = false; LK.getSound('jump').play(); } if (gameState === 'game22') { // Check color sequence for (var i = 0; i < colorTargets.length; i++) { if (colorTargets[i].intersects({ x: x, y: y, width: 10, height: 10 })) { if (i === currentTargetColor) { currentTargetColor++; LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('score').play(); if (currentTargetColor >= colorTargets.length) { LK.showYouWin(); } } else { LK.showGameOver(); } break; } } } if (gameState === 'game26') { // Drop a block var block = new Block(); block.x = 1024; block.y = 400; block.speedY = 5; stackBlocks.push(block); game.addChild(block); gameObjects.push(block); } // Game 28: Bubble Pop controls if (gameState === 'game28') { // Check bubble taps for (var i = bubbles.length - 1; i >= 0; i--) { if (bubbles[i] && Math.abs(bubbles[i].x - x) < 60 && Math.abs(bubbles[i].y - y) < 60) { bubbles[i].destroy(); bubbles.splice(i, 1); LK.setScore(LK.getScore() + 5); scoreText.setText(LK.getScore()); LK.getSound('hit').play(); break; } } } // Game 32: Gravity Fall controls if (gameState === 'game32') { gravityDirection = -gravityDirection; } // Game 33: Laser Beam controls if (gameState === 'game33') { // Fire laser beam var beam = new Bullet(); beam.x = gameObjects[0].x; // laser source beam.y = gameObjects[0].y; beam.speedX = (x - beam.x) * 0.2; beam.speedY = (y - beam.y) * 0.2; laserBeams.push(beam); game.addChild(beam); gameObjects.push(beam); LK.getSound('shoot').play(); } // Game 35: Rhythm Tap controls if (gameState === 'game35') { // Check if tapping on rhythm beat for (var i = rhythmBeats.length - 1; i >= 0; i--) { if (rhythmBeats[i] && Math.abs(rhythmBeats[i].y - 1800) < 50) { rhythmBeats[i].destroy(); rhythmBeats.splice(i, 1); LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('score').play(); break; } } } // Game 43: Void Walker controls if (gameState === 'game43' && voidPlayer) { voidPlayer.speedY = -15; LK.getSound('jump').play(); } }; game.up = function (x, y, obj) { if (gameState === 'game20') { draggedPole = null; } }; game.update = function () { if (gameState === 'menu') { return; } gameTimer++; // Update game objects for (var i = gameObjects.length - 1; i >= 0; i--) { var obj = gameObjects[i]; if (obj.shouldDestroy) { obj.destroy(); gameObjects.splice(i, 1); } } // Game specific updates if (gameState === 'game2') { // Ball collision with paddle if (ball && paddle && ball.intersects(paddle) && ball.speedY > 0) { ball.speedY = -ball.speedY; LK.getSound('hit').play(); } // Ball collision with blocks for (var i = blocks.length - 1; i >= 0; i--) { if (ball && ball.intersects(blocks[i])) { ball.speedY = -ball.speedY; blocks[i].destroy(); blocks.splice(i, 1); LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('score').play(); } } // Check win condition if (blocks.length === 0) { LK.getSound('complete').play(); LK.showYouWin(); } } if (gameState === 'game3') { // Check if all tiles have been clicked in order var allClicked = true; for (var i = 0; i < tiles.length; i++) { if (tiles[i].isTarget) { allClicked = false; break; } } if (allClicked && tiles.length > 0) { // Set next target var nextIndex = Math.floor(Math.random() * tiles.length); tiles[nextIndex].setAsTarget(); } } if (gameState === 'game4') { tapTimer--; if (gameObjects.length > 2) { gameObjects[2].setText('Time: ' + Math.ceil(tapTimer / 60)); } if (tapTimer <= 0) { LK.getSound('complete').play(); if (tapCount >= 50) { LK.showYouWin(); } else { LK.showGameOver(); } } } if (gameState === 'game5') { // Snake movement if (gameTimer % 10 === 0 && snakeSegments.length > 0) { var head = snakeSegments[0]; var newX = head.x; var newY = head.y; if (snakeDirection === 'right') newX += 40; if (snakeDirection === 'left') newX -= 40; if (snakeDirection === 'up') newY -= 40; if (snakeDirection === 'down') newY += 40; // Check boundaries if (newX < 20 || newX > 2028 || newY < 20 || newY > 2712) { LK.showGameOver(); return; } // Check food collision if (food && Math.abs(newX - food.x) < 40 && Math.abs(newY - food.y) < 40) { LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('score').play(); // Add new segment var newSegment = new SnakeSegment(); newSegment.x = newX; newSegment.y = newY; snakeSegments.unshift(newSegment); game.addChild(newSegment); gameObjects.push(newSegment); // Move food food.x = 200 + Math.random() * 1648; food.y = 200 + Math.random() * 2332; } else { // Move snake for (var i = snakeSegments.length - 1; i > 0; i--) { snakeSegments[i].x = snakeSegments[i - 1].x; snakeSegments[i].y = snakeSegments[i - 1].y; } head.x = newX; head.y = newY; } } } if (gameState === 'game6') { // Bird collision with pipes if (bird) { for (var i = 0; i < pipes.length; i++) { if (bird.intersects(pipes[i])) { LK.showGameOver(); return; } } } } if (gameState === 'game8') { // Missile collision with enemies for (var i = missiles.length - 1; i >= 0; i--) { for (var j = enemies.length - 1; j >= 0; j--) { if (missiles[i] && enemies[j] && missiles[i].intersects(enemies[j])) { missiles[i].destroy(); missiles.splice(i, 1); enemies[j].destroy(); enemies.splice(j, 1); LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('hit').play(); break; } } } // Player collision with enemies if (player) { for (var i = 0; i < enemies.length; i++) { if (player.intersects(enemies[i])) { LK.showGameOver(); return; } } } } if (gameState === 'game9') { // Player collision with obstacles if (player) { for (var i = 0; i < obstacles.length; i++) { if (player.intersects(obstacles[i])) { LK.showGameOver(); return; } } } } if (gameState === 'game10') { // Check if all dots collected var allDotsCollected = true; for (var i = 0; i < dots.length; i++) { if (!dots[i].collected) { allDotsCollected = false; break; } } if (allDotsCollected) { LK.getSound('complete').play(); LK.showYouWin(); } } if (gameState === 'game11') { // Check if football hits goal if (football && football.kicked && goal && football.intersects(goal)) { // Check if goalkeeper is not blocking if (!goalkeeper || !football.intersects(goalkeeper)) { LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('score').play(); } // Reset football football.x = 1024; football.y = 2200; football.kicked = false; football.speedX = 0; football.speedY = 0; } } if (gameState === 'game12') { // Check punch collision with gloves for (var i = punches.length - 1; i >= 0; i--) { for (var j = gloves.length - 1; j >= 0; j--) { if (punches[i] && gloves[j] && punches[i].intersects(gloves[j])) { punches[i].destroy(); punches.splice(i, 1); gloves[j].destroy(); gloves.splice(j, 1); LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('hit').play(); break; } } } } if (gameState === 'game13') { // Roulette auto-updates through its own update method // Color changes are handled by the interval in startGame13 } if (gameState === 'game14') { // Bullet collision with enemies for (var i = bullets.length - 1; i >= 0; i--) { for (var j = gunEnemies.length - 1; j >= 0; j--) { if (bullets[i] && gunEnemies[j] && bullets[i].intersects(gunEnemies[j])) { bullets[i].destroy(); bullets.splice(i, 1); gunEnemies[j].destroy(); gunEnemies.splice(j, 1); LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('hit').play(); break; } } } // Player collision with enemies if (player) { for (var i = 0; i < gunEnemies.length; i++) { if (player.intersects(gunEnemies[i])) { LK.showGameOver(); return; } } } } if (gameState === 'game15') { // Ball collision with walls for (var i = pacBalls.length - 1; i >= 0; i--) { for (var j = 0; j < walls.length; j++) { if (pacBalls[i] && pacBalls[i].intersects(walls[j])) { pacBalls[i].destroy(); pacBalls.splice(i, 1); break; } } } // Player collision with walls if (player) { for (var i = 0; i < walls.length; i++) { if (player.intersects(walls[i])) { // Push player back if (player.x < walls[i].x) player.x = walls[i].x - 100;else player.x = walls[i].x + 100; if (player.y < walls[i].y) player.y = walls[i].y - 100;else player.y = walls[i].y + 100; } } } } if (gameState === 'game16') { // Runner collision with platforms if (runner) { runner.grounded = false; for (var i = 0; i < platforms.length; i++) { if (runner.intersects(platforms[i]) && runner.speedY >= 0) { runner.y = platforms[i].y - 30; runner.speedY = 0; runner.grounded = true; break; } } // Check if runner reached the end if (runner.x > 2900) { LK.getSound('complete').play(); LK.showYouWin(); } } } if (gameState === 'game17') { // Clean up destroyed bombs and fruits for (var i = bombs.length - 1; i >= 0; i--) { if (bombs[i].shouldDestroy) { bombs.splice(i, 1); } } for (var i = fruits.length - 1; i >= 0; i--) { if (fruits[i].shouldDestroy) { fruits.splice(i, 1); } } } if (gameState === 'game18') { // Check if crab moved during red light if (crab && isRedLight && crab.isMoving) { returnToMenu(); return; } // Check if crab reached finish line if (crab && crab.y <= 650) { LK.setScore(LK.getScore() + 100); scoreText.setText(LK.getScore()); LK.getSound('complete').play(); // Transition to rope jumping game startGame19(); } } if (gameState === 'game19') { // Update crab physics if (crab) { crabJumpSpeed += 0.8; // gravity crab.y += crabJumpSpeed; // Ground collision if (crab.y >= 2000) { crab.y = 2000; crabJumpSpeed = 0; crabGrounded = true; } } // Check rope collision with crab - crab must touch rope if (rope && crab && crab.intersects(rope) && rope.isAtBottom && !crabGrounded) { LK.showGameOver(); return; } // Check successful jump if (rope && crab && rope.lastIsAtBottom && !rope.isAtBottom && crab.y < 1800 && crabGrounded) { jumpCount++; LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('score').play(); // Update jump count display if (gameObjects.length > 1) { gameObjects[1].setText('Jumps: ' + jumpCount); } } // Track rope position for jump detection if (rope) { rope.lastIsAtBottom = rope.isAtBottom; } // Check win condition if (jumpCount >= 10) { LK.getSound('complete').play(); LK.showYouWin(); } } if (gameState === 'game20') { // Check pole collision with enemies for (var i = combaPoles.length - 1; i >= 0; i--) { for (var j = combaEnemies.length - 1; j >= 0; j--) { if (combaPoles[i] && combaEnemies[j] && combaPoles[i].intersects(combaEnemies[j])) { combaEnemies[j].destroy(); combaEnemies.splice(j, 1); combaJumpCount++; LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('hit').play(); // Update kill count display if (combaKillCountText) { combaKillCountText.setText('Kills: ' + combaJumpCount); } break; } } } // Clean up destroyed enemies for (var i = combaEnemies.length - 1; i >= 0; i--) { if (combaEnemies[i].shouldDestroy) { combaEnemies.splice(i, 1); } } // Check win condition if (combaJumpCount >= 20) { LK.getSound('complete').play(); LK.showYouWin(); } } if (gameState === 'game21') { // Update mariano player physics if (marianoPlayer) { marianoJumpSpeed += 0.8; // gravity marianoPlayer.y += marianoJumpSpeed; // Ground collision if (marianoPlayer.y >= 2000) { marianoPlayer.y = 2000; marianoJumpSpeed = 0; marianoGrounded = true; } // Move world backward (running effect) marianoDistance += marianoSpeed; if (marianoDistanceText) { marianoDistanceText.setText('Distance: ' + Math.floor(marianoDistance / 10) + 'm'); } // Move obstacles for (var i = marianoObstacles.length - 1; i >= 0; i--) { marianoObstacles[i].x -= marianoSpeed; if (marianoObstacles[i].x < -100) { marianoObstacles[i].x = 2500 + Math.random() * 500; } } // Move coins for (var i = marianoCoins.length - 1; i >= 0; i--) { marianoCoins[i].x -= marianoSpeed; if (marianoCoins[i].x < -100) { marianoCoins[i].x = 2500 + Math.random() * 500; marianoCoins[i].y = 1400 + Math.random() * 400; } } // Move platforms for (var i = marianoJumps.length - 1; i >= 0; i--) { marianoJumps[i].x -= marianoSpeed; if (marianoJumps[i].x < -100) { marianoJumps[i].x = 2500 + Math.random() * 500; marianoJumps[i].y = 1000 + Math.random() * 800; } } // Platform collision marianoGrounded = false; for (var i = 0; i < marianoJumps.length; i++) { if (marianoPlayer.intersects(marianoJumps[i]) && marianoJumpSpeed >= 0) { marianoPlayer.y = marianoJumps[i].y - 25; marianoJumpSpeed = 0; marianoGrounded = true; break; } } // Ground collision check if (marianoPlayer.y >= 2000) { marianoPlayer.y = 2000; marianoJumpSpeed = 0; marianoGrounded = true; } // Obstacle collision for (var i = 0; i < marianoObstacles.length; i++) { if (marianoPlayer.intersects(marianoObstacles[i])) { LK.showGameOver(); return; } } // Coin collection for (var i = marianoCoins.length - 1; i >= 0; i--) { if (marianoPlayer.intersects(marianoCoins[i])) { LK.setScore(LK.getScore() + 10); scoreText.setText(LK.getScore()); LK.getSound('score').play(); marianoCoins[i].x = 2500 + Math.random() * 500; marianoCoins[i].y = 1400 + Math.random() * 400; } } // Increase speed over time marianoSpeed += 0.001; if (marianoSpeed > 12) marianoSpeed = 12; // Win condition - survive for distance if (marianoDistance > 5000) { LK.getSound('complete').play(); LK.showYouWin(); } } } if (gameState === 'game24') { speedTapTimer--; if (gameObjects.length > 1) { gameObjects[1].setText('Time: ' + Math.ceil(speedTapTimer / 60)); } if (speedTapTimer <= 0) { LK.getSound('complete').play(); if (LK.getScore() >= 50) { LK.showYouWin(); } else { LK.showGameOver(); } } } if (gameState === 'game25') { // Move target randomly if (circleTarget && gameTimer % 120 === 0) { circleTarget.x = 300 + Math.random() * 1400; circleTarget.y = 300 + Math.random() * 2000; } // Check if chaser caught target if (circleChaser && circleTarget && circleChaser.intersects(circleTarget)) { LK.setScore(LK.getScore() + 20); scoreText.setText(LK.getScore()); LK.getSound('score').play(); circleTarget.x = 300 + Math.random() * 1400; circleTarget.y = 300 + Math.random() * 2000; if (LK.getScore() >= 100) { LK.showYouWin(); } } } if (gameState === 'game26') { // Update falling blocks for (var i = stackBlocks.length - 1; i >= 0; i--) { if (stackBlocks[i].speedY !== undefined) { stackBlocks[i].y += stackBlocks[i].speedY; // Check if block landed if (stackBlocks[i].y >= 2400 - stackHeight * 90) { stackBlocks[i].y = 2400 - stackHeight * 90 - 45; stackBlocks[i].speedY = undefined; stackHeight++; LK.setScore(LK.getScore() + 5); scoreText.setText(LK.getScore()); LK.getSound('score').play(); if (gameObjects.length > 1) { gameObjects[1].setText('Height: ' + stackHeight); } if (stackHeight >= 10) { LK.showYouWin(); } } } } } if (gameState === 'game27') { // Check wall collisions if (mazePlayer) { for (var i = 0; i < mazeWalls.length; i++) { if (mazePlayer.intersects(mazeWalls[i])) { // Push player back if (mazePlayer.x < mazeWalls[i].x) mazePlayer.x = mazeWalls[i].x - 100;else mazePlayer.x = mazeWalls[i].x + 100; if (mazePlayer.y < mazeWalls[i].y) mazePlayer.y = mazeWalls[i].y - 100;else mazePlayer.y = mazeWalls[i].y + 100; } } // Check if reached exit if (mazeExit && mazePlayer.intersects(mazeExit)) { LK.getSound('complete').play(); LK.showYouWin(); } } } // Game 28: Bubble Pop updates if (gameState === 'game28') { bubbleTimer++; if (bubbleTimer % 60 === 0) { var bubble = new Target(); bubble.x = 200 + Math.random() * 1648; bubble.y = 2732; bubble.speedY = -2 - Math.random() * 3; bubble.tint = 0x87CEEB; bubbles.push(bubble); game.addChild(bubble); gameObjects.push(bubble); } // Move bubbles up for (var i = bubbles.length - 1; i >= 0; i--) { if (bubbles[i]) { bubbles[i].y += bubbles[i].speedY; if (bubbles[i].y < 0) { LK.showGameOver(); return; } } } } // Game 30: Time Warp updates if (gameState === 'game30') { timeWarpSpeed = 1 + Math.sin(gameTimer * 0.05) * 0.5; for (var i = 0; i < timeWarpTargets.length; i++) { if (timeWarpTargets[i]) { timeWarpTargets[i].rotation += timeWarpTargets[i].timeSpeed * timeWarpSpeed * 0.1; timeWarpTargets[i].scaleX = 1 + Math.sin(gameTimer * timeWarpTargets[i].timeSpeed * 0.1) * 0.3; timeWarpTargets[i].scaleY = timeWarpTargets[i].scaleX; } } } // Game 31: Color Storm updates if (gameState === 'game31') { if (gameTimer % 90 === 0) { var ball = new Target(); ball.x = Math.random() * 2048; ball.y = 0; ball.speedY = 3 + Math.random() * 4; ball.ballColor = Math.floor(Math.random() * stormColors.length); ball.tint = stormColors[ball.ballColor]; colorStormBalls.push(ball); game.addChild(ball); gameObjects.push(ball); } if (gameTimer % 300 === 0) { currentStormColor = (currentStormColor + 1) % stormColors.length; gameObjects[1].tint = stormColors[currentStormColor]; } } // Game 32: Gravity Fall updates if (gameState === 'game32') { for (var i = 0; i < gravityObjects.length; i++) { if (gravityObjects[i]) { gravityObjects[i].gravitySpeed += gravityDirection * 0.5; gravityObjects[i].y += gravityObjects[i].gravitySpeed; if (gravityObjects[i].y < 0 || gravityObjects[i].y > 2732) { gravityObjects[i].y = 1366; gravityObjects[i].gravitySpeed = 0; } } } } // Game 35: Rhythm Tap updates if (gameState === 'game35') { rhythmTimer++; if (rhythmTimer % 120 === 0) { var beat = new Target(); beat.x = 1024; beat.y = 200; beat.speedY = 8; beat.tint = 0xff0000; rhythmBeats.push(beat); game.addChild(beat); gameObjects.push(beat); } for (var i = rhythmBeats.length - 1; i >= 0; i--) { if (rhythmBeats[i]) { rhythmBeats[i].y += rhythmBeats[i].speedY; if (rhythmBeats[i].y > 2000) { rhythmBeats[i].destroy(); rhythmBeats.splice(i, 1); } } } } // Game 36: Twisty Turn updates if (gameState === 'game36') { twistyAngle += 0.05; if (twistyPlayer) { twistyPlayer.x = 1024 + Math.cos(twistyAngle) * 150; twistyPlayer.y = 1366 + Math.sin(twistyAngle) * 150; } // Update orbiting obstacles for (var i = 2; i < gameObjects.length; i++) { if (gameObjects[i] && gameObjects[i].orbitRadius) { gameObjects[i].orbitAngle += gameObjects[i].orbitSpeed; gameObjects[i].x = 1024 + Math.cos(gameObjects[i].orbitAngle) * gameObjects[i].orbitRadius; gameObjects[i].y = 1366 + Math.sin(gameObjects[i].orbitAngle) * gameObjects[i].orbitRadius; if (twistyPlayer && twistyPlayer.intersects(gameObjects[i])) { LK.showGameOver(); return; } } } } // Game 42: Orbit Strike updates if (gameState === 'game42') { orbitAngle += 0.02; for (var i = 0; i < orbitObjects.length; i++) { if (orbitObjects[i]) { orbitObjects[i].orbitAngle += orbitObjects[i].orbitSpeed; orbitObjects[i].x = 1024 + Math.cos(orbitObjects[i].orbitAngle) * orbitObjects[i].orbitRadius; orbitObjects[i].y = 1366 + Math.sin(orbitObjects[i].orbitAngle) * orbitObjects[i].orbitRadius; } } } // Game 43: Void Walker updates if (gameState === 'game43') { if (voidPlayer) { voidPlayer.speedY += 0.8; voidPlayer.y += voidPlayer.speedY; // Platform collision for (var i = 0; i < voidPlatforms.length; i++) { if (voidPlatforms[i] && voidPlatforms[i].solid && voidPlayer.intersects(voidPlatforms[i]) && voidPlayer.speedY >= 0) { voidPlayer.y = voidPlatforms[i].y - 25; voidPlayer.speedY = 0; } } // Update platform timers for (var i = 0; i < voidPlatforms.length; i++) { if (voidPlatforms[i] && voidPlatforms[i].solid) { voidPlatforms[i].disappearTimer--; if (voidPlatforms[i].disappearTimer <= 0) { voidPlatforms[i].solid = false; voidPlatforms[i].alpha = 0.3; } } } if (voidPlayer.y > 2732) { LK.showGameOver(); return; } if (voidPlayer.x > 1800) { LK.showYouWin(); } } } }; // Initialize hideBackButton(); showMenu(); LK.playMusic('bgmusic'); ;
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var ActionButton = Container.expand(function (text, action) {
var self = Container.call(this);
var buttonBg = self.attachAsset('button', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2(text, {
size: 48,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.action = action;
self.down = function (x, y, obj) {
tween(self, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 100,
easing: tween.easeOut
});
}
});
if (self.action) {
self.action();
}
};
return self;
});
var Ball = Container.expand(function () {
var self = Container.call(this);
var ballGraphics = self.attachAsset('ball', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedX = 0;
self.speedY = 0;
self.update = function () {
self.x += self.speedX;
self.y += self.speedY;
// Bounce off walls
if (self.x <= 30 || self.x >= 2018) {
self.speedX = -self.speedX;
}
if (self.y <= 30) {
self.speedY = -self.speedY;
}
// Check if ball went off bottom
if (self.y > 2732) {
self.shouldDestroy = true;
}
};
return self;
});
var Bird = Container.expand(function () {
var self = Container.call(this);
var birdGraphics = self.attachAsset('bird', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedY = 0;
self.update = function () {
self.speedY += 0.5;
self.y += self.speedY;
if (self.y > 2732) {
self.shouldDestroy = true;
}
};
return self;
});
var Block = Container.expand(function () {
var self = Container.call(this);
var blockGraphics = self.attachAsset('block', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
var Bomb = Container.expand(function () {
var self = Container.call(this);
var bombGraphics = self.attachAsset('bomb', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedX = (Math.random() - 0.5) * 8;
self.speedY = -Math.random() * 8 - 5;
self.gravity = 0.3;
self.sliced = false;
self.update = function () {
self.x += self.speedX;
self.y += self.speedY;
self.speedY += self.gravity;
// Make bombs spin
bombGraphics.rotation += 0.1;
if (self.y > 2800) {
self.shouldDestroy = true;
}
};
self.down = function (x, y, obj) {
if (!self.sliced) {
self.sliced = true;
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
self.shouldDestroy = true;
// Spawn 3 fruits that launch very high when bomb explodes
if (gameState === 'game17') {
for (var i = 0; i < 3; i++) {
var fruit = new Fruit();
fruit.x = self.x + (Math.random() - 0.5) * 200;
fruit.y = self.y;
fruit.speedX = (Math.random() - 0.5) * 20;
fruit.speedY = -Math.random() * 30 - 25; // Launch very high
fruits.push(fruit);
game.addChild(fruit);
gameObjects.push(fruit);
}
}
}
};
return self;
});
var BoxingGlove = Container.expand(function () {
var self = Container.call(this);
var gloveGraphics = self.attachAsset('glove', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedY = 2;
self.update = function () {
self.y += self.speedY;
if (self.y > 2732) {
self.shouldDestroy = true;
}
};
self.down = function (x, y, obj) {
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('hit').play();
self.shouldDestroy = true;
};
return self;
});
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedY = -10;
self.update = function () {
self.y += self.speedY;
if (self.y < -50) {
self.shouldDestroy = true;
}
};
return self;
});
var Coin = Container.expand(function () {
var self = Container.call(this);
var coinGraphics = self.attachAsset('coin', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedX = -5;
self.update = function () {
self.x += self.speedX;
if (self.x < -100) {
self.shouldDestroy = true;
}
};
self.down = function (x, y, obj) {
LK.setScore(LK.getScore() + 5);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
self.shouldDestroy = true;
};
return self;
});
var Crab = Container.expand(function () {
var self = Container.call(this);
var crabGraphics = self.attachAsset('crab', {
anchorX: 0.5,
anchorY: 0.5
});
self.isMoving = false;
self.lastY = 0;
self.update = function () {
// Track movement during red light
if (self.lastY === undefined) self.lastY = self.y;
if (isRedLight && Math.abs(self.y - self.lastY) > 5) {
self.isMoving = true;
} else if (isGreenLight) {
self.isMoving = false;
}
self.lastY = self.y;
};
return self;
});
var Dot = Container.expand(function () {
var self = Container.call(this);
var dotGraphics = self.attachAsset('dot', {
anchorX: 0.5,
anchorY: 0.5
});
self.collected = false;
self.down = function (x, y, obj) {
if (!self.collected) {
self.collected = true;
LK.setScore(LK.getScore() + 1);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
dotGraphics.alpha = 0.3;
}
};
return self;
});
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedY = 3;
self.update = function () {
self.y += self.speedY;
if (self.y > 2732) {
self.shouldDestroy = true;
}
};
return self;
});
var Food = Container.expand(function () {
var self = Container.call(this);
var foodGraphics = self.attachAsset('food', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
var Football = Container.expand(function () {
var self = Container.call(this);
var footballGraphics = self.attachAsset('football', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedX = 0;
self.speedY = 0;
self.kicked = false;
self.update = function () {
if (self.kicked) {
self.x += self.speedX;
self.y += self.speedY;
if (self.y < -50 || self.x < -50 || self.x > 2098) {
self.shouldDestroy = true;
}
}
};
return self;
});
var Fruit = Container.expand(function () {
var self = Container.call(this);
var fruitGraphics = self.attachAsset('fruit', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedX = (Math.random() - 0.5) * 16;
self.speedY = -Math.random() * 25 - 20;
self.gravity = 0.3;
self.sliced = false;
self.update = function () {
self.x += self.speedX;
self.y += self.speedY;
self.speedY += self.gravity;
if (self.y > 2800) {
self.shouldDestroy = true;
}
};
self.down = function (x, y, obj) {
if (!self.sliced) {
self.sliced = true;
LK.getSound('hit').play();
LK.showGameOver();
}
};
return self;
});
var Goal = Container.expand(function () {
var self = Container.call(this);
var goalGraphics = self.attachAsset('goal', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
var Goalkeeper = Container.expand(function () {
var self = Container.call(this);
var keeperGraphics = self.attachAsset('goalkeeper', {
anchorX: 0.5,
anchorY: 0.5
});
self.direction = 1;
self.update = function () {
self.x += self.direction * 2;
if (self.x <= 724 || self.x >= 1324) {
self.direction = -self.direction;
}
};
return self;
});
var GunEnemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('gunEnemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedY = 2;
self.update = function () {
self.y += self.speedY;
if (self.y > 2732) {
self.shouldDestroy = true;
}
};
self.down = function (x, y, obj) {
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('hit').play();
self.shouldDestroy = true;
};
return self;
});
var Hole = Container.expand(function () {
var self = Container.call(this);
var holeGraphics = self.attachAsset('hole', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
var Light = Container.expand(function () {
var self = Container.call(this);
var lightGraphics = self.attachAsset('light', {
anchorX: 0.5,
anchorY: 0.5
});
self.isRed = false;
self.setRed = function () {
self.isRed = true;
lightGraphics.tint = 0xff0000;
};
self.setGreen = function () {
self.isRed = false;
lightGraphics.tint = 0x00ff00;
};
return self;
});
var Missile = Container.expand(function () {
var self = Container.call(this);
var missileGraphics = self.attachAsset('missile', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedY = -8;
self.update = function () {
self.y += self.speedY;
if (self.y < -50) {
self.shouldDestroy = true;
}
};
return self;
});
var Mole = Container.expand(function () {
var self = Container.call(this);
var moleGraphics = self.attachAsset('mole', {
anchorX: 0.5,
anchorY: 0.5
});
self.isUp = false;
self.down = function (x, y, obj) {
if (self.isUp) {
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('hit').play();
self.isUp = false;
self.y += 30;
}
};
return self;
});
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedX = -5;
self.update = function () {
self.x += self.speedX;
if (self.x < -100) {
self.shouldDestroy = true;
}
};
return self;
});
var PacBall = Container.expand(function () {
var self = Container.call(this);
var ballGraphics = self.attachAsset('pacBall', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedX = 0;
self.speedY = 0;
self.update = function () {
self.x += self.speedX;
self.y += self.speedY;
if (self.x < -50 || self.x > 2098 || self.y < -50 || self.y > 2782) {
self.shouldDestroy = true;
}
};
return self;
});
var Paddle = Container.expand(function () {
var self = Container.call(this);
var paddleGraphics = self.attachAsset('paddle', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
var Pipe = Container.expand(function () {
var self = Container.call(this);
var pipeGraphics = self.attachAsset('pipe', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedX = -3;
self.update = function () {
self.x += self.speedX;
if (self.x < -100) {
self.shouldDestroy = true;
}
};
return self;
});
var Platform = Container.expand(function () {
var self = Container.call(this);
var platformGraphics = self.attachAsset('platform', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
var Pointer = Container.expand(function () {
var self = Container.call(this);
var pointerGraphics = self.attachAsset('pointer', {
anchorX: 0.5,
anchorY: 1
});
return self;
});
var Punch = Container.expand(function () {
var self = Container.call(this);
var punchGraphics = self.attachAsset('punch', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedY = -10;
self.update = function () {
self.y += self.speedY;
if (self.y < -50) {
self.shouldDestroy = true;
}
};
return self;
});
var Rope = Container.expand(function () {
var self = Container.call(this);
var ropeGraphics = self.attachAsset('rope', {
anchorX: 0.5,
anchorY: 0.5
});
self.isDragging = false;
self.update = function () {
// No automatic movement - only moves when dragged
};
self.down = function (x, y, obj) {
self.isDragging = true;
};
self.up = function (x, y, obj) {
self.isDragging = false;
};
return self;
});
var Roulette = Container.expand(function () {
var self = Container.call(this);
var rouletteGraphics = self.attachAsset('roulette', {
anchorX: 0.5,
anchorY: 0.5
});
self.colors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0xff00ff, 0x00ffff];
self.currentColor = 0;
self.rotation = 0;
self.spinning = false;
self.spinSpeed = 0;
self.changeColor = function () {
self.currentColor = (self.currentColor + 1) % self.colors.length;
rouletteGraphics.tint = self.colors[self.currentColor];
};
self.spin = function () {
self.spinning = true;
self.spinSpeed = 0.2;
};
self.update = function () {
if (self.spinning) {
self.rotation += self.spinSpeed;
rouletteGraphics.rotation = self.rotation;
self.spinSpeed *= 0.98;
if (self.spinSpeed < 0.01) {
self.spinning = false;
self.spinSpeed = 0;
}
}
};
self.down = function (x, y, obj) {
if (!self.spinning) {
self.spin();
LK.setScore(LK.getScore() + 1);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
}
};
return self;
});
var Runner = Container.expand(function () {
var self = Container.call(this);
var runnerGraphics = self.attachAsset('runner', {
anchorX: 0.5,
anchorY: 0.5
});
self.speedY = 0;
self.grounded = false;
self.update = function () {
self.speedY += 0.8;
self.y += self.speedY;
if (self.y > 2732) {
self.shouldDestroy = true;
}
};
return self;
});
var SnakeSegment = Container.expand(function () {
var self = Container.call(this);
var segmentGraphics = self.attachAsset('snake', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
var Target = Container.expand(function () {
var self = Container.call(this);
var targetGraphics = self.attachAsset('target', {
anchorX: 0.5,
anchorY: 0.5
});
self.down = function (x, y, obj) {
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
self.shouldDestroy = true;
};
return self;
});
var Tile = Container.expand(function () {
var self = Container.call(this);
var tileGraphics = self.attachAsset('tile', {
anchorX: 0.5,
anchorY: 0.5
});
self.originalColor = 0x8a2be2;
self.targetColor = 0xffd700;
self.isTarget = false;
self.setAsTarget = function () {
self.isTarget = true;
tileGraphics.tint = self.targetColor;
};
self.down = function (x, y, obj) {
if (self.isTarget) {
LK.setScore(LK.getScore() + 5);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
self.isTarget = false;
tileGraphics.tint = self.originalColor;
}
};
return self;
});
var Wall = Container.expand(function () {
var self = Container.call(this);
var wallGraphics = self.attachAsset('wall', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Score display
var scoreText = new Text2('0', {
size: 72,
fill: 0x333333
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
// Game state variables
var gameState = 'menu'; // 'menu', 'game1' to 'game45' - Complete collection of innovative mini-games
var gameTimer = 0;
var gameObjects = [];
var snakeSegments = [];
var snakeDirection = 'right';
var food;
var pipes = [];
var bird;
var moles = [];
var holes = [];
var missiles = [];
var enemies = [];
var player;
var obstacles = [];
var coins = [];
var dots = [];
var pacmanX = 1024;
var pacmanY = 1366;
var football;
var goal;
var goalkeeper;
var gloves = [];
var punches = [];
var roulette;
var pointer;
var bullets = [];
var gunEnemies = [];
var walls = [];
var pacBalls = [];
var platforms = [];
var runner;
var runnerSpeed = 0;
var runnerY = 2000;
var bombs = [];
var fruits = [];
var crab;
var light;
var isRedLight = false;
var isGreenLight = true;
var lightTimer = 0;
var finishLine;
var rope;
var jumpCount = 0;
var ropeJumpTimer = 0;
var crabJumpSpeed = 0;
var crabGrounded = true;
var combaRope;
var combaPlayer;
var combaJumpCount = 0;
var combaPlayerJumpSpeed = 0;
var combaPlayerGrounded = true;
var combaEnemies = [];
var combaPoles = [];
var draggedPole = null;
var combaKillCountText = null;
// Game 21: Mariano el Brosiano (Parkour) variables
var marianoPlayer;
var marianoObstacles = [];
var marianoCoins = [];
var marianoJumps = [];
var marianoSpeed = 5;
var marianoJumpSpeed = 0;
var marianoGrounded = true;
var marianoDistance = 0;
var marianoDistanceText = null;
// Game 22-27 variables
var colorTargets = [];
var currentTargetColor = 0;
var ballSpeed = 8;
var speedTapTimer = 0;
var circleChaser;
var circleTarget;
var stackBlocks = [];
var stackHeight = 0;
var mazeWalls = [];
var mazePlayer;
var mazeExit;
// Menu title
var menuTitle = new Text2('Ultimate Games Collection - 45 Games!', {
size: 64,
fill: 0x333333
});
menuTitle.anchor.set(0.5, 0.5);
menuTitle.x = 1024;
menuTitle.y = 400;
game.addChild(menuTitle);
// All original mini-game buttons
var game1Button = new ActionButton('Target Shooter', function () {
startGame1();
});
game1Button.x = 300;
game1Button.y = 600;
game.addChild(game1Button);
var game2Button = new ActionButton('Breakout', function () {
startGame2();
});
game2Button.x = 700;
game2Button.y = 600;
game.addChild(game2Button);
var game3Button = new ActionButton('Memory Tiles', function () {
startGame3();
});
game3Button.x = 1100;
game3Button.y = 600;
game.addChild(game3Button);
var game4Button = new ActionButton('Tap Challenge', function () {
startGame4();
});
game4Button.x = 1500;
game4Button.y = 600;
game.addChild(game4Button);
var game5Button = new ActionButton('Snake', function () {
startGame5();
});
game5Button.x = 300;
game5Button.y = 800;
game.addChild(game5Button);
var game6Button = new ActionButton('Flappy Bird', function () {
startGame6();
});
game6Button.x = 700;
game6Button.y = 800;
game.addChild(game6Button);
var game7Button = new ActionButton('Whack-a-Mole', function () {
startGame7();
});
game7Button.x = 1100;
game7Button.y = 800;
game.addChild(game7Button);
var game8Button = new ActionButton('Space Shooter', function () {
startGame8();
});
game8Button.x = 1500;
game8Button.y = 800;
game.addChild(game8Button);
var game9Button = new ActionButton('Endless Runner', function () {
startGame9();
});
game9Button.x = 300;
game9Button.y = 1000;
game.addChild(game9Button);
var game10Button = new ActionButton('Pac-Dots', function () {
startGame10();
});
game10Button.x = 700;
game10Button.y = 1000;
game.addChild(game10Button);
var game11Button = new ActionButton('FootMe', function () {
startGame11();
});
game11Button.x = 1100;
game11Button.y = 1000;
game.addChild(game11Button);
var game12Button = new ActionButton('Punch Me', function () {
startGame12();
});
game12Button.x = 1500;
game12Button.y = 1000;
game.addChild(game12Button);
var game13Button = new ActionButton('Roulette', function () {
startGame13();
});
game13Button.x = 300;
game13Button.y = 1200;
game.addChild(game13Button);
var game14Button = new ActionButton('Gun Bomb', function () {
startGame14();
});
game14Button.x = 700;
game14Button.y = 1200;
game.addChild(game14Button);
var game15Button = new ActionButton('Pac The', function () {
startGame15();
});
game15Button.x = 1100;
game15Button.y = 1200;
game.addChild(game15Button);
var game16Button = new ActionButton('Speed Mob', function () {
startGame16();
});
game16Button.x = 1500;
game16Button.y = 1200;
game.addChild(game16Button);
var game17Button = new ActionButton('Canon True', function () {
startGame17();
});
game17Button.x = 300;
game17Button.y = 1400;
game.addChild(game17Button);
var game18Button = new ActionButton('El Cangrejo', function () {
startGame18();
});
game18Button.x = 700;
game18Button.y = 1400;
game.addChild(game18Button);
var game20Button = new ActionButton('Comba', function () {
startGame20();
});
game20Button.x = 1100;
game20Button.y = 1400;
game.addChild(game20Button);
var game21Button = new ActionButton('Mariano el Brosiano', function () {
startGame21();
});
game21Button.x = 1500;
game21Button.y = 1400;
game.addChild(game21Button);
var game22Button = new ActionButton('Color Match', function () {
startGame22();
});
game22Button.x = 300;
game22Button.y = 1600;
game.addChild(game22Button);
var game23Button = new ActionButton('Ball Bounce', function () {
startGame23();
});
game23Button.x = 700;
game23Button.y = 1600;
game.addChild(game23Button);
var game24Button = new ActionButton('Speed Tap', function () {
startGame24();
});
game24Button.x = 1100;
game24Button.y = 1600;
game.addChild(game24Button);
var game25Button = new ActionButton('Circle Chase', function () {
startGame25();
});
game25Button.x = 1500;
game25Button.y = 1600;
game.addChild(game25Button);
var game26Button = new ActionButton('Block Stack', function () {
startGame26();
});
game26Button.x = 300;
game26Button.y = 1800;
game.addChild(game26Button);
var game27Button = new ActionButton('Maze Runner', function () {
startGame27();
});
game27Button.x = 700;
game27Button.y = 1800;
game.addChild(game27Button);
var game28Button = new ActionButton('Bubble Pop', function () {
startGame28();
});
game28Button.x = 1100;
game28Button.y = 1800;
game.addChild(game28Button);
var game29Button = new ActionButton('Memory Flash', function () {
startGame29();
});
game29Button.x = 1500;
game29Button.y = 1800;
game.addChild(game29Button);
var game30Button = new ActionButton('Time Warp', function () {
startGame30();
});
game30Button.x = 300;
game30Button.y = 2000;
game.addChild(game30Button);
var game31Button = new ActionButton('Color Storm', function () {
startGame31();
});
game31Button.x = 700;
game31Button.y = 2000;
game.addChild(game31Button);
var game32Button = new ActionButton('Gravity Fall', function () {
startGame32();
});
game32Button.x = 1100;
game32Button.y = 2000;
game.addChild(game32Button);
var game33Button = new ActionButton('Laser Beam', function () {
startGame33();
});
game33Button.x = 1500;
game33Button.y = 2000;
game.addChild(game33Button);
var game34Button = new ActionButton('Shape Match', function () {
startGame34();
});
game34Button.x = 300;
game34Button.y = 2200;
game.addChild(game34Button);
var game35Button = new ActionButton('Rhythm Tap', function () {
startGame35();
});
game35Button.x = 700;
game35Button.y = 2200;
game.addChild(game35Button);
var game36Button = new ActionButton('Twisty Turn', function () {
startGame36();
});
game36Button.x = 1100;
game36Button.y = 2200;
game.addChild(game36Button);
var game37Button = new ActionButton('Power Surge', function () {
startGame37();
});
game37Button.x = 1500;
game37Button.y = 2200;
game.addChild(game37Button);
var game38Button = new ActionButton('Mirror Magic', function () {
startGame38();
});
game38Button.x = 300;
game38Button.y = 2300;
game.addChild(game38Button);
var game39Button = new ActionButton('Chain React', function () {
startGame39();
});
game39Button.x = 700;
game39Button.y = 2300;
game.addChild(game39Button);
var game40Button = new ActionButton('Eclipse Phase', function () {
startGame40();
});
game40Button.x = 1100;
game40Button.y = 2300;
game.addChild(game40Button);
var game41Button = new ActionButton('Neon Rush', function () {
startGame41();
});
game41Button.x = 1500;
game41Button.y = 2300;
game.addChild(game41Button);
var game42Button = new ActionButton('Orbit Strike', function () {
startGame42();
});
game42Button.x = 300;
game42Button.y = 2350;
game.addChild(game42Button);
var game43Button = new ActionButton('Void Walker', function () {
startGame43();
});
game43Button.x = 700;
game43Button.y = 2350;
game.addChild(game43Button);
var game44Button = new ActionButton('Prism Break', function () {
startGame44();
});
game44Button.x = 1100;
game44Button.y = 2350;
game.addChild(game44Button);
var game45Button = new ActionButton('Quantum Leap', function () {
startGame45();
});
game45Button.x = 1500;
game45Button.y = 2350;
game.addChild(game45Button);
// Back button
var backButton = new ActionButton('Back to Menu', function () {
returnToMenu();
});
backButton.x = 1024;
backButton.y = 2400;
game.addChild(backButton);
// Game 1: Target Shooter
function startGame1() {
gameState = 'game1';
gameTimer = 0;
hideMenu();
showBackButton();
// Spawn targets periodically
var targetInterval = LK.setInterval(function () {
if (gameState === 'game1') {
var target = new Target();
target.x = 200 + Math.random() * 1648;
target.y = 600 + Math.random() * 1500;
gameObjects.push(target);
game.addChild(target);
} else {
LK.clearInterval(targetInterval);
}
}, 1000);
}
// Game 2: Breakout
var paddle;
var ball;
var blocks = [];
function startGame2() {
gameState = 'game2';
gameTimer = 0;
hideMenu();
showBackButton();
// Create paddle
paddle = new Paddle();
paddle.x = 1024;
paddle.y = 2400;
game.addChild(paddle);
gameObjects.push(paddle);
// Create ball
ball = new Ball();
ball.x = 1024;
ball.y = 2200;
ball.speedX = 8;
ball.speedY = -8;
game.addChild(ball);
gameObjects.push(ball);
// Create blocks
for (var i = 0; i < 8; i++) {
for (var j = 0; j < 5; j++) {
var block = new Block();
block.x = 200 + i * 200;
block.y = 400 + j * 80;
blocks.push(block);
game.addChild(block);
gameObjects.push(block);
}
}
}
// Game 3: Memory Tiles
var tiles = [];
var targetTileIndex = 0;
var tilesClicked = 0;
function startGame3() {
gameState = 'game3';
gameTimer = 0;
hideMenu();
showBackButton();
// Create 4x4 grid of tiles
for (var i = 0; i < 4; i++) {
for (var j = 0; j < 4; j++) {
var tile = new Tile();
tile.x = 400 + i * 200;
tile.y = 800 + j * 200;
tiles.push(tile);
game.addChild(tile);
gameObjects.push(tile);
}
}
// Set first target
tiles[0].setAsTarget();
}
// Game 4: Tap Challenge
var tapCount = 0;
var tapTimer = 600; // 10 seconds at 60fps
function startGame4() {
gameState = 'game4';
gameTimer = 0;
hideMenu();
showBackButton();
tapCount = 0;
tapTimer = 600;
// Create tap instruction
var tapInstruction = new Text2('Tap anywhere as fast as you can!', {
size: 48,
fill: 0x333333
});
tapInstruction.anchor.set(0.5, 0.5);
tapInstruction.x = 1024;
tapInstruction.y = 1000;
game.addChild(tapInstruction);
gameObjects.push(tapInstruction);
var tapCountText = new Text2('Taps: 0', {
size: 56,
fill: 0x333333
});
tapCountText.anchor.set(0.5, 0.5);
tapCountText.x = 1024;
tapCountText.y = 1200;
game.addChild(tapCountText);
gameObjects.push(tapCountText);
var timerText = new Text2('Time: 10', {
size: 56,
fill: 0x333333
});
timerText.anchor.set(0.5, 0.5);
timerText.x = 1024;
timerText.y = 1400;
game.addChild(timerText);
gameObjects.push(timerText);
}
// Game 5: Snake
function startGame5() {
gameState = 'game5';
gameTimer = 0;
hideMenu();
showBackButton();
snakeSegments = [];
snakeDirection = 'right';
// Create initial snake
var head = new SnakeSegment();
head.x = 1024;
head.y = 1366;
snakeSegments.push(head);
game.addChild(head);
gameObjects.push(head);
// Create food
food = new Food();
food.x = 500 + Math.random() * 1048;
food.y = 500 + Math.random() * 1732;
game.addChild(food);
gameObjects.push(food);
}
// Game 6: Flappy Bird
function startGame6() {
gameState = 'game6';
gameTimer = 0;
hideMenu();
showBackButton();
pipes = [];
// Create bird
bird = new Bird();
bird.x = 300;
bird.y = 1366;
game.addChild(bird);
gameObjects.push(bird);
// Spawn pipes
var pipeInterval = LK.setInterval(function () {
if (gameState === 'game6') {
var gap = 200;
var gapY = 300 + Math.random() * 1000;
var topPipe = new Pipe();
topPipe.x = 2148;
topPipe.y = gapY - gap / 2 - 150;
pipes.push(topPipe);
game.addChild(topPipe);
gameObjects.push(topPipe);
var bottomPipe = new Pipe();
bottomPipe.x = 2148;
bottomPipe.y = gapY + gap / 2 + 150;
pipes.push(bottomPipe);
game.addChild(bottomPipe);
gameObjects.push(bottomPipe);
} else {
LK.clearInterval(pipeInterval);
}
}, 2000);
}
// Game 7: Whack-a-Mole
function startGame7() {
gameState = 'game7';
gameTimer = 0;
hideMenu();
showBackButton();
moles = [];
holes = [];
// Create holes and moles
for (var i = 0; i < 3; i++) {
for (var j = 0; j < 3; j++) {
var hole = new Hole();
hole.x = 400 + i * 400;
hole.y = 900 + j * 300;
holes.push(hole);
game.addChild(hole);
gameObjects.push(hole);
var mole = new Mole();
mole.x = hole.x;
mole.y = hole.y + 30;
moles.push(mole);
game.addChild(mole);
gameObjects.push(mole);
}
}
// Mole popup timer
var moleInterval = LK.setInterval(function () {
if (gameState === 'game7') {
var randomMole = moles[Math.floor(Math.random() * moles.length)];
if (!randomMole.isUp) {
randomMole.isUp = true;
randomMole.y -= 30;
LK.setTimeout(function () {
if (randomMole.isUp) {
randomMole.isUp = false;
randomMole.y += 30;
}
}, 1500);
}
} else {
LK.clearInterval(moleInterval);
}
}, 800);
}
// Game 8: Space Shooter
function startGame8() {
gameState = 'game8';
gameTimer = 0;
hideMenu();
showBackButton();
missiles = [];
enemies = [];
// Create player
player = new Player();
player.x = 1024;
player.y = 2400;
game.addChild(player);
gameObjects.push(player);
// Spawn enemies
var enemyInterval = LK.setInterval(function () {
if (gameState === 'game8') {
var enemy = new Enemy();
enemy.x = 200 + Math.random() * 1648;
enemy.y = 100;
enemies.push(enemy);
game.addChild(enemy);
gameObjects.push(enemy);
} else {
LK.clearInterval(enemyInterval);
}
}, 1000);
}
// Game 9: Endless Runner
function startGame9() {
gameState = 'game9';
gameTimer = 0;
hideMenu();
showBackButton();
obstacles = [];
coins = [];
// Create player
player = new Player();
player.x = 300;
player.y = 2000;
game.addChild(player);
gameObjects.push(player);
// Spawn obstacles and coins
var spawnInterval = LK.setInterval(function () {
if (gameState === 'game9') {
if (Math.random() < 0.7) {
var obstacle = new Obstacle();
obstacle.x = 2148;
obstacle.y = 2000;
obstacles.push(obstacle);
game.addChild(obstacle);
gameObjects.push(obstacle);
} else {
var coin = new Coin();
coin.x = 2148;
coin.y = 1800 + Math.random() * 400;
coins.push(coin);
game.addChild(coin);
gameObjects.push(coin);
}
} else {
LK.clearInterval(spawnInterval);
}
}, 1500);
}
// Game 10: Pac-Dots
function startGame10() {
gameState = 'game10';
gameTimer = 0;
hideMenu();
showBackButton();
dots = [];
pacmanX = 1024;
pacmanY = 1366;
// Create player
player = new Player();
player.x = pacmanX;
player.y = pacmanY;
game.addChild(player);
gameObjects.push(player);
// Create dots in grid
for (var i = 0; i < 15; i++) {
for (var j = 0; j < 20; j++) {
var dot = new Dot();
dot.x = 200 + i * 100;
dot.y = 600 + j * 100;
dots.push(dot);
game.addChild(dot);
gameObjects.push(dot);
}
}
}
// Game 11: FootMe (Penalty Game)
function startGame11() {
gameState = 'game11';
gameTimer = 0;
hideMenu();
showBackButton();
// Create goal
goal = new Goal();
goal.x = 1024;
goal.y = 400;
game.addChild(goal);
gameObjects.push(goal);
// Create goalkeeper
goalkeeper = new Goalkeeper();
goalkeeper.x = 1024;
goalkeeper.y = 450;
game.addChild(goalkeeper);
gameObjects.push(goalkeeper);
// Create football
football = new Football();
football.x = 1024;
football.y = 2200;
game.addChild(football);
gameObjects.push(football);
}
// Game 12: Punch Me (Boxing Glove Destruction)
function startGame12() {
gameState = 'game12';
gameTimer = 0;
hideMenu();
showBackButton();
gloves = [];
punches = [];
// Spawn gloves periodically
var gloveInterval = LK.setInterval(function () {
if (gameState === 'game12') {
var glove = new BoxingGlove();
glove.x = 200 + Math.random() * 1648;
glove.y = 100;
gloves.push(glove);
game.addChild(glove);
gameObjects.push(glove);
} else {
LK.clearInterval(gloveInterval);
}
}, 1000);
}
// Game 13: Roulette (Color Clicker)
function startGame13() {
gameState = 'game13';
gameTimer = 0;
hideMenu();
showBackButton();
// Create roulette
roulette = new Roulette();
roulette.x = 1024;
roulette.y = 1366;
game.addChild(roulette);
gameObjects.push(roulette);
// Create pointer
pointer = new Pointer();
pointer.x = 1024;
pointer.y = 1066;
game.addChild(pointer);
gameObjects.push(pointer);
// Change color periodically
var colorInterval = LK.setInterval(function () {
if (gameState === 'game13') {
roulette.changeColor();
} else {
LK.clearInterval(colorInterval);
}
}, 2000);
}
// Game 14: Gun Bomb (Enemy Shooting)
function startGame14() {
gameState = 'game14';
gameTimer = 0;
hideMenu();
showBackButton();
bullets = [];
gunEnemies = [];
// Create player
player = new Player();
player.x = 1024;
player.y = 2400;
game.addChild(player);
gameObjects.push(player);
// Spawn enemies periodically
var gunEnemyInterval = LK.setInterval(function () {
if (gameState === 'game14') {
var gunEnemy = new GunEnemy();
gunEnemy.x = 200 + Math.random() * 1648;
gunEnemy.y = 100;
gunEnemies.push(gunEnemy);
game.addChild(gunEnemy);
gameObjects.push(gunEnemy);
} else {
LK.clearInterval(gunEnemyInterval);
}
}, 1500);
}
// Game 15: Pac The (Labyrinth Ball Throwing)
function startGame15() {
gameState = 'game15';
gameTimer = 0;
hideMenu();
showBackButton();
walls = [];
pacBalls = [];
// Create player
player = new Player();
player.x = 200;
player.y = 1366;
game.addChild(player);
gameObjects.push(player);
// Create maze walls
var wallPositions = [{
x: 400,
y: 800
}, {
x: 500,
y: 800
}, {
x: 600,
y: 800
}, {
x: 800,
y: 1000
}, {
x: 900,
y: 1000
}, {
x: 1000,
y: 1000
}, {
x: 1200,
y: 1200
}, {
x: 1300,
y: 1200
}, {
x: 1400,
y: 1200
}, {
x: 600,
y: 1400
}, {
x: 700,
y: 1400
}, {
x: 800,
y: 1400
}, {
x: 1000,
y: 1600
}, {
x: 1100,
y: 1600
}, {
x: 1200,
y: 1600
}];
for (var i = 0; i < wallPositions.length; i++) {
var wall = new Wall();
wall.x = wallPositions[i].x;
wall.y = wallPositions[i].y;
walls.push(wall);
game.addChild(wall);
gameObjects.push(wall);
}
// Create targets
for (var i = 0; i < 5; i++) {
var target = new Target();
target.x = 1500 + Math.random() * 400;
target.y = 800 + Math.random() * 1200;
game.addChild(target);
gameObjects.push(target);
}
}
// Game 16: Speed Mob (Parkour)
function startGame16() {
gameState = 'game16';
gameTimer = 0;
hideMenu();
showBackButton();
platforms = [];
runnerSpeed = 0;
runnerY = 2000;
// Create runner
runner = new Runner();
runner.x = 300;
runner.y = runnerY;
game.addChild(runner);
gameObjects.push(runner);
// Create platforms
var platformPositions = [{
x: 500,
y: 1800
}, {
x: 800,
y: 1600
}, {
x: 1100,
y: 1400
}, {
x: 1400,
y: 1200
}, {
x: 1700,
y: 1000
}, {
x: 2000,
y: 800
}, {
x: 2300,
y: 600
}, {
x: 2600,
y: 400
}, {
x: 2900,
y: 200
}];
for (var i = 0; i < platformPositions.length; i++) {
var platform = new Platform();
platform.x = platformPositions[i].x;
platform.y = platformPositions[i].y;
platforms.push(platform);
game.addChild(platform);
gameObjects.push(platform);
}
}
// Game 17: Canon True (Fruit Ninja style - slice bombs, avoid fruits)
function startGame17() {
gameState = 'game17';
gameTimer = 0;
hideMenu();
showBackButton();
bombs = [];
fruits = [];
// Spawn bombs and fruits periodically
var spawnInterval = LK.setInterval(function () {
if (gameState === 'game17') {
if (Math.random() < 0.7) {
// Spawn bomb (good object)
var bomb = new Bomb();
bomb.x = 200 + Math.random() * 1648;
bomb.y = 2800;
bombs.push(bomb);
game.addChild(bomb);
gameObjects.push(bomb);
} else {
// Spawn fruit (bad object)
var fruit = new Fruit();
fruit.x = 200 + Math.random() * 1648;
fruit.y = 2800;
fruits.push(fruit);
game.addChild(fruit);
gameObjects.push(fruit);
}
} else {
LK.clearInterval(spawnInterval);
}
}, 800);
}
// Game 18: El Cangrejo (Red Light Green Light)
function startGame18() {
gameState = 'game18';
gameTimer = 0;
hideMenu();
showBackButton();
isRedLight = false;
isGreenLight = true;
lightTimer = 0;
// Create crab player
crab = new Crab();
crab.x = 1024;
crab.y = 2400;
game.addChild(crab);
gameObjects.push(crab);
// Create light indicator
light = new Light();
light.x = 1024;
light.y = 300;
light.setGreen();
game.addChild(light);
gameObjects.push(light);
// Create finish line
finishLine = new Text2('FINISH LINE', {
size: 80,
fill: 0xffd700
});
finishLine.anchor.set(0.5, 0.5);
finishLine.x = 1024;
finishLine.y = 600;
game.addChild(finishLine);
gameObjects.push(finishLine);
// Light switching timer
var lightInterval = LK.setInterval(function () {
if (gameState === 'game18') {
if (isGreenLight) {
// Switch to red light
isRedLight = true;
isGreenLight = false;
light.setRed();
lightTimer = 120 + Math.random() * 180; // 2-5 seconds
} else {
// Switch to green light
isRedLight = false;
isGreenLight = true;
light.setGreen();
lightTimer = 180 + Math.random() * 240; // 3-6 seconds
}
} else {
LK.clearInterval(lightInterval);
}
}, 3000);
}
// Game 19: Rope Jumping (second part of El Cangrejo)
function startGame19() {
gameState = 'game19';
gameTimer = 0;
jumpCount = 0;
ropeJumpTimer = 0;
crabJumpSpeed = 0;
crabGrounded = true;
// Keep the crab from previous game
if (crab) {
crab.x = 1024;
crab.y = 2000;
}
// Create rope
rope = new Rope();
rope.x = 1024;
rope.y = 1800;
game.addChild(rope);
gameObjects.push(rope);
// Create jump count display
var jumpCountText = new Text2('Jumps: 0', {
size: 80,
fill: 0x333333
});
jumpCountText.anchor.set(0.5, 0.5);
jumpCountText.x = 1024;
jumpCountText.y = 1000;
game.addChild(jumpCountText);
gameObjects.push(jumpCountText);
// Create instruction text
var instructionText = new Text2('Jump 10 times to win!', {
size: 64,
fill: 0x333333
});
instructionText.anchor.set(0.5, 0.5);
instructionText.x = 1024;
instructionText.y = 1200;
game.addChild(instructionText);
gameObjects.push(instructionText);
}
// Game 20: Comba (Jump Rope Game)
function startGame20() {
gameState = 'game20';
gameTimer = 0;
combaJumpCount = 0;
combaPlayerJumpSpeed = 0;
combaPlayerGrounded = true;
combaEnemies = [];
combaPoles = [];
draggedPole = null;
hideMenu();
showBackButton();
// Create poles for combat
for (var i = 0; i < 3; i++) {
var pole = new Rope();
pole.x = 400 + i * 600;
pole.y = 1800;
combaPoles.push(pole);
game.addChild(pole);
gameObjects.push(pole);
}
// Spawn enemies periodically
var enemySpawnInterval = LK.setInterval(function () {
if (gameState === 'game20') {
var enemy = new Enemy();
enemy.x = 200 + Math.random() * 1648;
enemy.y = 100;
combaEnemies.push(enemy);
game.addChild(enemy);
gameObjects.push(enemy);
} else {
LK.clearInterval(enemySpawnInterval);
}
}, 2000);
// Create kill count display
combaKillCountText = new Text2('Kills: 0', {
size: 80,
fill: 0x333333
});
combaKillCountText.anchor.set(0.5, 0.5);
combaKillCountText.x = 1024;
combaKillCountText.y = 1000;
game.addChild(combaKillCountText);
gameObjects.push(combaKillCountText);
// Create instruction text
var combaInstructionText = new Text2('Move poles to kill enemies! Drag to move poles', {
size: 64,
fill: 0x333333
});
combaInstructionText.anchor.set(0.5, 0.5);
combaInstructionText.x = 1024;
combaInstructionText.y = 1200;
game.addChild(combaInstructionText);
gameObjects.push(combaInstructionText);
}
// Game 21: Mariano el Brosiano (Parkour)
function startGame21() {
gameState = 'game21';
gameTimer = 0;
marianoDistance = 0;
marianoSpeed = 5;
marianoJumpSpeed = 0;
marianoGrounded = true;
marianoObstacles = [];
marianoCoins = [];
marianoJumps = [];
hideMenu();
showBackButton();
// Create mariano player
marianoPlayer = new Player();
marianoPlayer.x = 300;
marianoPlayer.y = 2000;
game.addChild(marianoPlayer);
gameObjects.push(marianoPlayer);
// Create initial platforms
var platformPositions = [{
x: 600,
y: 1900
}, {
x: 900,
y: 1700
}, {
x: 1300,
y: 1500
}, {
x: 1700,
y: 1300
}, {
x: 2100,
y: 1100
}, {
x: 2500,
y: 900
}, {
x: 2900,
y: 700
}, {
x: 3300,
y: 500
}];
for (var i = 0; i < platformPositions.length; i++) {
var platform = new Platform();
platform.x = platformPositions[i].x;
platform.y = platformPositions[i].y;
marianoJumps.push(platform);
game.addChild(platform);
gameObjects.push(platform);
}
// Create obstacles
for (var i = 0; i < 5; i++) {
var obstacle = new Obstacle();
obstacle.x = 800 + i * 500;
obstacle.y = 2000;
marianoObstacles.push(obstacle);
game.addChild(obstacle);
gameObjects.push(obstacle);
}
// Create coins
for (var i = 0; i < 8; i++) {
var coin = new Coin();
coin.x = 700 + i * 400;
coin.y = 1400 + Math.random() * 400;
marianoCoins.push(coin);
game.addChild(coin);
gameObjects.push(coin);
}
// Create distance display
marianoDistanceText = new Text2('Distance: 0m', {
size: 50,
fill: 0x333333
});
marianoDistanceText.anchor.set(0.5, 0.5);
marianoDistanceText.x = 1024;
marianoDistanceText.y = 1000;
game.addChild(marianoDistanceText);
gameObjects.push(marianoDistanceText);
// Create instruction text
var marianoInstructionText = new Text2('Tap to jump! Avoid obstacles, collect coins!', {
size: 40,
fill: 0x333333
});
marianoInstructionText.anchor.set(0.5, 0.5);
marianoInstructionText.x = 1024;
marianoInstructionText.y = 1200;
game.addChild(marianoInstructionText);
gameObjects.push(marianoInstructionText);
}
// Game 22: Color Match
function startGame22() {
gameState = 'game22';
gameTimer = 0;
colorTargets = [];
currentTargetColor = 0;
hideMenu();
showBackButton();
var colors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0xff00ff, 0x00ffff];
// Create colored targets
for (var i = 0; i < 6; i++) {
var target = new Target();
target.x = 200 + i % 3 * 600;
target.y = 800 + Math.floor(i / 3) * 300;
target.tint = colors[i];
target.colorIndex = i;
colorTargets.push(target);
game.addChild(target);
gameObjects.push(target);
}
// Create instruction
var colorInstruction = new Text2('Tap colors in order: Red, Green, Blue, Yellow, Magenta, Cyan', {
size: 40,
fill: 0x333333
});
colorInstruction.anchor.set(0.5, 0.5);
colorInstruction.x = 1024;
colorInstruction.y = 1500;
game.addChild(colorInstruction);
gameObjects.push(colorInstruction);
}
// Game 23: Ball Bounce
function startGame23() {
gameState = 'game23';
gameTimer = 0;
ballSpeed = 8;
hideMenu();
showBackButton();
// Create bouncing ball
var bounceBall = new Ball();
bounceBall.x = 1024;
bounceBall.y = 1366;
bounceBall.speedX = ballSpeed;
bounceBall.speedY = ballSpeed;
game.addChild(bounceBall);
gameObjects.push(bounceBall);
// Create targets to hit
for (var i = 0; i < 8; i++) {
var target = new Target();
target.x = 300 + i % 4 * 400;
target.y = 600 + Math.floor(i / 4) * 300;
game.addChild(target);
gameObjects.push(target);
}
var bounceInstruction = new Text2('Let the ball hit all targets!', {
size: 40,
fill: 0x333333
});
bounceInstruction.anchor.set(0.5, 0.5);
bounceInstruction.x = 1024;
bounceInstruction.y = 2000;
game.addChild(bounceInstruction);
gameObjects.push(bounceInstruction);
}
// Game 24: Speed Tap
function startGame24() {
gameState = 'game24';
gameTimer = 0;
speedTapTimer = 1800; // 30 seconds
hideMenu();
showBackButton();
var speedInstruction = new Text2('Tap as many targets as possible in 30 seconds!', {
size: 40,
fill: 0x333333
});
speedInstruction.anchor.set(0.5, 0.5);
speedInstruction.x = 1024;
speedInstruction.y = 1000;
game.addChild(speedInstruction);
gameObjects.push(speedInstruction);
var speedTimer = new Text2('Time: 30', {
size: 50,
fill: 0x333333
});
speedTimer.anchor.set(0.5, 0.5);
speedTimer.x = 1024;
speedTimer.y = 1200;
game.addChild(speedTimer);
gameObjects.push(speedTimer);
// Spawn targets continuously
var targetSpawnInterval = LK.setInterval(function () {
if (gameState === 'game24') {
var target = new Target();
target.x = 200 + Math.random() * 1648;
target.y = 600 + Math.random() * 1500;
game.addChild(target);
gameObjects.push(target);
} else {
LK.clearInterval(targetSpawnInterval);
}
}, 500);
}
// Game 25: Circle Chase
function startGame25() {
gameState = 'game25';
gameTimer = 0;
hideMenu();
showBackButton();
// Create chaser (player)
circleChaser = new Player();
circleChaser.x = 200;
circleChaser.y = 1366;
game.addChild(circleChaser);
gameObjects.push(circleChaser);
// Create target to chase
circleTarget = new Target();
circleTarget.x = 1500;
circleTarget.y = 1000;
game.addChild(circleTarget);
gameObjects.push(circleTarget);
var chaseInstruction = new Text2('Chase the red circle! Drag to move', {
size: 40,
fill: 0x333333
});
chaseInstruction.anchor.set(0.5, 0.5);
chaseInstruction.x = 1024;
chaseInstruction.y = 2200;
game.addChild(chaseInstruction);
gameObjects.push(chaseInstruction);
}
// Game 26: Block Stack
function startGame26() {
gameState = 'game26';
gameTimer = 0;
stackBlocks = [];
stackHeight = 0;
hideMenu();
showBackButton();
// Create base platform
var basePlatform = new Platform();
basePlatform.x = 1024;
basePlatform.y = 2400;
game.addChild(basePlatform);
gameObjects.push(basePlatform);
var stackInstruction = new Text2('Tap to drop blocks and stack them!', {
size: 40,
fill: 0x333333
});
stackInstruction.anchor.set(0.5, 0.5);
stackInstruction.x = 1024;
stackInstruction.y = 1000;
game.addChild(stackInstruction);
gameObjects.push(stackInstruction);
var heightText = new Text2('Height: 0', {
size: 50,
fill: 0x333333
});
heightText.anchor.set(0.5, 0.5);
heightText.x = 1024;
heightText.y = 1200;
game.addChild(heightText);
gameObjects.push(heightText);
}
// Game 27: Maze Runner
function startGame27() {
gameState = 'game27';
gameTimer = 0;
mazeWalls = [];
hideMenu();
showBackButton();
// Create maze player
mazePlayer = new Player();
mazePlayer.x = 200;
mazePlayer.y = 2400;
game.addChild(mazePlayer);
gameObjects.push(mazePlayer);
// Create maze exit
mazeExit = new Target();
mazeExit.x = 1800;
mazeExit.y = 600;
mazeExit.tint = 0x00ff00;
game.addChild(mazeExit);
gameObjects.push(mazeExit);
// Create maze walls
var wallPositions = [{
x: 400,
y: 800
}, {
x: 500,
y: 800
}, {
x: 600,
y: 800
}, {
x: 800,
y: 1000
}, {
x: 900,
y: 1000
}, {
x: 1000,
y: 1000
}, {
x: 1200,
y: 1200
}, {
x: 1300,
y: 1200
}, {
x: 1400,
y: 1200
}, {
x: 600,
y: 1400
}, {
x: 700,
y: 1400
}, {
x: 800,
y: 1400
}, {
x: 1000,
y: 1600
}, {
x: 1100,
y: 1600
}, {
x: 1200,
y: 1600
}, {
x: 400,
y: 1800
}, {
x: 500,
y: 1800
}, {
x: 600,
y: 1800
}, {
x: 1400,
y: 1800
}, {
x: 1500,
y: 1800
}, {
x: 1600,
y: 1800
}];
for (var i = 0; i < wallPositions.length; i++) {
var wall = new Wall();
wall.x = wallPositions[i].x;
wall.y = wallPositions[i].y;
mazeWalls.push(wall);
game.addChild(wall);
gameObjects.push(wall);
}
var mazeInstruction = new Text2('Navigate to the green exit!', {
size: 40,
fill: 0x333333
});
mazeInstruction.anchor.set(0.5, 0.5);
mazeInstruction.x = 1024;
mazeInstruction.y = 500;
game.addChild(mazeInstruction);
gameObjects.push(mazeInstruction);
}
// Game 28: Bubble Pop
function startGame28() {
gameState = 'game28';
gameTimer = 0;
bubbles = [];
bubbleTimer = 0;
hideMenu();
showBackButton();
var bubbleInstruction = new Text2('Pop the bubbles before they reach the top!', {
size: 40,
fill: 0x333333
});
bubbleInstruction.anchor.set(0.5, 0.5);
bubbleInstruction.x = 1024;
bubbleInstruction.y = 500;
game.addChild(bubbleInstruction);
gameObjects.push(bubbleInstruction);
}
// Game 29: Memory Flash
function startGame29() {
gameState = 'game29';
gameTimer = 0;
memorySequence = [];
memoryIndex = 0;
hideMenu();
showBackButton();
// Create 4 memory buttons
var memoryColors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00];
for (var i = 0; i < 4; i++) {
var memoryButton = new Target();
memoryButton.x = 400 + i * 300;
memoryButton.y = 1366;
memoryButton.tint = memoryColors[i];
memoryButton.memoryIndex = i;
game.addChild(memoryButton);
gameObjects.push(memoryButton);
}
// Generate first sequence
memorySequence.push(Math.floor(Math.random() * 4));
var memoryInstruction = new Text2('Watch the sequence, then repeat it!', {
size: 40,
fill: 0x333333
});
memoryInstruction.anchor.set(0.5, 0.5);
memoryInstruction.x = 1024;
memoryInstruction.y = 800;
game.addChild(memoryInstruction);
gameObjects.push(memoryInstruction);
}
// Game 30: Time Warp
function startGame30() {
gameState = 'game30';
gameTimer = 0;
timeWarpSpeed = 1;
timeWarpTargets = [];
hideMenu();
showBackButton();
// Create time-based targets
for (var i = 0; i < 5; i++) {
var target = new Target();
target.x = 300 + i * 300;
target.y = 1000 + Math.random() * 800;
target.timeSpeed = 1 + Math.random() * 3;
timeWarpTargets.push(target);
game.addChild(target);
gameObjects.push(target);
}
var timeInstruction = new Text2('Hit targets as time warps around you!', {
size: 40,
fill: 0x333333
});
timeInstruction.anchor.set(0.5, 0.5);
timeInstruction.x = 1024;
timeInstruction.y = 600;
game.addChild(timeInstruction);
gameObjects.push(timeInstruction);
}
// Game 31: Color Storm
function startGame31() {
gameState = 'game31';
gameTimer = 0;
colorStormBalls = [];
currentStormColor = 0;
hideMenu();
showBackButton();
var stormInstruction = new Text2('Match the color! Only hit balls of the current color', {
size: 40,
fill: 0x333333
});
stormInstruction.anchor.set(0.5, 0.5);
stormInstruction.x = 1024;
stormInstruction.y = 500;
game.addChild(stormInstruction);
gameObjects.push(stormInstruction);
var colorDisplay = new Target();
colorDisplay.x = 1024;
colorDisplay.y = 800;
colorDisplay.tint = stormColors[currentStormColor];
game.addChild(colorDisplay);
gameObjects.push(colorDisplay);
}
// Game 32: Gravity Fall
function startGame32() {
gameState = 'game32';
gameTimer = 0;
gravityObjects = [];
gravityDirection = 1;
hideMenu();
showBackButton();
// Create gravity-affected objects
for (var i = 0; i < 8; i++) {
var obj = new Target();
obj.x = 200 + i * 200;
obj.y = 1366;
obj.gravitySpeed = 0;
gravityObjects.push(obj);
game.addChild(obj);
gameObjects.push(obj);
}
var gravityInstruction = new Text2('Tap to reverse gravity! Collect the falling objects', {
size: 40,
fill: 0x333333
});
gravityInstruction.anchor.set(0.5, 0.5);
gravityInstruction.x = 1024;
gravityInstruction.y = 600;
game.addChild(gravityInstruction);
gameObjects.push(gravityInstruction);
}
// Game 33: Laser Beam
function startGame33() {
gameState = 'game33';
gameTimer = 0;
laserBeams = [];
laserTargets = [];
hideMenu();
showBackButton();
// Create laser source
var laserSource = new Player();
laserSource.x = 1024;
laserSource.y = 2400;
game.addChild(laserSource);
gameObjects.push(laserSource);
// Create targets
for (var i = 0; i < 6; i++) {
var target = new Target();
target.x = 300 + i * 250;
target.y = 600 + Math.random() * 1000;
laserTargets.push(target);
game.addChild(target);
gameObjects.push(target);
}
var laserInstruction = new Text2('Drag to aim laser, tap to fire!', {
size: 40,
fill: 0x333333
});
laserInstruction.anchor.set(0.5, 0.5);
laserInstruction.x = 1024;
laserInstruction.y = 500;
game.addChild(laserInstruction);
gameObjects.push(laserInstruction);
}
// Game 34: Shape Match
function startGame34() {
gameState = 'game34';
gameTimer = 0;
currentShape = 0;
shapesToMatch = [];
hideMenu();
showBackButton();
// Create shape matching game
for (var i = 0; i < 6; i++) {
var shape = new Target();
shape.x = 300 + i % 3 * 400;
shape.y = 800 + Math.floor(i / 3) * 300;
shape.shapeType = Math.floor(Math.random() * 2);
if (shape.shapeType === 1) {
// Make it look different for ellipse
shape.scaleY = 0.6;
}
shape.shapeIndex = i;
shapesToMatch.push(shape);
game.addChild(shape);
gameObjects.push(shape);
}
var shapeInstruction = new Text2('Match shapes in order: Circles then Squares!', {
size: 40,
fill: 0x333333
});
shapeInstruction.anchor.set(0.5, 0.5);
shapeInstruction.x = 1024;
shapeInstruction.y = 1600;
game.addChild(shapeInstruction);
gameObjects.push(shapeInstruction);
}
// Game 35: Rhythm Tap
function startGame35() {
gameState = 'game35';
gameTimer = 0;
rhythmBeats = [];
rhythmTimer = 0;
hideMenu();
showBackButton();
var rhythmInstruction = new Text2('Tap the beats as they reach the line!', {
size: 40,
fill: 0x333333
});
rhythmInstruction.anchor.set(0.5, 0.5);
rhythmInstruction.x = 1024;
rhythmInstruction.y = 500;
game.addChild(rhythmInstruction);
gameObjects.push(rhythmInstruction);
// Create rhythm line
var rhythmLine = new Platform();
rhythmLine.x = 1024;
rhythmLine.y = 1800;
rhythmLine.scaleY = 0.2;
game.addChild(rhythmLine);
gameObjects.push(rhythmLine);
}
// Game 36: Twisty Turn
function startGame36() {
gameState = 'game36';
gameTimer = 0;
twistyAngle = 0;
hideMenu();
showBackButton();
// Create twisty player
twistyPlayer = new Player();
twistyPlayer.x = 1024;
twistyPlayer.y = 1366;
game.addChild(twistyPlayer);
gameObjects.push(twistyPlayer);
// Create rotating obstacles
for (var i = 0; i < 8; i++) {
var obstacle = new Obstacle();
obstacle.x = 1024;
obstacle.y = 1366;
obstacle.orbitRadius = 200 + i * 50;
obstacle.orbitSpeed = 0.02 + i * 0.01;
obstacle.orbitAngle = i * Math.PI / 4;
game.addChild(obstacle);
gameObjects.push(obstacle);
}
var twistyInstruction = new Text2('Rotate around center, avoid obstacles!', {
size: 40,
fill: 0x333333
});
twistyInstruction.anchor.set(0.5, 0.5);
twistyInstruction.x = 1024;
twistyInstruction.y = 800;
game.addChild(twistyInstruction);
gameObjects.push(twistyInstruction);
}
// Game 37: Power Surge
function startGame37() {
gameState = 'game37';
gameTimer = 0;
powerCells = [];
powerLevel = 0;
hideMenu();
showBackButton();
// Create power collection grid
for (var i = 0; i < 12; i++) {
var cell = new Coin();
cell.x = 300 + i % 4 * 300;
cell.y = 800 + Math.floor(i / 4) * 250;
cell.powered = false;
powerCells.push(cell);
game.addChild(cell);
gameObjects.push(cell);
}
var powerInstruction = new Text2('Collect power cells to charge up!', {
size: 40,
fill: 0x333333
});
powerInstruction.anchor.set(0.5, 0.5);
powerInstruction.x = 1024;
powerInstruction.y = 500;
game.addChild(powerInstruction);
gameObjects.push(powerInstruction);
var powerDisplay = new Text2('Power: 0%', {
size: 50,
fill: 0x333333
});
powerDisplay.anchor.set(0.5, 0.5);
powerDisplay.x = 1024;
powerDisplay.y = 2000;
game.addChild(powerDisplay);
gameObjects.push(powerDisplay);
}
// Game 38: Mirror Magic
function startGame38() {
gameState = 'game38';
gameTimer = 0;
mirrorObjects = [];
mirrorSide = 'left';
hideMenu();
showBackButton();
// Create mirror objects on left side
for (var i = 0; i < 5; i++) {
var obj = new Target();
obj.x = 300;
obj.y = 600 + i * 200;
obj.mirrorX = 1724; // Right side mirror position
obj.mirrorY = obj.y;
mirrorObjects.push(obj);
game.addChild(obj);
gameObjects.push(obj);
// Create mirror copy on right side
var mirror = new Target();
mirror.x = obj.mirrorX;
mirror.y = obj.mirrorY;
mirror.alpha = 0.5;
mirror.isMirror = true;
game.addChild(mirror);
gameObjects.push(mirror);
}
var mirrorInstruction = new Text2('Touch left objects to activate their mirrors!', {
size: 40,
fill: 0x333333
});
mirrorInstruction.anchor.set(0.5, 0.5);
mirrorInstruction.x = 1024;
mirrorInstruction.y = 500;
game.addChild(mirrorInstruction);
gameObjects.push(mirrorInstruction);
}
// Game 39: Chain React
function startGame39() {
gameState = 'game39';
gameTimer = 0;
chainNodes = [];
chainConnections = [];
hideMenu();
showBackButton();
// Create chain nodes
for (var i = 0; i < 15; i++) {
var node = new Target();
node.x = 200 + Math.random() * 1648;
node.y = 600 + Math.random() * 1500;
node.activated = false;
node.chainLevel = 0;
chainNodes.push(node);
game.addChild(node);
gameObjects.push(node);
}
var chainInstruction = new Text2('Start a chain reaction! Touch nodes to activate neighbors', {
size: 40,
fill: 0x333333
});
chainInstruction.anchor.set(0.5, 0.5);
chainInstruction.x = 1024;
chainInstruction.y = 500;
game.addChild(chainInstruction);
gameObjects.push(chainInstruction);
}
// Game 40: Eclipse Phase
function startGame40() {
gameState = 'game40';
gameTimer = 0;
eclipsePhase = 0;
eclipseTimer = 0;
hideMenu();
showBackButton();
// Create eclipse objects
var sun = new Target();
sun.x = 300;
sun.y = 1366;
sun.tint = 0xffff00;
sun.scaleX = 2;
sun.scaleY = 2;
game.addChild(sun);
gameObjects.push(sun);
var moon = new Target();
moon.x = 1724;
moon.y = 1366;
moon.tint = 0x808080;
moon.scaleX = 1.5;
moon.scaleY = 1.5;
game.addChild(moon);
gameObjects.push(moon);
var eclipseInstruction = new Text2('Align the moon and sun to create an eclipse!', {
size: 40,
fill: 0x333333
});
eclipseInstruction.anchor.set(0.5, 0.5);
eclipseInstruction.x = 1024;
eclipseInstruction.y = 800;
game.addChild(eclipseInstruction);
gameObjects.push(eclipseInstruction);
}
// Game 41: Neon Rush
function startGame41() {
gameState = 'game41';
gameTimer = 0;
neonTrails = [];
neonSpeed = 8;
hideMenu();
showBackButton();
// Create neon player
var neonPlayer = new Player();
neonPlayer.x = 200;
neonPlayer.y = 1366;
neonPlayer.tint = 0x00ffff;
game.addChild(neonPlayer);
gameObjects.push(neonPlayer);
var neonInstruction = new Text2('Race through the neon highway! Avoid the walls', {
size: 40,
fill: 0x333333
});
neonInstruction.anchor.set(0.5, 0.5);
neonInstruction.x = 1024;
neonInstruction.y = 600;
game.addChild(neonInstruction);
gameObjects.push(neonInstruction);
}
// Game 42: Orbit Strike
function startGame42() {
gameState = 'game42';
gameTimer = 0;
orbitObjects = [];
orbitAngle = 0;
hideMenu();
showBackButton();
// Create orbit center
orbitCenter = new Target();
orbitCenter.x = 1024;
orbitCenter.y = 1366;
orbitCenter.tint = 0xffffff;
orbitCenter.scaleX = 0.5;
orbitCenter.scaleY = 0.5;
game.addChild(orbitCenter);
gameObjects.push(orbitCenter);
// Create orbiting objects
for (var i = 0; i < 6; i++) {
var orbitObj = new Enemy();
orbitObj.orbitRadius = 200 + i * 80;
orbitObj.orbitSpeed = 0.03 - i * 0.005;
orbitObj.orbitAngle = i * Math.PI / 3;
orbitObjects.push(orbitObj);
game.addChild(orbitObj);
gameObjects.push(orbitObj);
}
var orbitInstruction = new Text2('Destroy orbiting enemies! Time your shots carefully', {
size: 40,
fill: 0x333333
});
orbitInstruction.anchor.set(0.5, 0.5);
orbitInstruction.x = 1024;
orbitInstruction.y = 800;
game.addChild(orbitInstruction);
gameObjects.push(orbitInstruction);
}
// Game 43: Void Walker
function startGame43() {
gameState = 'game43';
gameTimer = 0;
voidPlatforms = [];
hideMenu();
showBackButton();
// Create void player
voidPlayer = new Player();
voidPlayer.x = 300;
voidPlayer.y = 2000;
voidPlayer.speedY = 0;
game.addChild(voidPlayer);
gameObjects.push(voidPlayer);
// Create disappearing platforms
for (var i = 0; i < 8; i++) {
var platform = new Platform();
platform.x = 400 + i * 200;
platform.y = 1800 - i * 150;
platform.disappearTimer = 300 + i * 60;
platform.solid = true;
voidPlatforms.push(platform);
game.addChild(platform);
gameObjects.push(platform);
}
var voidInstruction = new Text2('Jump across void! Platforms disappear over time', {
size: 40,
fill: 0x333333
});
voidInstruction.anchor.set(0.5, 0.5);
voidInstruction.x = 1024;
voidInstruction.y = 500;
game.addChild(voidInstruction);
gameObjects.push(voidInstruction);
}
// Game 44: Prism Break
function startGame44() {
gameState = 'game44';
gameTimer = 0;
prismColors = [];
prismBeams = [];
hideMenu();
showBackButton();
// Create prism objects
var prismColors = [0xff0000, 0x00ff00, 0x0000ff];
for (var i = 0; i < 3; i++) {
var prism = new Target();
prism.x = 300 + i * 600;
prism.y = 1000;
prism.tint = prismColors[i];
prism.colorIndex = i;
game.addChild(prism);
gameObjects.push(prism);
}
var prismInstruction = new Text2('Break prisms in the right color order: Red, Green, Blue!', {
size: 40,
fill: 0x333333
});
prismInstruction.anchor.set(0.5, 0.5);
prismInstruction.x = 1024;
prismInstruction.y = 1500;
game.addChild(prismInstruction);
gameObjects.push(prismInstruction);
}
// Game 45: Quantum Leap
function startGame45() {
gameState = 'game45';
gameTimer = 0;
quantumDimensions = [];
currentDimension = 0;
hideMenu();
showBackButton();
// Create quantum player
quantumPlayer = new Player();
quantumPlayer.x = 200;
quantumPlayer.y = 1366;
game.addChild(quantumPlayer);
gameObjects.push(quantumPlayer);
// Create dimension portals
var dimensionColors = [0xff0000, 0x00ff00, 0x0000ff];
for (var i = 0; i < 3; i++) {
var portal = new Target();
portal.x = 600 + i * 400;
portal.y = 800 + i * 200;
portal.tint = dimensionColors[i];
portal.dimension = i;
quantumDimensions.push(portal);
game.addChild(portal);
gameObjects.push(portal);
}
var quantumInstruction = new Text2('Leap between quantum dimensions! Each has different rules', {
size: 40,
fill: 0x333333
});
quantumInstruction.anchor.set(0.5, 0.5);
quantumInstruction.x = 1024;
quantumInstruction.y = 500;
game.addChild(quantumInstruction);
gameObjects.push(quantumInstruction);
}
function hideMenu() {
menuTitle.visible = false;
game1Button.visible = false;
game2Button.visible = false;
game3Button.visible = false;
game4Button.visible = false;
game5Button.visible = false;
game6Button.visible = false;
game7Button.visible = false;
game8Button.visible = false;
game9Button.visible = false;
game10Button.visible = false;
game11Button.visible = false;
game12Button.visible = false;
game13Button.visible = false;
game14Button.visible = false;
game15Button.visible = false;
game16Button.visible = false;
game17Button.visible = false;
game18Button.visible = false;
game20Button.visible = false;
game21Button.visible = false;
game22Button.visible = false;
game23Button.visible = false;
game24Button.visible = false;
game25Button.visible = false;
game26Button.visible = false;
game27Button.visible = false;
game28Button.visible = false;
game29Button.visible = false;
game30Button.visible = false;
game31Button.visible = false;
game32Button.visible = false;
game33Button.visible = false;
game34Button.visible = false;
game35Button.visible = false;
game36Button.visible = false;
game37Button.visible = false;
game38Button.visible = false;
game39Button.visible = false;
game40Button.visible = false;
game41Button.visible = false;
game42Button.visible = false;
game43Button.visible = false;
game44Button.visible = false;
game45Button.visible = false;
}
function showMenu() {
menuTitle.visible = true;
game1Button.visible = true;
game2Button.visible = true;
game3Button.visible = true;
game4Button.visible = true;
game5Button.visible = true;
game6Button.visible = true;
game7Button.visible = true;
game8Button.visible = true;
game9Button.visible = true;
game10Button.visible = true;
game11Button.visible = true;
game12Button.visible = true;
game13Button.visible = true;
game14Button.visible = true;
game15Button.visible = true;
game16Button.visible = true;
game17Button.visible = true;
game18Button.visible = true;
game20Button.visible = true;
game21Button.visible = true;
game22Button.visible = true;
game23Button.visible = true;
game24Button.visible = true;
game25Button.visible = true;
game26Button.visible = true;
game27Button.visible = true;
game28Button.visible = true;
game29Button.visible = true;
game30Button.visible = true;
game31Button.visible = true;
game32Button.visible = true;
game33Button.visible = true;
game34Button.visible = true;
game35Button.visible = true;
game36Button.visible = true;
game37Button.visible = true;
game38Button.visible = true;
game39Button.visible = true;
game40Button.visible = true;
game41Button.visible = true;
game42Button.visible = true;
game43Button.visible = true;
game44Button.visible = true;
game45Button.visible = true;
}
function showBackButton() {
backButton.visible = true;
}
function hideBackButton() {
backButton.visible = false;
}
function returnToMenu() {
gameState = 'menu';
// Clean up game objects
for (var i = gameObjects.length - 1; i >= 0; i--) {
gameObjects[i].destroy();
}
gameObjects = [];
blocks = [];
tiles = [];
snakeSegments = [];
pipes = [];
moles = [];
holes = [];
missiles = [];
enemies = [];
obstacles = [];
coins = [];
dots = [];
gloves = [];
punches = [];
bullets = [];
gunEnemies = [];
walls = [];
pacBalls = [];
platforms = [];
bombs = [];
fruits = [];
jumpCount = 0;
ropeJumpTimer = 0;
crabJumpSpeed = 0;
crabGrounded = true;
combaJumpCount = 0;
combaPlayerJumpSpeed = 0;
combaPlayerGrounded = true;
combaEnemies = [];
combaPoles = [];
draggedPole = null;
combaKillCountText = null;
// Game 21 cleanup
marianoObstacles = [];
marianoCoins = [];
marianoJumps = [];
marianoSpeed = 5;
marianoJumpSpeed = 0;
marianoGrounded = true;
marianoDistance = 0;
marianoDistanceText = null;
// Games 22-27 cleanup
colorTargets = [];
currentTargetColor = 0;
ballSpeed = 8;
speedTapTimer = 0;
circleChaser = null;
circleTarget = null;
stackBlocks = [];
stackHeight = 0;
mazeWalls = [];
mazePlayer = null;
mazeExit = null;
// Games 28-45 cleanup
bubbles = [];
bubbleTimer = 0;
memorySequence = [];
memoryIndex = 0;
timeWarpSpeed = 1;
timeWarpTargets = [];
colorStormBalls = [];
currentStormColor = 0;
gravityObjects = [];
gravityDirection = 1;
laserBeams = [];
laserTargets = [];
currentShape = 0;
shapesToMatch = [];
rhythmBeats = [];
rhythmTimer = 0;
twistyPlayer = null;
twistyAngle = 0;
powerCells = [];
powerLevel = 0;
mirrorObjects = [];
mirrorSide = 'left';
chainNodes = [];
chainConnections = [];
eclipsePhase = 0;
eclipseTimer = 0;
neonTrails = [];
neonSpeed = 8;
orbitCenter = null;
orbitObjects = [];
orbitAngle = 0;
voidPlayer = null;
voidPlatforms = [];
prismColors = [];
prismBeams = [];
quantumPlayer = null;
quantumDimensions = [];
currentDimension = 0;
// Games 28-45 variables
var bubbles = [];
var bubbleTimer = 0;
var memorySequence = [];
var memoryIndex = 0;
var timeWarpSpeed = 1;
var timeWarpTargets = [];
var colorStormBalls = [];
var stormColors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0xff00ff, 0x00ffff];
var currentStormColor = 0;
var gravityObjects = [];
var gravityDirection = 1;
var laserBeams = [];
var laserTargets = [];
var shapeTypes = ['box', 'ellipse'];
var currentShape = 0;
var shapesToMatch = [];
var rhythmBeats = [];
var rhythmTimer = 0;
var twistyPlayer;
var twistyAngle = 0;
var powerCells = [];
var powerLevel = 0;
var mirrorObjects = [];
var mirrorSide = 'left';
var chainNodes = [];
var chainConnections = [];
var eclipsePhase = 0;
var eclipseTimer = 0;
var neonTrails = [];
var neonSpeed = 8;
var orbitCenter;
var orbitObjects = [];
var orbitAngle = 0;
var voidPlayer;
var voidPlatforms = [];
var prismColors = [];
var prismBeams = [];
var quantumPlayer;
var quantumDimensions = [];
var currentDimension = 0;
hideBackButton();
showMenu();
}
// Game controls
game.move = function (x, y, obj) {
if (gameState === 'game2' && paddle) {
paddle.x = x;
if (paddle.x < 60) paddle.x = 60;
if (paddle.x > 1988) paddle.x = 1988;
}
if (gameState === 'game8' && player) {
player.x = x;
if (player.x < 50) player.x = 50;
if (player.x > 1998) player.x = 1998;
}
if (gameState === 'game9' && player) {
player.y = y;
if (player.y < 1800) player.y = 1800;
if (player.y > 2200) player.y = 2200;
}
if (gameState === 'game10' && player) {
pacmanX = x;
pacmanY = y;
if (pacmanX < 50) pacmanX = 50;
if (pacmanX > 1998) pacmanX = 1998;
if (pacmanY < 50) pacmanY = 50;
if (pacmanY > 2682) pacmanY = 2682;
player.x = pacmanX;
player.y = pacmanY;
}
if (gameState === 'game14' && player) {
player.x = x;
if (player.x < 50) player.x = 50;
if (player.x > 1998) player.x = 1998;
}
if (gameState === 'game15' && player) {
player.x = x;
player.y = y;
if (player.x < 50) player.x = 50;
if (player.x > 1998) player.x = 1998;
if (player.y < 50) player.y = 50;
if (player.y > 2682) player.y = 2682;
}
if (gameState === 'game16' && runner) {
runner.x = x;
if (runner.x < 50) runner.x = 50;
if (runner.x > 2998) runner.x = 2998;
}
if (gameState === 'game18' && crab && isGreenLight) {
crab.x = x;
crab.y = y;
if (crab.x < 50) crab.x = 50;
if (crab.x > 1998) crab.x = 1998;
if (crab.y < 700) crab.y = 700;
if (crab.y > 2682) crab.y = 2682;
}
if (gameState === 'game20' && draggedPole) {
draggedPole.x = x;
draggedPole.y = y;
if (draggedPole.x < 50) draggedPole.x = 50;
if (draggedPole.x > 1998) draggedPole.x = 1998;
if (draggedPole.y < 50) draggedPole.y = 50;
if (draggedPole.y > 2682) draggedPole.y = 2682;
}
if (gameState === 'game25' && circleChaser) {
circleChaser.x = x;
circleChaser.y = y;
if (circleChaser.x < 50) circleChaser.x = 50;
if (circleChaser.x > 1998) circleChaser.x = 1998;
if (circleChaser.y < 50) circleChaser.y = 50;
if (circleChaser.y > 2682) circleChaser.y = 2682;
}
if (gameState === 'game27' && mazePlayer) {
mazePlayer.x = x;
mazePlayer.y = y;
if (mazePlayer.x < 50) mazePlayer.x = 50;
if (mazePlayer.x > 1998) mazePlayer.x = 1998;
if (mazePlayer.y < 50) mazePlayer.y = 50;
if (mazePlayer.y > 2682) mazePlayer.y = 2682;
}
};
game.down = function (x, y, obj) {
if (gameState === 'game4') {
tapCount++;
LK.setScore(LK.getScore() + 1);
scoreText.setText(LK.getScore());
// Update tap count display
if (gameObjects.length > 1) {
gameObjects[1].setText('Taps: ' + tapCount);
}
}
if (gameState === 'game5') {
// Change snake direction based on tap position
if (x < 1024) {
snakeDirection = 'left';
} else {
snakeDirection = 'right';
}
}
if (gameState === 'game6' && bird) {
bird.speedY = -10;
}
if (gameState === 'game8' && player) {
var missile = new Missile();
missile.x = player.x;
missile.y = player.y - 50;
missiles.push(missile);
game.addChild(missile);
gameObjects.push(missile);
}
if (gameState === 'game11' && football && !football.kicked) {
var targetX = x;
var targetY = y;
football.speedX = (targetX - football.x) * 0.1;
football.speedY = (targetY - football.y) * 0.1;
football.kicked = true;
LK.getSound('hit').play();
}
if (gameState === 'game12') {
var punch = new Punch();
punch.x = x;
punch.y = y;
punches.push(punch);
game.addChild(punch);
gameObjects.push(punch);
LK.getSound('hit').play();
}
if (gameState === 'game14' && player) {
var bullet = new Bullet();
bullet.x = player.x;
bullet.y = player.y - 50;
bullets.push(bullet);
game.addChild(bullet);
gameObjects.push(bullet);
LK.getSound('shoot').play();
}
if (gameState === 'game15' && player) {
var pacBall = new PacBall();
pacBall.x = player.x;
pacBall.y = player.y;
pacBall.speedX = (x - player.x) * 0.1;
pacBall.speedY = (y - player.y) * 0.1;
pacBalls.push(pacBall);
game.addChild(pacBall);
gameObjects.push(pacBall);
LK.getSound('shoot').play();
}
if (gameState === 'game16' && runner) {
runner.speedY = -15;
runner.grounded = false;
LK.getSound('jump').play();
}
if (gameState === 'game19' && crab && crabGrounded) {
crabJumpSpeed = -15;
crabGrounded = false;
LK.getSound('jump').play();
}
if (gameState === 'game20') {
// Check if tapping on a pole
draggedPole = null;
for (var i = 0; i < combaPoles.length; i++) {
if (Math.abs(combaPoles[i].x - x) < 100 && Math.abs(combaPoles[i].y - y) < 100) {
draggedPole = combaPoles[i];
break;
}
}
}
if (gameState === 'game21' && marianoPlayer && marianoGrounded) {
marianoJumpSpeed = -18;
marianoGrounded = false;
LK.getSound('jump').play();
}
if (gameState === 'game22') {
// Check color sequence
for (var i = 0; i < colorTargets.length; i++) {
if (colorTargets[i].intersects({
x: x,
y: y,
width: 10,
height: 10
})) {
if (i === currentTargetColor) {
currentTargetColor++;
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
if (currentTargetColor >= colorTargets.length) {
LK.showYouWin();
}
} else {
LK.showGameOver();
}
break;
}
}
}
if (gameState === 'game26') {
// Drop a block
var block = new Block();
block.x = 1024;
block.y = 400;
block.speedY = 5;
stackBlocks.push(block);
game.addChild(block);
gameObjects.push(block);
}
// Game 28: Bubble Pop controls
if (gameState === 'game28') {
// Check bubble taps
for (var i = bubbles.length - 1; i >= 0; i--) {
if (bubbles[i] && Math.abs(bubbles[i].x - x) < 60 && Math.abs(bubbles[i].y - y) < 60) {
bubbles[i].destroy();
bubbles.splice(i, 1);
LK.setScore(LK.getScore() + 5);
scoreText.setText(LK.getScore());
LK.getSound('hit').play();
break;
}
}
}
// Game 32: Gravity Fall controls
if (gameState === 'game32') {
gravityDirection = -gravityDirection;
}
// Game 33: Laser Beam controls
if (gameState === 'game33') {
// Fire laser beam
var beam = new Bullet();
beam.x = gameObjects[0].x; // laser source
beam.y = gameObjects[0].y;
beam.speedX = (x - beam.x) * 0.2;
beam.speedY = (y - beam.y) * 0.2;
laserBeams.push(beam);
game.addChild(beam);
gameObjects.push(beam);
LK.getSound('shoot').play();
}
// Game 35: Rhythm Tap controls
if (gameState === 'game35') {
// Check if tapping on rhythm beat
for (var i = rhythmBeats.length - 1; i >= 0; i--) {
if (rhythmBeats[i] && Math.abs(rhythmBeats[i].y - 1800) < 50) {
rhythmBeats[i].destroy();
rhythmBeats.splice(i, 1);
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
break;
}
}
}
// Game 43: Void Walker controls
if (gameState === 'game43' && voidPlayer) {
voidPlayer.speedY = -15;
LK.getSound('jump').play();
}
};
game.up = function (x, y, obj) {
if (gameState === 'game20') {
draggedPole = null;
}
};
game.update = function () {
if (gameState === 'menu') {
return;
}
gameTimer++;
// Update game objects
for (var i = gameObjects.length - 1; i >= 0; i--) {
var obj = gameObjects[i];
if (obj.shouldDestroy) {
obj.destroy();
gameObjects.splice(i, 1);
}
}
// Game specific updates
if (gameState === 'game2') {
// Ball collision with paddle
if (ball && paddle && ball.intersects(paddle) && ball.speedY > 0) {
ball.speedY = -ball.speedY;
LK.getSound('hit').play();
}
// Ball collision with blocks
for (var i = blocks.length - 1; i >= 0; i--) {
if (ball && ball.intersects(blocks[i])) {
ball.speedY = -ball.speedY;
blocks[i].destroy();
blocks.splice(i, 1);
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
}
}
// Check win condition
if (blocks.length === 0) {
LK.getSound('complete').play();
LK.showYouWin();
}
}
if (gameState === 'game3') {
// Check if all tiles have been clicked in order
var allClicked = true;
for (var i = 0; i < tiles.length; i++) {
if (tiles[i].isTarget) {
allClicked = false;
break;
}
}
if (allClicked && tiles.length > 0) {
// Set next target
var nextIndex = Math.floor(Math.random() * tiles.length);
tiles[nextIndex].setAsTarget();
}
}
if (gameState === 'game4') {
tapTimer--;
if (gameObjects.length > 2) {
gameObjects[2].setText('Time: ' + Math.ceil(tapTimer / 60));
}
if (tapTimer <= 0) {
LK.getSound('complete').play();
if (tapCount >= 50) {
LK.showYouWin();
} else {
LK.showGameOver();
}
}
}
if (gameState === 'game5') {
// Snake movement
if (gameTimer % 10 === 0 && snakeSegments.length > 0) {
var head = snakeSegments[0];
var newX = head.x;
var newY = head.y;
if (snakeDirection === 'right') newX += 40;
if (snakeDirection === 'left') newX -= 40;
if (snakeDirection === 'up') newY -= 40;
if (snakeDirection === 'down') newY += 40;
// Check boundaries
if (newX < 20 || newX > 2028 || newY < 20 || newY > 2712) {
LK.showGameOver();
return;
}
// Check food collision
if (food && Math.abs(newX - food.x) < 40 && Math.abs(newY - food.y) < 40) {
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
// Add new segment
var newSegment = new SnakeSegment();
newSegment.x = newX;
newSegment.y = newY;
snakeSegments.unshift(newSegment);
game.addChild(newSegment);
gameObjects.push(newSegment);
// Move food
food.x = 200 + Math.random() * 1648;
food.y = 200 + Math.random() * 2332;
} else {
// Move snake
for (var i = snakeSegments.length - 1; i > 0; i--) {
snakeSegments[i].x = snakeSegments[i - 1].x;
snakeSegments[i].y = snakeSegments[i - 1].y;
}
head.x = newX;
head.y = newY;
}
}
}
if (gameState === 'game6') {
// Bird collision with pipes
if (bird) {
for (var i = 0; i < pipes.length; i++) {
if (bird.intersects(pipes[i])) {
LK.showGameOver();
return;
}
}
}
}
if (gameState === 'game8') {
// Missile collision with enemies
for (var i = missiles.length - 1; i >= 0; i--) {
for (var j = enemies.length - 1; j >= 0; j--) {
if (missiles[i] && enemies[j] && missiles[i].intersects(enemies[j])) {
missiles[i].destroy();
missiles.splice(i, 1);
enemies[j].destroy();
enemies.splice(j, 1);
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('hit').play();
break;
}
}
}
// Player collision with enemies
if (player) {
for (var i = 0; i < enemies.length; i++) {
if (player.intersects(enemies[i])) {
LK.showGameOver();
return;
}
}
}
}
if (gameState === 'game9') {
// Player collision with obstacles
if (player) {
for (var i = 0; i < obstacles.length; i++) {
if (player.intersects(obstacles[i])) {
LK.showGameOver();
return;
}
}
}
}
if (gameState === 'game10') {
// Check if all dots collected
var allDotsCollected = true;
for (var i = 0; i < dots.length; i++) {
if (!dots[i].collected) {
allDotsCollected = false;
break;
}
}
if (allDotsCollected) {
LK.getSound('complete').play();
LK.showYouWin();
}
}
if (gameState === 'game11') {
// Check if football hits goal
if (football && football.kicked && goal && football.intersects(goal)) {
// Check if goalkeeper is not blocking
if (!goalkeeper || !football.intersects(goalkeeper)) {
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
}
// Reset football
football.x = 1024;
football.y = 2200;
football.kicked = false;
football.speedX = 0;
football.speedY = 0;
}
}
if (gameState === 'game12') {
// Check punch collision with gloves
for (var i = punches.length - 1; i >= 0; i--) {
for (var j = gloves.length - 1; j >= 0; j--) {
if (punches[i] && gloves[j] && punches[i].intersects(gloves[j])) {
punches[i].destroy();
punches.splice(i, 1);
gloves[j].destroy();
gloves.splice(j, 1);
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('hit').play();
break;
}
}
}
}
if (gameState === 'game13') {
// Roulette auto-updates through its own update method
// Color changes are handled by the interval in startGame13
}
if (gameState === 'game14') {
// Bullet collision with enemies
for (var i = bullets.length - 1; i >= 0; i--) {
for (var j = gunEnemies.length - 1; j >= 0; j--) {
if (bullets[i] && gunEnemies[j] && bullets[i].intersects(gunEnemies[j])) {
bullets[i].destroy();
bullets.splice(i, 1);
gunEnemies[j].destroy();
gunEnemies.splice(j, 1);
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('hit').play();
break;
}
}
}
// Player collision with enemies
if (player) {
for (var i = 0; i < gunEnemies.length; i++) {
if (player.intersects(gunEnemies[i])) {
LK.showGameOver();
return;
}
}
}
}
if (gameState === 'game15') {
// Ball collision with walls
for (var i = pacBalls.length - 1; i >= 0; i--) {
for (var j = 0; j < walls.length; j++) {
if (pacBalls[i] && pacBalls[i].intersects(walls[j])) {
pacBalls[i].destroy();
pacBalls.splice(i, 1);
break;
}
}
}
// Player collision with walls
if (player) {
for (var i = 0; i < walls.length; i++) {
if (player.intersects(walls[i])) {
// Push player back
if (player.x < walls[i].x) player.x = walls[i].x - 100;else player.x = walls[i].x + 100;
if (player.y < walls[i].y) player.y = walls[i].y - 100;else player.y = walls[i].y + 100;
}
}
}
}
if (gameState === 'game16') {
// Runner collision with platforms
if (runner) {
runner.grounded = false;
for (var i = 0; i < platforms.length; i++) {
if (runner.intersects(platforms[i]) && runner.speedY >= 0) {
runner.y = platforms[i].y - 30;
runner.speedY = 0;
runner.grounded = true;
break;
}
}
// Check if runner reached the end
if (runner.x > 2900) {
LK.getSound('complete').play();
LK.showYouWin();
}
}
}
if (gameState === 'game17') {
// Clean up destroyed bombs and fruits
for (var i = bombs.length - 1; i >= 0; i--) {
if (bombs[i].shouldDestroy) {
bombs.splice(i, 1);
}
}
for (var i = fruits.length - 1; i >= 0; i--) {
if (fruits[i].shouldDestroy) {
fruits.splice(i, 1);
}
}
}
if (gameState === 'game18') {
// Check if crab moved during red light
if (crab && isRedLight && crab.isMoving) {
returnToMenu();
return;
}
// Check if crab reached finish line
if (crab && crab.y <= 650) {
LK.setScore(LK.getScore() + 100);
scoreText.setText(LK.getScore());
LK.getSound('complete').play();
// Transition to rope jumping game
startGame19();
}
}
if (gameState === 'game19') {
// Update crab physics
if (crab) {
crabJumpSpeed += 0.8; // gravity
crab.y += crabJumpSpeed;
// Ground collision
if (crab.y >= 2000) {
crab.y = 2000;
crabJumpSpeed = 0;
crabGrounded = true;
}
}
// Check rope collision with crab - crab must touch rope
if (rope && crab && crab.intersects(rope) && rope.isAtBottom && !crabGrounded) {
LK.showGameOver();
return;
}
// Check successful jump
if (rope && crab && rope.lastIsAtBottom && !rope.isAtBottom && crab.y < 1800 && crabGrounded) {
jumpCount++;
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
// Update jump count display
if (gameObjects.length > 1) {
gameObjects[1].setText('Jumps: ' + jumpCount);
}
}
// Track rope position for jump detection
if (rope) {
rope.lastIsAtBottom = rope.isAtBottom;
}
// Check win condition
if (jumpCount >= 10) {
LK.getSound('complete').play();
LK.showYouWin();
}
}
if (gameState === 'game20') {
// Check pole collision with enemies
for (var i = combaPoles.length - 1; i >= 0; i--) {
for (var j = combaEnemies.length - 1; j >= 0; j--) {
if (combaPoles[i] && combaEnemies[j] && combaPoles[i].intersects(combaEnemies[j])) {
combaEnemies[j].destroy();
combaEnemies.splice(j, 1);
combaJumpCount++;
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('hit').play();
// Update kill count display
if (combaKillCountText) {
combaKillCountText.setText('Kills: ' + combaJumpCount);
}
break;
}
}
}
// Clean up destroyed enemies
for (var i = combaEnemies.length - 1; i >= 0; i--) {
if (combaEnemies[i].shouldDestroy) {
combaEnemies.splice(i, 1);
}
}
// Check win condition
if (combaJumpCount >= 20) {
LK.getSound('complete').play();
LK.showYouWin();
}
}
if (gameState === 'game21') {
// Update mariano player physics
if (marianoPlayer) {
marianoJumpSpeed += 0.8; // gravity
marianoPlayer.y += marianoJumpSpeed;
// Ground collision
if (marianoPlayer.y >= 2000) {
marianoPlayer.y = 2000;
marianoJumpSpeed = 0;
marianoGrounded = true;
}
// Move world backward (running effect)
marianoDistance += marianoSpeed;
if (marianoDistanceText) {
marianoDistanceText.setText('Distance: ' + Math.floor(marianoDistance / 10) + 'm');
}
// Move obstacles
for (var i = marianoObstacles.length - 1; i >= 0; i--) {
marianoObstacles[i].x -= marianoSpeed;
if (marianoObstacles[i].x < -100) {
marianoObstacles[i].x = 2500 + Math.random() * 500;
}
}
// Move coins
for (var i = marianoCoins.length - 1; i >= 0; i--) {
marianoCoins[i].x -= marianoSpeed;
if (marianoCoins[i].x < -100) {
marianoCoins[i].x = 2500 + Math.random() * 500;
marianoCoins[i].y = 1400 + Math.random() * 400;
}
}
// Move platforms
for (var i = marianoJumps.length - 1; i >= 0; i--) {
marianoJumps[i].x -= marianoSpeed;
if (marianoJumps[i].x < -100) {
marianoJumps[i].x = 2500 + Math.random() * 500;
marianoJumps[i].y = 1000 + Math.random() * 800;
}
}
// Platform collision
marianoGrounded = false;
for (var i = 0; i < marianoJumps.length; i++) {
if (marianoPlayer.intersects(marianoJumps[i]) && marianoJumpSpeed >= 0) {
marianoPlayer.y = marianoJumps[i].y - 25;
marianoJumpSpeed = 0;
marianoGrounded = true;
break;
}
}
// Ground collision check
if (marianoPlayer.y >= 2000) {
marianoPlayer.y = 2000;
marianoJumpSpeed = 0;
marianoGrounded = true;
}
// Obstacle collision
for (var i = 0; i < marianoObstacles.length; i++) {
if (marianoPlayer.intersects(marianoObstacles[i])) {
LK.showGameOver();
return;
}
}
// Coin collection
for (var i = marianoCoins.length - 1; i >= 0; i--) {
if (marianoPlayer.intersects(marianoCoins[i])) {
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
marianoCoins[i].x = 2500 + Math.random() * 500;
marianoCoins[i].y = 1400 + Math.random() * 400;
}
}
// Increase speed over time
marianoSpeed += 0.001;
if (marianoSpeed > 12) marianoSpeed = 12;
// Win condition - survive for distance
if (marianoDistance > 5000) {
LK.getSound('complete').play();
LK.showYouWin();
}
}
}
if (gameState === 'game24') {
speedTapTimer--;
if (gameObjects.length > 1) {
gameObjects[1].setText('Time: ' + Math.ceil(speedTapTimer / 60));
}
if (speedTapTimer <= 0) {
LK.getSound('complete').play();
if (LK.getScore() >= 50) {
LK.showYouWin();
} else {
LK.showGameOver();
}
}
}
if (gameState === 'game25') {
// Move target randomly
if (circleTarget && gameTimer % 120 === 0) {
circleTarget.x = 300 + Math.random() * 1400;
circleTarget.y = 300 + Math.random() * 2000;
}
// Check if chaser caught target
if (circleChaser && circleTarget && circleChaser.intersects(circleTarget)) {
LK.setScore(LK.getScore() + 20);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
circleTarget.x = 300 + Math.random() * 1400;
circleTarget.y = 300 + Math.random() * 2000;
if (LK.getScore() >= 100) {
LK.showYouWin();
}
}
}
if (gameState === 'game26') {
// Update falling blocks
for (var i = stackBlocks.length - 1; i >= 0; i--) {
if (stackBlocks[i].speedY !== undefined) {
stackBlocks[i].y += stackBlocks[i].speedY;
// Check if block landed
if (stackBlocks[i].y >= 2400 - stackHeight * 90) {
stackBlocks[i].y = 2400 - stackHeight * 90 - 45;
stackBlocks[i].speedY = undefined;
stackHeight++;
LK.setScore(LK.getScore() + 5);
scoreText.setText(LK.getScore());
LK.getSound('score').play();
if (gameObjects.length > 1) {
gameObjects[1].setText('Height: ' + stackHeight);
}
if (stackHeight >= 10) {
LK.showYouWin();
}
}
}
}
}
if (gameState === 'game27') {
// Check wall collisions
if (mazePlayer) {
for (var i = 0; i < mazeWalls.length; i++) {
if (mazePlayer.intersects(mazeWalls[i])) {
// Push player back
if (mazePlayer.x < mazeWalls[i].x) mazePlayer.x = mazeWalls[i].x - 100;else mazePlayer.x = mazeWalls[i].x + 100;
if (mazePlayer.y < mazeWalls[i].y) mazePlayer.y = mazeWalls[i].y - 100;else mazePlayer.y = mazeWalls[i].y + 100;
}
}
// Check if reached exit
if (mazeExit && mazePlayer.intersects(mazeExit)) {
LK.getSound('complete').play();
LK.showYouWin();
}
}
}
// Game 28: Bubble Pop updates
if (gameState === 'game28') {
bubbleTimer++;
if (bubbleTimer % 60 === 0) {
var bubble = new Target();
bubble.x = 200 + Math.random() * 1648;
bubble.y = 2732;
bubble.speedY = -2 - Math.random() * 3;
bubble.tint = 0x87CEEB;
bubbles.push(bubble);
game.addChild(bubble);
gameObjects.push(bubble);
}
// Move bubbles up
for (var i = bubbles.length - 1; i >= 0; i--) {
if (bubbles[i]) {
bubbles[i].y += bubbles[i].speedY;
if (bubbles[i].y < 0) {
LK.showGameOver();
return;
}
}
}
}
// Game 30: Time Warp updates
if (gameState === 'game30') {
timeWarpSpeed = 1 + Math.sin(gameTimer * 0.05) * 0.5;
for (var i = 0; i < timeWarpTargets.length; i++) {
if (timeWarpTargets[i]) {
timeWarpTargets[i].rotation += timeWarpTargets[i].timeSpeed * timeWarpSpeed * 0.1;
timeWarpTargets[i].scaleX = 1 + Math.sin(gameTimer * timeWarpTargets[i].timeSpeed * 0.1) * 0.3;
timeWarpTargets[i].scaleY = timeWarpTargets[i].scaleX;
}
}
}
// Game 31: Color Storm updates
if (gameState === 'game31') {
if (gameTimer % 90 === 0) {
var ball = new Target();
ball.x = Math.random() * 2048;
ball.y = 0;
ball.speedY = 3 + Math.random() * 4;
ball.ballColor = Math.floor(Math.random() * stormColors.length);
ball.tint = stormColors[ball.ballColor];
colorStormBalls.push(ball);
game.addChild(ball);
gameObjects.push(ball);
}
if (gameTimer % 300 === 0) {
currentStormColor = (currentStormColor + 1) % stormColors.length;
gameObjects[1].tint = stormColors[currentStormColor];
}
}
// Game 32: Gravity Fall updates
if (gameState === 'game32') {
for (var i = 0; i < gravityObjects.length; i++) {
if (gravityObjects[i]) {
gravityObjects[i].gravitySpeed += gravityDirection * 0.5;
gravityObjects[i].y += gravityObjects[i].gravitySpeed;
if (gravityObjects[i].y < 0 || gravityObjects[i].y > 2732) {
gravityObjects[i].y = 1366;
gravityObjects[i].gravitySpeed = 0;
}
}
}
}
// Game 35: Rhythm Tap updates
if (gameState === 'game35') {
rhythmTimer++;
if (rhythmTimer % 120 === 0) {
var beat = new Target();
beat.x = 1024;
beat.y = 200;
beat.speedY = 8;
beat.tint = 0xff0000;
rhythmBeats.push(beat);
game.addChild(beat);
gameObjects.push(beat);
}
for (var i = rhythmBeats.length - 1; i >= 0; i--) {
if (rhythmBeats[i]) {
rhythmBeats[i].y += rhythmBeats[i].speedY;
if (rhythmBeats[i].y > 2000) {
rhythmBeats[i].destroy();
rhythmBeats.splice(i, 1);
}
}
}
}
// Game 36: Twisty Turn updates
if (gameState === 'game36') {
twistyAngle += 0.05;
if (twistyPlayer) {
twistyPlayer.x = 1024 + Math.cos(twistyAngle) * 150;
twistyPlayer.y = 1366 + Math.sin(twistyAngle) * 150;
}
// Update orbiting obstacles
for (var i = 2; i < gameObjects.length; i++) {
if (gameObjects[i] && gameObjects[i].orbitRadius) {
gameObjects[i].orbitAngle += gameObjects[i].orbitSpeed;
gameObjects[i].x = 1024 + Math.cos(gameObjects[i].orbitAngle) * gameObjects[i].orbitRadius;
gameObjects[i].y = 1366 + Math.sin(gameObjects[i].orbitAngle) * gameObjects[i].orbitRadius;
if (twistyPlayer && twistyPlayer.intersects(gameObjects[i])) {
LK.showGameOver();
return;
}
}
}
}
// Game 42: Orbit Strike updates
if (gameState === 'game42') {
orbitAngle += 0.02;
for (var i = 0; i < orbitObjects.length; i++) {
if (orbitObjects[i]) {
orbitObjects[i].orbitAngle += orbitObjects[i].orbitSpeed;
orbitObjects[i].x = 1024 + Math.cos(orbitObjects[i].orbitAngle) * orbitObjects[i].orbitRadius;
orbitObjects[i].y = 1366 + Math.sin(orbitObjects[i].orbitAngle) * orbitObjects[i].orbitRadius;
}
}
}
// Game 43: Void Walker updates
if (gameState === 'game43') {
if (voidPlayer) {
voidPlayer.speedY += 0.8;
voidPlayer.y += voidPlayer.speedY;
// Platform collision
for (var i = 0; i < voidPlatforms.length; i++) {
if (voidPlatforms[i] && voidPlatforms[i].solid && voidPlayer.intersects(voidPlatforms[i]) && voidPlayer.speedY >= 0) {
voidPlayer.y = voidPlatforms[i].y - 25;
voidPlayer.speedY = 0;
}
}
// Update platform timers
for (var i = 0; i < voidPlatforms.length; i++) {
if (voidPlatforms[i] && voidPlatforms[i].solid) {
voidPlatforms[i].disappearTimer--;
if (voidPlatforms[i].disappearTimer <= 0) {
voidPlatforms[i].solid = false;
voidPlatforms[i].alpha = 0.3;
}
}
}
if (voidPlayer.y > 2732) {
LK.showGameOver();
return;
}
if (voidPlayer.x > 1800) {
LK.showYouWin();
}
}
}
};
// Initialize
hideBackButton();
showMenu();
LK.playMusic('bgmusic');
;
ladrillo . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
bomba. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
bill balla de super mario bros . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
boton. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
tv. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
un dollar. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
jugador 456 del juego del camalar. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
dot. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
un monstro. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
unahamburguesa del mcdonal. In-Game asset. 2d. High contrast. No shadows
pelota de football. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat