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: 30,
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 CleaningBubble = Container.expand(function () {
var self = Container.call(this);
var bubbleGraphics = self.attachAsset('bubble', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 2 + Math.random() * 3;
self.life = 60 + Math.random() * 120;
self.maxLife = self.life;
self.update = function () {
self.y -= self.speed;
self.life--;
var alpha = self.life / self.maxLife;
bubbleGraphics.alpha = alpha;
if (self.life <= 0) {
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 self = Container.call(this);
var petGraphics = self.attachAsset('pet', {
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 self = Container.call(this);
var background = self.attachAsset('meterBg', {
anchorX: 0,
anchorY: 0.5
});
var bar = self.attachAsset('meterBar', {
anchorX: 0,
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
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* 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,
fill: 0x333333
});
hungerLabel.anchor.set(0, 0.5);
hungerLabel.x = 50;
hungerLabel.y = 200;
game.addChild(hungerLabel);
var happinessLabel = new Text2('Happy', {
size: 24,
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);
// Action buttons
var feedButton = new ActionButton('Feed', function () {
pet.feed();
});
feedButton.x = 300;
feedButton.y = 2200;
game.addChild(feedButton);
var cleanButton = new ActionButton('Clean', function () {
isCleaningMode = true;
cleaningTimer = 300; // 5 seconds
});
cleanButton.x = 700;
cleanButton.y = 2200;
game.addChild(cleanButton);
var playButton = new ActionButton('Play', function () {
pet.playWith();
});
playButton.x = 1100;
playButton.y = 2200;
game.addChild(playButton);
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;
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 isCleaningMode = false;
var cleaningTimer = 0;
var bubbles = [];
// Pet interaction
pet.down = function (x, y, obj) {
if (!isCleaningMode) {
pet.playWith();
LK.setScore(LK.getScore() + 5);
scoreText.setText(LK.getScore());
}
};
game.update = function () {
// 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);
}
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 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);
}
// Save game state
if (LK.ticks % 60 === 0) {
storage.hunger = pet.hunger;
storage.happiness = pet.happiness;
storage.cleanliness = pet.cleanliness;
storage.score = LK.getScore();
}
};
// 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());
// Play background music
LK.playMusic('bgmusic'); ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,378 @@
-/****
+/****
+* 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: 30,
+ 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 CleaningBubble = Container.expand(function () {
+ var self = Container.call(this);
+ var bubbleGraphics = self.attachAsset('bubble', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 2 + Math.random() * 3;
+ self.life = 60 + Math.random() * 120;
+ self.maxLife = self.life;
+ self.update = function () {
+ self.y -= self.speed;
+ self.life--;
+ var alpha = self.life / self.maxLife;
+ bubbleGraphics.alpha = alpha;
+ if (self.life <= 0) {
+ 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 self = Container.call(this);
+ var petGraphics = self.attachAsset('pet', {
+ 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 self = Container.call(this);
+ var background = self.attachAsset('meterBg', {
+ anchorX: 0,
+ anchorY: 0.5
+ });
+ var bar = self.attachAsset('meterBar', {
+ anchorX: 0,
+ 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
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB
+});
+
+/****
+* 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,
+ fill: 0x333333
+});
+hungerLabel.anchor.set(0, 0.5);
+hungerLabel.x = 50;
+hungerLabel.y = 200;
+game.addChild(hungerLabel);
+var happinessLabel = new Text2('Happy', {
+ size: 24,
+ 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);
+// Action buttons
+var feedButton = new ActionButton('Feed', function () {
+ pet.feed();
+});
+feedButton.x = 300;
+feedButton.y = 2200;
+game.addChild(feedButton);
+var cleanButton = new ActionButton('Clean', function () {
+ isCleaningMode = true;
+ cleaningTimer = 300; // 5 seconds
+});
+cleanButton.x = 700;
+cleanButton.y = 2200;
+game.addChild(cleanButton);
+var playButton = new ActionButton('Play', function () {
+ pet.playWith();
+});
+playButton.x = 1100;
+playButton.y = 2200;
+game.addChild(playButton);
+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;
+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 isCleaningMode = false;
+var cleaningTimer = 0;
+var bubbles = [];
+// Pet interaction
+pet.down = function (x, y, obj) {
+ if (!isCleaningMode) {
+ pet.playWith();
+ LK.setScore(LK.getScore() + 5);
+ scoreText.setText(LK.getScore());
+ }
+};
+game.update = function () {
+ // 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);
+ }
+ 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 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);
+ }
+ // Save game state
+ if (LK.ticks % 60 === 0) {
+ storage.hunger = pet.hunger;
+ storage.happiness = pet.happiness;
+ storage.cleanliness = pet.cleanliness;
+ storage.score = LK.getScore();
+ }
+};
+// 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());
+// Play background music
+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