User prompt
mejor quita todo y que se aun juego con minijeugos
User prompt
que el boton play cuando le des te mande a un menu que tenga 4 minijuegos
Code edit (1 edits merged)
Please save this source code
User prompt
Pet Care Buddy
User prompt
mejor un juego estilo pou
Initial prompt
un juego que sea un clicker
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var ActionButton = Container.expand(function (text, action) { var self = Container.call(this); var buttonBg = self.attachAsset('button', { anchorX: 0.5, anchorY: 0.5 }); var buttonText = new Text2(text, { size: 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 Block = Container.expand(function () { var self = Container.call(this); var blockGraphics = self.attachAsset('block', { anchorX: 0.5, anchorY: 0.5 }); 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 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' var gameTimer = 0; var gameObjects = []; // 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 var game1Button = new ActionButton('Target Shooter', function () { startGame1(); }); game1Button.x = 512; game1Button.y = 800; game.addChild(game1Button); var game2Button = new ActionButton('Breakout', function () { startGame2(); }); game2Button.x = 1536; game2Button.y = 800; game.addChild(game2Button); var game3Button = new ActionButton('Memory Tiles', function () { startGame3(); }); game3Button.x = 512; game3Button.y = 1200; game.addChild(game3Button); var game4Button = new ActionButton('Tap Challenge', function () { startGame4(); }); game4Button.x = 1536; game4Button.y = 1200; game.addChild(game4Button); // 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 = 3; ball.speedY = -3; 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); } function hideMenu() { menuTitle.visible = false; game1Button.visible = false; game2Button.visible = false; game3Button.visible = false; game4Button.visible = false; } function showMenu() { menuTitle.visible = true; game1Button.visible = true; game2Button.visible = true; game3Button.visible = true; game4Button.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 = []; 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; } }; 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); } } }; 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(); } } } }; // Initialize hideBackButton(); showMenu(); LK.playMusic('bgmusic'); ;
===================================================================
--- original.js
+++ change.js
@@ -13,9 +13,9 @@
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2(text, {
- size: 30,
+ size: 40,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
@@ -42,185 +42,83 @@
}
};
return self;
});
-var CleaningBubble = Container.expand(function () {
+var Ball = Container.expand(function () {
var self = Container.call(this);
- var bubbleGraphics = self.attachAsset('bubble', {
+ var ballGraphics = self.attachAsset('ball', {
anchorX: 0.5,
anchorY: 0.5
});
- self.speed = 2 + Math.random() * 3;
- self.life = 60 + Math.random() * 120;
- self.maxLife = self.life;
+ self.speedX = 0;
+ self.speedY = 0;
self.update = function () {
- self.y -= self.speed;
- self.life--;
- var alpha = self.life / self.maxLife;
- bubbleGraphics.alpha = alpha;
- if (self.life <= 0) {
+ 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;
}
};
- self.down = function (x, y, obj) {
- self.shouldDestroy = true;
- pet.clean();
- LK.setScore(LK.getScore() + 10);
- scoreText.setText(LK.getScore());
- };
return self;
});
-var Pet = Container.expand(function () {
+var Block = Container.expand(function () {
var self = Container.call(this);
- var petGraphics = self.attachAsset('pet', {
+ var blockGraphics = self.attachAsset('block', {
anchorX: 0.5,
anchorY: 0.5
});
- self.hunger = 100;
- self.happiness = 100;
- self.cleanliness = 100;
- self.size = 1;
- self.color = 0x87CEEB;
- self.isAnimating = false;
- self.feed = function () {
- if (self.hunger < 100) {
- self.hunger = Math.min(100, self.hunger + 25);
- self.animate('bounce');
- LK.getSound('feed').play();
- }
- };
- self.clean = function () {
- if (self.cleanliness < 100) {
- self.cleanliness = Math.min(100, self.cleanliness + 30);
- self.animate('shake');
- LK.getSound('clean').play();
- }
- };
- self.playWith = function () {
- if (self.happiness < 100) {
- self.happiness = Math.min(100, self.happiness + 20);
- self.animate('jump');
- LK.getSound('play').play();
- }
- };
- self.animate = function (type) {
- if (self.isAnimating) return;
- self.isAnimating = true;
- var originalScale = self.scaleX;
- var originalY = self.y;
- if (type === 'bounce') {
- tween(self, {
- scaleX: originalScale * 1.2,
- scaleY: originalScale * 1.2
- }, {
- duration: 200,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- tween(self, {
- scaleX: originalScale,
- scaleY: originalScale
- }, {
- duration: 200,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- self.isAnimating = false;
- }
- });
- }
- });
- } else if (type === 'shake') {
- var shakeCount = 0;
- var shakeInterval = LK.setInterval(function () {
- self.x += shakeCount % 2 === 0 ? 10 : -10;
- shakeCount++;
- if (shakeCount >= 8) {
- LK.clearInterval(shakeInterval);
- self.x = 1024;
- self.isAnimating = false;
- }
- }, 50);
- } else if (type === 'jump') {
- tween(self, {
- y: originalY - 50
- }, {
- duration: 300,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- tween(self, {
- y: originalY
- }, {
- duration: 300,
- easing: tween.easeIn,
- onFinish: function onFinish() {
- self.isAnimating = false;
- }
- });
- }
- });
- }
- };
- self.update = function () {
- // Decrease needs over time
- if (LK.ticks % 300 === 0) {
- // Every 5 seconds
- self.hunger = Math.max(0, self.hunger - 1);
- self.happiness = Math.max(0, self.happiness - 0.5);
- self.cleanliness = Math.max(0, self.cleanliness - 0.8);
- }
- // Change pet color based on mood
- var avgMood = (self.hunger + self.happiness + self.cleanliness) / 3;
- if (avgMood > 70) {
- petGraphics.tint = 0x87CEEB; // Happy blue
- } else if (avgMood > 40) {
- petGraphics.tint = 0xFFB347; // Neutral orange
- } else {
- petGraphics.tint = 0xFF6B6B; // Sad red
- }
- // Idle animation
- if (!self.isAnimating && LK.ticks % 180 === 0) {
- var randomScale = 0.95 + Math.random() * 0.1;
- tween(self, {
- scaleX: randomScale,
- scaleY: randomScale
- }, {
- duration: 1000,
- easing: tween.easeInOut,
- onFinish: function onFinish() {
- tween(self, {
- scaleX: 1,
- scaleY: 1
- }, {
- duration: 1000,
- easing: tween.easeInOut
- });
- }
- });
- }
- };
return self;
});
-var StatusBar = Container.expand(function (type, maxValue) {
+var Paddle = Container.expand(function () {
var self = Container.call(this);
- var background = self.attachAsset('meterBg', {
- anchorX: 0,
+ var paddleGraphics = self.attachAsset('paddle', {
+ anchorX: 0.5,
anchorY: 0.5
});
- var bar = self.attachAsset('meterBar', {
- anchorX: 0,
+ return self;
+});
+var Target = Container.expand(function () {
+ var self = Container.call(this);
+ var targetGraphics = self.attachAsset('target', {
+ anchorX: 0.5,
anchorY: 0.5
});
- self.type = type;
- self.maxValue = maxValue;
- self.updateBar = function (value) {
- var percentage = value / self.maxValue;
- bar.scaleX = percentage;
- // Change color based on value
- if (percentage > 0.6) {
- bar.tint = 0x00FF00; // Green
- } else if (percentage > 0.3) {
- bar.tint = 0xFFFF00; // Yellow
- } else {
- bar.tint = 0xFF0000; // Red
+ 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;
});
@@ -234,255 +132,295 @@
/****
* Game Code
****/
-var pet = game.addChild(new Pet());
-pet.x = 1024;
-pet.y = 1200;
-// Status bars
-var hungerBar = new StatusBar('hunger', 100);
-hungerBar.x = 150;
-hungerBar.y = 200;
-game.addChild(hungerBar);
-var happinessBar = new StatusBar('happiness', 100);
-happinessBar.x = 150;
-happinessBar.y = 250;
-game.addChild(happinessBar);
-var cleanlinessBar = new StatusBar('cleanliness', 100);
-cleanlinessBar.x = 150;
-cleanlinessBar.y = 300;
-game.addChild(cleanlinessBar);
-// Status labels
-var hungerLabel = new Text2('Hunger', {
- size: 24,
+// Score display
+var scoreText = new Text2('0', {
+ size: 60,
fill: 0x333333
});
-hungerLabel.anchor.set(0, 0.5);
-hungerLabel.x = 50;
-hungerLabel.y = 200;
-game.addChild(hungerLabel);
-var happinessLabel = new Text2('Happy', {
- size: 24,
+scoreText.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreText);
+// Game state variables
+var gameState = 'menu'; // 'menu', 'game1', 'game2', 'game3', 'game4'
+var gameTimer = 0;
+var gameObjects = [];
+// Menu title
+var menuTitle = new Text2('Mini-Games Collection', {
+ size: 60,
fill: 0x333333
});
-happinessLabel.anchor.set(0, 0.5);
-happinessLabel.x = 50;
-happinessLabel.y = 250;
-game.addChild(happinessLabel);
-var cleanlinessLabel = new Text2('Clean', {
- size: 24,
- fill: 0x333333
-});
-cleanlinessLabel.anchor.set(0, 0.5);
-cleanlinessLabel.x = 50;
-cleanlinessLabel.y = 300;
-game.addChild(cleanlinessLabel);
-// Menu buttons for mini-games
-var menuTitle = new Text2('Choose a Mini-Game', {
- size: 50,
- fill: 0x333333
-});
menuTitle.anchor.set(0.5, 0.5);
menuTitle.x = 1024;
-menuTitle.y = 800;
-var feedGameButton = new ActionButton('Feed Game', function () {
- gameState = 'game';
- selectedMinigame = 'feed';
- showGameElements();
- hideMenuElements();
+menuTitle.y = 400;
+game.addChild(menuTitle);
+// Mini-game buttons
+var game1Button = new ActionButton('Target Shooter', function () {
+ startGame1();
});
-feedGameButton.x = 512;
-feedGameButton.y = 1200;
-var cleanGameButton = new ActionButton('Clean Game', function () {
- gameState = 'game';
- selectedMinigame = 'clean';
- showGameElements();
- hideMenuElements();
+game1Button.x = 512;
+game1Button.y = 800;
+game.addChild(game1Button);
+var game2Button = new ActionButton('Breakout', function () {
+ startGame2();
});
-cleanGameButton.x = 1536;
-cleanGameButton.y = 1200;
-var playGameButton = new ActionButton('Play Game', function () {
- gameState = 'game';
- selectedMinigame = 'play';
- showGameElements();
- hideMenuElements();
+game2Button.x = 1536;
+game2Button.y = 800;
+game.addChild(game2Button);
+var game3Button = new ActionButton('Memory Tiles', function () {
+ startGame3();
});
-playGameButton.x = 512;
-playGameButton.y = 1600;
-var colorGameButton = new ActionButton('Color Game', function () {
- gameState = 'game';
- selectedMinigame = 'color';
- showGameElements();
- hideMenuElements();
+game3Button.x = 512;
+game3Button.y = 1200;
+game.addChild(game3Button);
+var game4Button = new ActionButton('Tap Challenge', function () {
+ startGame4();
});
-colorGameButton.x = 1536;
-colorGameButton.y = 1600;
+game4Button.x = 1536;
+game4Button.y = 1200;
+game.addChild(game4Button);
+// Back button
var backButton = new ActionButton('Back to Menu', function () {
- gameState = 'menu';
- hideGameElements();
- showMenuElements();
+ returnToMenu();
});
backButton.x = 1024;
-backButton.y = 2500;
-// Action buttons
-var feedButton = new ActionButton('Feed', function () {
- pet.feed();
-});
-feedButton.x = 300;
-feedButton.y = 2200;
-var cleanButton = new ActionButton('Clean', function () {
- isCleaningMode = true;
- cleaningTimer = 300; // 5 seconds
-});
-cleanButton.x = 700;
-cleanButton.y = 2200;
-var playButton = new ActionButton('Play', function () {
- pet.playWith();
-});
-playButton.x = 1100;
-playButton.y = 2200;
-var colorButton = new ActionButton('Color', function () {
- var colors = [0x87CEEB, 0xFF69B4, 0x98FB98, 0xFFB347, 0xDDA0DD];
- var currentIndex = colors.indexOf(pet.color);
- var nextIndex = (currentIndex + 1) % colors.length;
- pet.color = colors[nextIndex];
- pet.children[0].tint = pet.color;
-});
-colorButton.x = 1500;
-colorButton.y = 2200;
-// Add all elements to game
-game.addChild(menuTitle);
-game.addChild(feedGameButton);
-game.addChild(cleanGameButton);
-game.addChild(playGameButton);
-game.addChild(colorGameButton);
+backButton.y = 2400;
game.addChild(backButton);
-game.addChild(feedButton);
-game.addChild(cleanButton);
-game.addChild(playButton);
-game.addChild(colorButton);
-// 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', 'game', 'minigame'
-var selectedMinigame = null;
-var isCleaningMode = false;
-var cleaningTimer = 0;
-var bubbles = [];
-// Functions to manage UI visibility
-function showMenuElements() {
- menuTitle.visible = true;
- feedGameButton.visible = true;
- cleanGameButton.visible = true;
- playGameButton.visible = true;
- colorGameButton.visible = true;
+// 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);
}
-function hideMenuElements() {
+// 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 = 3;
+ ball.speedY = -3;
+ 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);
+}
+function hideMenu() {
menuTitle.visible = false;
- feedGameButton.visible = false;
- cleanGameButton.visible = false;
- playGameButton.visible = false;
- colorGameButton.visible = false;
+ game1Button.visible = false;
+ game2Button.visible = false;
+ game3Button.visible = false;
+ game4Button.visible = false;
}
-function showGameElements() {
- pet.visible = true;
- hungerBar.visible = true;
- happinessBar.visible = true;
- cleanlinessBar.visible = true;
- hungerLabel.visible = true;
- happinessLabel.visible = true;
- cleanlinessLabel.visible = true;
+function showMenu() {
+ menuTitle.visible = true;
+ game1Button.visible = true;
+ game2Button.visible = true;
+ game3Button.visible = true;
+ game4Button.visible = true;
+}
+function showBackButton() {
backButton.visible = true;
- // Show specific buttons based on selected mini-game
- feedButton.visible = selectedMinigame === 'feed';
- cleanButton.visible = selectedMinigame === 'clean';
- playButton.visible = selectedMinigame === 'play';
- colorButton.visible = selectedMinigame === 'color';
}
-function hideGameElements() {
- pet.visible = false;
- hungerBar.visible = false;
- happinessBar.visible = false;
- cleanlinessBar.visible = false;
- hungerLabel.visible = false;
- happinessLabel.visible = false;
- cleanlinessLabel.visible = false;
- feedButton.visible = false;
- cleanButton.visible = false;
- playButton.visible = false;
- colorButton.visible = false;
+function hideBackButton() {
backButton.visible = false;
}
-// Pet interaction
-pet.down = function (x, y, obj) {
- if (gameState === 'game' && !isCleaningMode) {
- pet.playWith();
- LK.setScore(LK.getScore() + 5);
+function returnToMenu() {
+ gameState = 'menu';
+ // Clean up game objects
+ for (var i = gameObjects.length - 1; i >= 0; i--) {
+ gameObjects[i].destroy();
+ }
+ gameObjects = [];
+ blocks = [];
+ tiles = [];
+ 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;
+ }
+};
+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);
+ }
}
};
game.update = function () {
if (gameState === 'menu') {
- // Only update menu elements
return;
}
- if (gameState === 'game') {
- // Update status bars
- hungerBar.updateBar(pet.hunger);
- happinessBar.updateBar(pet.happiness);
- cleanlinessBar.updateBar(pet.cleanliness);
- // Cleaning mode
- if (isCleaningMode) {
- cleaningTimer--;
- // Spawn bubbles
- if (LK.ticks % 20 === 0) {
- var bubble = new CleaningBubble();
- bubble.x = pet.x + (Math.random() - 0.5) * 200;
- bubble.y = pet.y + 200;
- bubbles.push(bubble);
- game.addChild(bubble);
+ 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();
}
- if (cleaningTimer <= 0) {
- isCleaningMode = false;
- }
}
- // Update bubbles
- for (var i = bubbles.length - 1; i >= 0; i--) {
- var bubble = bubbles[i];
- if (bubble.shouldDestroy) {
- bubble.destroy();
- bubbles.splice(i, 1);
+ // 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;
}
}
- // Check for game over conditions
- if (pet.hunger <= 0 || pet.happiness <= 0 || pet.cleanliness <= 0) {
- LK.effects.flashScreen(0xFF0000, 1000);
- LK.setTimeout(function () {
- LK.showGameOver();
- }, 1000);
+ if (allClicked && tiles.length > 0) {
+ // Set next target
+ var nextIndex = Math.floor(Math.random() * tiles.length);
+ tiles[nextIndex].setAsTarget();
}
- // Save game state
- if (LK.ticks % 60 === 0) {
- storage.hunger = pet.hunger;
- storage.happiness = pet.happiness;
- storage.cleanliness = pet.cleanliness;
- storage.score = LK.getScore();
+ }
+ 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();
+ }
+ }
}
};
-// Load saved game state
-pet.hunger = storage.hunger || 100;
-pet.happiness = storage.happiness || 100;
-pet.cleanliness = storage.cleanliness || 100;
-LK.setScore(storage.score || 0);
-scoreText.setText(LK.getScore());
-// Initialize game in menu state
-hideGameElements();
-showMenuElements();
-// Play background music
+// Initialize
+hideBackButton();
+showMenu();
LK.playMusic('bgmusic');
;
\ No newline at end of file
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