User prompt
tamaño normal
User prompt
que sena las cosas mas pequeñas
User prompt
muchos ams y inventados por ti
User prompt
mas
User prompt
pero los juegos del pirncipio
User prompt
menos
User prompt
Please fix the bug: 'TypeError: gameObjects[1].setText is not a function' in or related to this line: 'gameObjects[1].setText('Distance: ' + Math.floor(marianoDistance / 10) + 'm');' Line Number: 2417
User prompt
ahora uno que sellame: mariano el brosiano . es un parkour
User prompt
Please fix the bug: 'TypeError: gameObjects[1].setText is not a function' in or related to this line: 'gameObjects[1].setText('Kills: ' + combaJumpCount);' Line Number: 2261
User prompt
mejor que el juego sea que tengas que mover palos para matar a enemigos
User prompt
pero mejor que salte izquierda derecha un palo y tengas que saltarlo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que se mueva girando y tenags que esquivarlo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
otro juego que se llame : comba: y que sea el juego de la comba
User prompt
pero tienes que tocarlo con el cuadrado rojo osea el personaje
User prompt
si tocas el finish line que te pase a un segundo minijuego paret de el cangrejo que ea el de la cuerda el de saltar la comba peroo 2d
User prompt
en el :el cangrejo. si te mueves en cuando no puedes que el juego te mande al menu de minijuegos
User prompt
otro juego que sea:el juego el cangrejo: que sea el luz verde y luez roja del jeugo del calamar pero 2d
User prompt
y que las bombas giren y que lleguen alto solo cada que explotes una fruta ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que se lancen muy arriba las frutas
User prompt
que las frutas e lancen mas lejos
User prompt
ahora otros ms que sean:canon true.. que sea un fruit ninja pero que las bombas sean la sbuena sy las fruats las malas
User prompt
ahora otros mas que sean: primero:gun bomb . que tengas que disparar a enemigos.. segundo:pac the...un laberinto que tengas que lanzar pelotas a diferenets cosa..y tercero:speed mob.. que tengas que hacer un parkour entero
User prompt
mas osea pon mas mini juegos y que 3 de ellos sean: footme. es un juego estilo penaltis . segundo: punch he .. un juego que tienes que destruir guantes de boxxeo.. y tercero:rullete 1. solo es una ruleta de colores ose aun clicker
User prompt
ahora 10 minijueegos
User prompt
que la pelota de este juego valla veloz
/**** * 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: 40, 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 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 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 Hole = Container.expand(function () { var self = Container.call(this); var holeGraphics = self.attachAsset('hole', { anchorX: 0.5, anchorY: 0.5 }); 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 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 Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); 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; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ // Score display var scoreText = new Text2('0', { size: 60, fill: 0x333333 }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); // Game state variables var gameState = 'menu'; // 'menu', 'game1', 'game2', 'game3', 'game4', 'game5', 'game6', 'game7', 'game8', 'game9', 'game10' 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; // Menu title var menuTitle = new Text2('Mini-Games Collection', { size: 60, fill: 0x333333 }); menuTitle.anchor.set(0.5, 0.5); menuTitle.x = 1024; menuTitle.y = 400; game.addChild(menuTitle); // Mini-game buttons in 5x2 grid var game1Button = new ActionButton('Target Shooter', function () { startGame1(); }); game1Button.x = 200; game1Button.y = 700; game.addChild(game1Button); var game2Button = new ActionButton('Breakout', function () { startGame2(); }); game2Button.x = 500; game2Button.y = 700; game.addChild(game2Button); var game3Button = new ActionButton('Memory Tiles', function () { startGame3(); }); game3Button.x = 800; game3Button.y = 700; game.addChild(game3Button); var game4Button = new ActionButton('Tap Challenge', function () { startGame4(); }); game4Button.x = 1100; game4Button.y = 700; game.addChild(game4Button); var game5Button = new ActionButton('Snake', function () { startGame5(); }); game5Button.x = 1400; game5Button.y = 700; game.addChild(game5Button); var game6Button = new ActionButton('Flappy Bird', function () { startGame6(); }); game6Button.x = 200; game6Button.y = 1000; game.addChild(game6Button); var game7Button = new ActionButton('Whack-a-Mole', function () { startGame7(); }); game7Button.x = 500; game7Button.y = 1000; game.addChild(game7Button); var game8Button = new ActionButton('Space Shooter', function () { startGame8(); }); game8Button.x = 800; game8Button.y = 1000; game.addChild(game8Button); var game9Button = new ActionButton('Endless Runner', function () { startGame9(); }); game9Button.x = 1100; game9Button.y = 1000; game.addChild(game9Button); var game10Button = new ActionButton('Pac-Dots', function () { startGame10(); }); game10Button.x = 1400; game10Button.y = 1000; game.addChild(game10Button); // 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: 40, 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: 50, 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: 50, 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); } } } 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; } 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; } 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 = []; 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; } }; 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); } }; 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(); } } }; // Initialize hideBackButton(); showMenu(); LK.playMusic('bgmusic'); ;
===================================================================
--- original.js
+++ change.js
@@ -67,24 +67,189 @@
}
};
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 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 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 Hole = Container.expand(function () {
+ var self = Container.call(this);
+ var holeGraphics = self.attachAsset('hole', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ 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 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 Player = Container.expand(function () {
+ var self = Container.call(this);
+ var playerGraphics = self.attachAsset('player', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ 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,
@@ -140,11 +305,26 @@
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
// Game state variables
-var gameState = 'menu'; // 'menu', 'game1', 'game2', 'game3', 'game4'
+var gameState = 'menu'; // 'menu', 'game1', 'game2', 'game3', 'game4', 'game5', 'game6', 'game7', 'game8', 'game9', 'game10'
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;
// Menu title
var menuTitle = new Text2('Mini-Games Collection', {
size: 60,
fill: 0x333333
@@ -152,33 +332,69 @@
menuTitle.anchor.set(0.5, 0.5);
menuTitle.x = 1024;
menuTitle.y = 400;
game.addChild(menuTitle);
-// Mini-game buttons
+// Mini-game buttons in 5x2 grid
var game1Button = new ActionButton('Target Shooter', function () {
startGame1();
});
-game1Button.x = 512;
-game1Button.y = 800;
+game1Button.x = 200;
+game1Button.y = 700;
game.addChild(game1Button);
var game2Button = new ActionButton('Breakout', function () {
startGame2();
});
-game2Button.x = 1536;
-game2Button.y = 800;
+game2Button.x = 500;
+game2Button.y = 700;
game.addChild(game2Button);
var game3Button = new ActionButton('Memory Tiles', function () {
startGame3();
});
-game3Button.x = 512;
-game3Button.y = 1200;
+game3Button.x = 800;
+game3Button.y = 700;
game.addChild(game3Button);
var game4Button = new ActionButton('Tap Challenge', function () {
startGame4();
});
-game4Button.x = 1536;
-game4Button.y = 1200;
+game4Button.x = 1100;
+game4Button.y = 700;
game.addChild(game4Button);
+var game5Button = new ActionButton('Snake', function () {
+ startGame5();
+});
+game5Button.x = 1400;
+game5Button.y = 700;
+game.addChild(game5Button);
+var game6Button = new ActionButton('Flappy Bird', function () {
+ startGame6();
+});
+game6Button.x = 200;
+game6Button.y = 1000;
+game.addChild(game6Button);
+var game7Button = new ActionButton('Whack-a-Mole', function () {
+ startGame7();
+});
+game7Button.x = 500;
+game7Button.y = 1000;
+game.addChild(game7Button);
+var game8Button = new ActionButton('Space Shooter', function () {
+ startGame8();
+});
+game8Button.x = 800;
+game8Button.y = 1000;
+game.addChild(game8Button);
+var game9Button = new ActionButton('Endless Runner', function () {
+ startGame9();
+});
+game9Button.x = 1100;
+game9Button.y = 1000;
+game.addChild(game9Button);
+var game10Button = new ActionButton('Pac-Dots', function () {
+ startGame10();
+});
+game10Button.x = 1400;
+game10Button.y = 1000;
+game.addChild(game10Button);
// Back button
var backButton = new ActionButton('Back to Menu', function () {
returnToMenu();
});
@@ -300,21 +516,226 @@
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);
+ }
+ }
+}
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;
}
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;
}
function showBackButton() {
backButton.visible = true;
}
@@ -329,8 +750,17 @@
}
gameObjects = [];
blocks = [];
tiles = [];
+ snakeSegments = [];
+ pipes = [];
+ moles = [];
+ holes = [];
+ missiles = [];
+ enemies = [];
+ obstacles = [];
+ coins = [];
+ dots = [];
hideBackButton();
showMenu();
}
// Game controls
@@ -339,8 +769,28 @@
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;
+ }
};
game.down = function (x, y, obj) {
if (gameState === 'game4') {
tapCount++;
@@ -350,8 +800,27 @@
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);
+ }
};
game.update = function () {
if (gameState === 'menu') {
return;
@@ -417,8 +886,111 @@
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();
+ }
+ }
};
// Initialize
hideBackButton();
showMenu();
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