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 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: 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', 'game11', 'game12', 'game13', 'game14', 'game15', 'game16', 'game17', 'game18', 'game20'
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;
// 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);
var game11Button = new ActionButton('FootMe', function () {
startGame11();
});
game11Button.x = 200;
game11Button.y = 1300;
game.addChild(game11Button);
var game12Button = new ActionButton('Punch Me', function () {
startGame12();
});
game12Button.x = 500;
game12Button.y = 1300;
game.addChild(game12Button);
var game13Button = new ActionButton('Roulette', function () {
startGame13();
});
game13Button.x = 800;
game13Button.y = 1300;
game.addChild(game13Button);
var game14Button = new ActionButton('Gun Bomb', function () {
startGame14();
});
game14Button.x = 1100;
game14Button.y = 1300;
game.addChild(game14Button);
var game15Button = new ActionButton('Pac The', function () {
startGame15();
});
game15Button.x = 1400;
game15Button.y = 1300;
game.addChild(game15Button);
var game18Button = new ActionButton('El Cangrejo', function () {
startGame18();
});
game18Button.x = 1100;
game18Button.y = 1600;
game.addChild(game18Button);
var game17Button = new ActionButton('Canon True', function () {
startGame17();
});
game17Button.x = 1400;
game17Button.y = 1600;
game.addChild(game17Button);
var game20Button = new ActionButton('Comba', function () {
startGame20();
});
game20Button.x = 200;
game20Button.y = 1600;
game.addChild(game20Button);
// 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);
}
}
}
// 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: 40,
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: 50,
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: 40,
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: 50,
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: 40,
fill: 0x333333
});
combaInstructionText.anchor.set(0.5, 0.5);
combaInstructionText.x = 1024;
combaInstructionText.y = 1200;
game.addChild(combaInstructionText);
gameObjects.push(combaInstructionText);
}
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;
game18Button.visible = false;
game17Button.visible = false;
game20Button.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;
game18Button.visible = true;
game17Button.visible = true;
game20Button.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;
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;
}
};
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;
}
}
}
};
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();
}
}
};
// Initialize
hideBackButton();
showMenu();
LK.playMusic('bgmusic');
; ===================================================================
--- original.js
+++ change.js
@@ -698,8 +698,9 @@
var combaPlayerGrounded = true;
var combaEnemies = [];
var combaPoles = [];
var draggedPole = null;
+var combaKillCountText = null;
// Menu title
var menuTitle = new Text2('Mini-Games Collection', {
size: 60,
fill: 0x333333
@@ -1526,17 +1527,17 @@
LK.clearInterval(enemySpawnInterval);
}
}, 2000);
// Create kill count display
- var combaJumpCountText = new Text2('Kills: 0', {
+ combaKillCountText = new Text2('Kills: 0', {
size: 50,
fill: 0x333333
});
- combaJumpCountText.anchor.set(0.5, 0.5);
- combaJumpCountText.x = 1024;
- combaJumpCountText.y = 1000;
- game.addChild(combaJumpCountText);
- gameObjects.push(combaJumpCountText);
+ 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: 40,
fill: 0x333333
@@ -1631,8 +1632,9 @@
combaPlayerGrounded = true;
combaEnemies = [];
combaPoles = [];
draggedPole = null;
+ combaKillCountText = null;
hideBackButton();
showMenu();
}
// Game controls
@@ -2140,10 +2142,10 @@
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
LK.getSound('hit').play();
// Update kill count display
- if (gameObjects.length > 1) {
- gameObjects[1].setText('Kills: ' + combaJumpCount);
+ if (combaKillCountText) {
+ combaKillCountText.setText('Kills: ' + combaJumpCount);
}
break;
}
}
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