/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
hunger: 80,
happiness: 70,
cleanliness: 60,
coins: 50,
petAge: 0
});
/****
* Classes
****/
var ActionButton = Container.expand(function (buttonType, label) {
var self = Container.call(this);
var button = self.attachAsset(buttonType, {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2(label, {
size: 40,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function (x, y, obj) {
tween(button, {
scaleX: 0.95,
scaleY: 0.95
}, {
duration: 100
});
tween(button, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100
});
if (buttonType === 'feedButton') {
feedPet();
} else if (buttonType === 'playButton') {
playWithPet();
} else if (buttonType === 'cleanButton') {
cleanPet();
}
};
return self;
});
var Pet = Container.expand(function () {
var self = Container.call(this);
// Pet graphics
var petBody = self.attachAsset('pet', {
anchorX: 0.5,
anchorY: 0.5
});
var leftEye = self.attachAsset('petEye', {
anchorX: 0.5,
anchorY: 0.5,
x: -40,
y: -50
});
var rightEye = self.attachAsset('petEye', {
anchorX: 0.5,
anchorY: 0.5,
x: 40,
y: -50
});
var mouth = self.attachAsset('petMouth', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 20,
scaleY: 0.5
});
// Pet state
self.mood = 'normal'; // normal, happy, sad, hungry, dirty
self.animationTimer = 0;
self.lastInteraction = 0;
// Animation methods
self.playHappyAnimation = function () {
tween(petBody, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 300,
easing: tween.bounceOut
});
tween(petBody, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 300,
easing: tween.bounceOut,
onFinish: function onFinish() {
tween(petBody, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 200
});
tween(petBody, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200
});
}
});
// Eyes animation
tween(leftEye, {
scaleX: 1.5,
scaleY: 0.3
}, {
duration: 200
});
tween(rightEye, {
scaleX: 1.5,
scaleY: 0.3
}, {
duration: 200
});
tween(leftEye, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 300
});
tween(rightEye, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 300
});
self.mood = 'happy';
LK.getSound('happy').play();
};
self.playEatAnimation = function () {
tween(petBody, {
scaleX: 1.1,
scaleY: 0.9
}, {
duration: 200
});
tween(petBody, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 200
});
tween(mouth, {
scaleX: 1.5,
scaleY: 1.0
}, {
duration: 300
});
tween(mouth, {
scaleX: 1.0,
scaleY: 0.5
}, {
duration: 300
});
LK.getSound('eat').play();
};
self.playCleanAnimation = function () {
// Sparkle effect simulation
tween(petBody, {
tint: 0xFFFFFF
}, {
duration: 100
});
tween(petBody, {
tint: 0x8B4513
}, {
duration: 300
});
tween(petBody, {
rotation: 0.1
}, {
duration: 150
});
tween(petBody, {
rotation: -0.1
}, {
duration: 150
});
tween(petBody, {
rotation: 0
}, {
duration: 150
});
LK.getSound('clean').play();
};
self.down = function (x, y, obj) {
self.lastInteraction = LK.ticks;
self.playHappyAnimation();
// Show heart effect
var heart = game.addChild(LK.getAsset('heart', {
anchorX: 0.5,
anchorY: 0.5,
x: self.x + (Math.random() - 0.5) * 100,
y: self.y - 50
}));
tween(heart, {
y: heart.y - 100,
alpha: 0
}, {
duration: 1000,
onFinish: function onFinish() {
heart.destroy();
}
});
// Small happiness boost from petting
happiness = Math.min(100, happiness + 2);
};
self.update = function () {
self.animationTimer++;
// Idle breathing animation
if (self.animationTimer % 120 === 0) {
tween(petBody, {
scaleY: 1.05
}, {
duration: 800,
easing: tween.easeInOut
});
tween(petBody, {
scaleY: 1.0
}, {
duration: 800,
easing: tween.easeInOut
});
}
// Eye blinking
if (self.animationTimer % 180 === 0) {
tween(leftEye, {
scaleY: 0.1
}, {
duration: 100
});
tween(rightEye, {
scaleY: 0.1
}, {
duration: 100
});
tween(leftEye, {
scaleY: 1.0
}, {
duration: 100
});
tween(rightEye, {
scaleY: 1.0
}, {
duration: 100
});
}
// Mood-based color changes
if (hunger < 30) {
petBody.tint = 0xDDA0DD; // Pale when hungry
} else if (happiness > 80) {
petBody.tint = 0xFFB6C1; // Pink when happy
} else if (cleanliness < 30) {
petBody.tint = 0x696969; // Gray when dirty
} else {
petBody.tint = 0x8B4513; // Normal brown
}
};
return self;
});
var StatusBar = Container.expand(function (type, maxWidth) {
var self = Container.call(this);
var background = self.attachAsset('barBg', {
anchorX: 0,
anchorY: 0
});
var barColor;
if (type === 'hunger') barColor = 'hungerBar';else if (type === 'happiness') barColor = 'happinessBar';else barColor = 'cleanlinessBar';
var bar = self.attachAsset(barColor, {
anchorX: 0,
anchorY: 0
});
self.updateBar = function (value) {
var percentage = Math.max(0, Math.min(100, value)) / 100;
bar.width = maxWidth * percentage;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game state
var hunger = storage.hunger;
var happiness = storage.happiness;
var cleanliness = storage.cleanliness;
var coins = storage.coins;
var petAge = storage.petAge;
// Game objects
var pet;
var hungerBar, happinessBar, cleanlinessBar;
var feedButton, playButton, cleanButton;
var hungerText, happinessText, cleanlinessText, coinsText;
// Initialize pet
pet = game.addChild(new Pet());
pet.x = 1024;
pet.y = 1200;
// Create status bars
hungerBar = game.addChild(new StatusBar('hunger', 300));
hungerBar.x = 200;
hungerBar.y = 400;
happinessBar = game.addChild(new StatusBar('happiness', 300));
happinessBar.x = 200;
happinessBar.y = 450;
cleanlinessBar = game.addChild(new StatusBar('cleanliness', 300));
cleanlinessBar.x = 200;
cleanlinessBar.y = 500;
// Status labels
hungerText = new Text2('Hunger', {
size: 40,
fill: 0x000000
});
hungerText.anchor.set(0, 0.5);
hungerText.x = 50;
hungerText.y = 410;
game.addChild(hungerText);
happinessText = new Text2('Happiness', {
size: 40,
fill: 0x000000
});
happinessText.anchor.set(0, 0.5);
happinessText.x = 50;
happinessText.y = 460;
game.addChild(happinessText);
cleanlinessText = new Text2('Cleanliness', {
size: 40,
fill: 0x000000
});
cleanlinessText.anchor.set(0, 0.5);
cleanlinessText.x = 50;
cleanlinessText.y = 510;
game.addChild(cleanlinessText);
// Coins display
coinsText = new Text2('Coins: ' + coins, {
size: 50,
fill: 0xFFD700
});
coinsText.anchor.set(1, 0);
coinsText.x = 1998;
coinsText.y = 50;
game.addChild(coinsText);
// Action buttons
feedButton = game.addChild(new ActionButton('feedButton', 'FEED'));
feedButton.x = 400;
feedButton.y = 2200;
playButton = game.addChild(new ActionButton('playButton', 'PLAY'));
playButton.x = 1024;
playButton.y = 2200;
cleanButton = game.addChild(new ActionButton('cleanButton', 'CLEAN'));
cleanButton.x = 1648;
playButton.y = 2200;
// Game functions
function feedPet() {
if (coins >= 5) {
hunger = Math.min(100, hunger + 25);
happiness = Math.min(100, happiness + 5);
coins -= 5;
pet.playEatAnimation();
// Show food animation
var food = game.addChild(LK.getAsset('food', {
anchorX: 0.5,
anchorY: 0.5,
x: pet.x,
y: pet.y + 150
}));
tween(food, {
y: pet.y,
scaleX: 0.5,
scaleY: 0.5,
alpha: 0
}, {
duration: 800,
onFinish: function onFinish() {
food.destroy();
}
});
updateDisplay();
}
}
function playWithPet() {
if (coins >= 3) {
happiness = Math.min(100, happiness + 20);
cleanliness = Math.max(0, cleanliness - 5);
coins -= 3;
pet.playHappyAnimation();
// Simple mini-game effect
for (var i = 0; i < 5; i++) {
var heart = game.addChild(LK.getAsset('heart', {
anchorX: 0.5,
anchorY: 0.5,
x: pet.x + (Math.random() - 0.5) * 200,
y: pet.y + (Math.random() - 0.5) * 200
}));
tween(heart, {
scaleX: 0,
scaleY: 0,
alpha: 0
}, {
duration: 1000 + i * 200,
easing: tween.easeOut,
onFinish: function onFinish() {
heart.destroy();
}
});
}
LK.getSound('play').play();
updateDisplay();
}
}
function cleanPet() {
if (coins >= 4) {
cleanliness = Math.min(100, cleanliness + 30);
happiness = Math.min(100, happiness + 5);
coins -= 4;
pet.playCleanAnimation();
updateDisplay();
}
}
function updateDisplay() {
hungerBar.updateBar(hunger);
happinessBar.updateBar(happiness);
cleanlinessBar.updateBar(cleanliness);
coinsText.setText('Coins: ' + coins);
// Save to storage
storage.hunger = hunger;
storage.happiness = happiness;
storage.cleanliness = cleanliness;
storage.coins = coins;
storage.petAge = petAge;
}
// Initialize display
updateDisplay();
// Game loop
var lastUpdate = 0;
game.update = function () {
// Decrease stats over time (every 5 seconds)
if (LK.ticks % 300 === 0) {
hunger = Math.max(0, hunger - 2);
happiness = Math.max(0, happiness - 1);
cleanliness = Math.max(0, cleanliness - 1);
// Earn passive coins
coins += 1;
updateDisplay();
}
// Age pet slowly
if (LK.ticks % 3600 === 0) {
// Every minute
petAge++;
if (petAge % 10 === 0) {
// Pet grows slightly
tween(pet, {
scaleX: pet.scaleX + 0.1,
scaleY: pet.scaleY + 0.1
}, {
duration: 1000
});
}
}
// Check for critical states
if (hunger <= 0 || happiness <= 0 || cleanliness <= 0) {
// Pet becomes sad - visual feedback only
if (LK.ticks % 60 === 0) {
LK.effects.flashObject(pet, 0xFF0000, 500);
}
}
// Bonus coins for good care
if (hunger > 80 && happiness > 80 && cleanliness > 80 && LK.ticks % 1800 === 0) {
coins += 5;
updateDisplay();
// Show bonus effect
var bonusText = new Text2('+5 Coins!', {
size: 60,
fill: 0xFFD700
});
bonusText.anchor.set(0.5, 0.5);
bonusText.x = 1024;
bonusText.y = 800;
game.addChild(bonusText);
tween(bonusText, {
y: bonusText.y - 100,
alpha: 0
}, {
duration: 2000,
onFinish: function onFinish() {
bonusText.destroy();
}
});
}
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,505 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1", {
+ hunger: 80,
+ happiness: 70,
+ cleanliness: 60,
+ coins: 50,
+ petAge: 0
+});
+
+/****
+* Classes
+****/
+var ActionButton = Container.expand(function (buttonType, label) {
+ var self = Container.call(this);
+ var button = self.attachAsset(buttonType, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var buttonText = new Text2(label, {
+ size: 40,
+ fill: 0xFFFFFF
+ });
+ buttonText.anchor.set(0.5, 0.5);
+ self.addChild(buttonText);
+ self.down = function (x, y, obj) {
+ tween(button, {
+ scaleX: 0.95,
+ scaleY: 0.95
+ }, {
+ duration: 100
+ });
+ tween(button, {
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 100
+ });
+ if (buttonType === 'feedButton') {
+ feedPet();
+ } else if (buttonType === 'playButton') {
+ playWithPet();
+ } else if (buttonType === 'cleanButton') {
+ cleanPet();
+ }
+ };
+ return self;
+});
+var Pet = Container.expand(function () {
+ var self = Container.call(this);
+ // Pet graphics
+ var petBody = self.attachAsset('pet', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var leftEye = self.attachAsset('petEye', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -40,
+ y: -50
+ });
+ var rightEye = self.attachAsset('petEye', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 40,
+ y: -50
+ });
+ var mouth = self.attachAsset('petMouth', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: 20,
+ scaleY: 0.5
+ });
+ // Pet state
+ self.mood = 'normal'; // normal, happy, sad, hungry, dirty
+ self.animationTimer = 0;
+ self.lastInteraction = 0;
+ // Animation methods
+ self.playHappyAnimation = function () {
+ tween(petBody, {
+ scaleX: 1.2,
+ scaleY: 1.2
+ }, {
+ duration: 300,
+ easing: tween.bounceOut
+ });
+ tween(petBody, {
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 300,
+ easing: tween.bounceOut,
+ onFinish: function onFinish() {
+ tween(petBody, {
+ scaleX: 1.1,
+ scaleY: 1.1
+ }, {
+ duration: 200
+ });
+ tween(petBody, {
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 200
+ });
+ }
+ });
+ // Eyes animation
+ tween(leftEye, {
+ scaleX: 1.5,
+ scaleY: 0.3
+ }, {
+ duration: 200
+ });
+ tween(rightEye, {
+ scaleX: 1.5,
+ scaleY: 0.3
+ }, {
+ duration: 200
+ });
+ tween(leftEye, {
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 300
+ });
+ tween(rightEye, {
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 300
+ });
+ self.mood = 'happy';
+ LK.getSound('happy').play();
+ };
+ self.playEatAnimation = function () {
+ tween(petBody, {
+ scaleX: 1.1,
+ scaleY: 0.9
+ }, {
+ duration: 200
+ });
+ tween(petBody, {
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 200
+ });
+ tween(mouth, {
+ scaleX: 1.5,
+ scaleY: 1.0
+ }, {
+ duration: 300
+ });
+ tween(mouth, {
+ scaleX: 1.0,
+ scaleY: 0.5
+ }, {
+ duration: 300
+ });
+ LK.getSound('eat').play();
+ };
+ self.playCleanAnimation = function () {
+ // Sparkle effect simulation
+ tween(petBody, {
+ tint: 0xFFFFFF
+ }, {
+ duration: 100
+ });
+ tween(petBody, {
+ tint: 0x8B4513
+ }, {
+ duration: 300
+ });
+ tween(petBody, {
+ rotation: 0.1
+ }, {
+ duration: 150
+ });
+ tween(petBody, {
+ rotation: -0.1
+ }, {
+ duration: 150
+ });
+ tween(petBody, {
+ rotation: 0
+ }, {
+ duration: 150
+ });
+ LK.getSound('clean').play();
+ };
+ self.down = function (x, y, obj) {
+ self.lastInteraction = LK.ticks;
+ self.playHappyAnimation();
+ // Show heart effect
+ var heart = game.addChild(LK.getAsset('heart', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: self.x + (Math.random() - 0.5) * 100,
+ y: self.y - 50
+ }));
+ tween(heart, {
+ y: heart.y - 100,
+ alpha: 0
+ }, {
+ duration: 1000,
+ onFinish: function onFinish() {
+ heart.destroy();
+ }
+ });
+ // Small happiness boost from petting
+ happiness = Math.min(100, happiness + 2);
+ };
+ self.update = function () {
+ self.animationTimer++;
+ // Idle breathing animation
+ if (self.animationTimer % 120 === 0) {
+ tween(petBody, {
+ scaleY: 1.05
+ }, {
+ duration: 800,
+ easing: tween.easeInOut
+ });
+ tween(petBody, {
+ scaleY: 1.0
+ }, {
+ duration: 800,
+ easing: tween.easeInOut
+ });
+ }
+ // Eye blinking
+ if (self.animationTimer % 180 === 0) {
+ tween(leftEye, {
+ scaleY: 0.1
+ }, {
+ duration: 100
+ });
+ tween(rightEye, {
+ scaleY: 0.1
+ }, {
+ duration: 100
+ });
+ tween(leftEye, {
+ scaleY: 1.0
+ }, {
+ duration: 100
+ });
+ tween(rightEye, {
+ scaleY: 1.0
+ }, {
+ duration: 100
+ });
+ }
+ // Mood-based color changes
+ if (hunger < 30) {
+ petBody.tint = 0xDDA0DD; // Pale when hungry
+ } else if (happiness > 80) {
+ petBody.tint = 0xFFB6C1; // Pink when happy
+ } else if (cleanliness < 30) {
+ petBody.tint = 0x696969; // Gray when dirty
+ } else {
+ petBody.tint = 0x8B4513; // Normal brown
+ }
+ };
+ return self;
+});
+var StatusBar = Container.expand(function (type, maxWidth) {
+ var self = Container.call(this);
+ var background = self.attachAsset('barBg', {
+ anchorX: 0,
+ anchorY: 0
+ });
+ var barColor;
+ if (type === 'hunger') barColor = 'hungerBar';else if (type === 'happiness') barColor = 'happinessBar';else barColor = 'cleanlinessBar';
+ var bar = self.attachAsset(barColor, {
+ anchorX: 0,
+ anchorY: 0
+ });
+ self.updateBar = function (value) {
+ var percentage = Math.max(0, Math.min(100, value)) / 100;
+ bar.width = maxWidth * percentage;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB
+});
+
+/****
+* Game Code
+****/
+// Game state
+var hunger = storage.hunger;
+var happiness = storage.happiness;
+var cleanliness = storage.cleanliness;
+var coins = storage.coins;
+var petAge = storage.petAge;
+// Game objects
+var pet;
+var hungerBar, happinessBar, cleanlinessBar;
+var feedButton, playButton, cleanButton;
+var hungerText, happinessText, cleanlinessText, coinsText;
+// Initialize pet
+pet = game.addChild(new Pet());
+pet.x = 1024;
+pet.y = 1200;
+// Create status bars
+hungerBar = game.addChild(new StatusBar('hunger', 300));
+hungerBar.x = 200;
+hungerBar.y = 400;
+happinessBar = game.addChild(new StatusBar('happiness', 300));
+happinessBar.x = 200;
+happinessBar.y = 450;
+cleanlinessBar = game.addChild(new StatusBar('cleanliness', 300));
+cleanlinessBar.x = 200;
+cleanlinessBar.y = 500;
+// Status labels
+hungerText = new Text2('Hunger', {
+ size: 40,
+ fill: 0x000000
+});
+hungerText.anchor.set(0, 0.5);
+hungerText.x = 50;
+hungerText.y = 410;
+game.addChild(hungerText);
+happinessText = new Text2('Happiness', {
+ size: 40,
+ fill: 0x000000
+});
+happinessText.anchor.set(0, 0.5);
+happinessText.x = 50;
+happinessText.y = 460;
+game.addChild(happinessText);
+cleanlinessText = new Text2('Cleanliness', {
+ size: 40,
+ fill: 0x000000
+});
+cleanlinessText.anchor.set(0, 0.5);
+cleanlinessText.x = 50;
+cleanlinessText.y = 510;
+game.addChild(cleanlinessText);
+// Coins display
+coinsText = new Text2('Coins: ' + coins, {
+ size: 50,
+ fill: 0xFFD700
+});
+coinsText.anchor.set(1, 0);
+coinsText.x = 1998;
+coinsText.y = 50;
+game.addChild(coinsText);
+// Action buttons
+feedButton = game.addChild(new ActionButton('feedButton', 'FEED'));
+feedButton.x = 400;
+feedButton.y = 2200;
+playButton = game.addChild(new ActionButton('playButton', 'PLAY'));
+playButton.x = 1024;
+playButton.y = 2200;
+cleanButton = game.addChild(new ActionButton('cleanButton', 'CLEAN'));
+cleanButton.x = 1648;
+playButton.y = 2200;
+// Game functions
+function feedPet() {
+ if (coins >= 5) {
+ hunger = Math.min(100, hunger + 25);
+ happiness = Math.min(100, happiness + 5);
+ coins -= 5;
+ pet.playEatAnimation();
+ // Show food animation
+ var food = game.addChild(LK.getAsset('food', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: pet.x,
+ y: pet.y + 150
+ }));
+ tween(food, {
+ y: pet.y,
+ scaleX: 0.5,
+ scaleY: 0.5,
+ alpha: 0
+ }, {
+ duration: 800,
+ onFinish: function onFinish() {
+ food.destroy();
+ }
+ });
+ updateDisplay();
+ }
+}
+function playWithPet() {
+ if (coins >= 3) {
+ happiness = Math.min(100, happiness + 20);
+ cleanliness = Math.max(0, cleanliness - 5);
+ coins -= 3;
+ pet.playHappyAnimation();
+ // Simple mini-game effect
+ for (var i = 0; i < 5; i++) {
+ var heart = game.addChild(LK.getAsset('heart', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: pet.x + (Math.random() - 0.5) * 200,
+ y: pet.y + (Math.random() - 0.5) * 200
+ }));
+ tween(heart, {
+ scaleX: 0,
+ scaleY: 0,
+ alpha: 0
+ }, {
+ duration: 1000 + i * 200,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ heart.destroy();
+ }
+ });
+ }
+ LK.getSound('play').play();
+ updateDisplay();
+ }
+}
+function cleanPet() {
+ if (coins >= 4) {
+ cleanliness = Math.min(100, cleanliness + 30);
+ happiness = Math.min(100, happiness + 5);
+ coins -= 4;
+ pet.playCleanAnimation();
+ updateDisplay();
+ }
+}
+function updateDisplay() {
+ hungerBar.updateBar(hunger);
+ happinessBar.updateBar(happiness);
+ cleanlinessBar.updateBar(cleanliness);
+ coinsText.setText('Coins: ' + coins);
+ // Save to storage
+ storage.hunger = hunger;
+ storage.happiness = happiness;
+ storage.cleanliness = cleanliness;
+ storage.coins = coins;
+ storage.petAge = petAge;
+}
+// Initialize display
+updateDisplay();
+// Game loop
+var lastUpdate = 0;
+game.update = function () {
+ // Decrease stats over time (every 5 seconds)
+ if (LK.ticks % 300 === 0) {
+ hunger = Math.max(0, hunger - 2);
+ happiness = Math.max(0, happiness - 1);
+ cleanliness = Math.max(0, cleanliness - 1);
+ // Earn passive coins
+ coins += 1;
+ updateDisplay();
+ }
+ // Age pet slowly
+ if (LK.ticks % 3600 === 0) {
+ // Every minute
+ petAge++;
+ if (petAge % 10 === 0) {
+ // Pet grows slightly
+ tween(pet, {
+ scaleX: pet.scaleX + 0.1,
+ scaleY: pet.scaleY + 0.1
+ }, {
+ duration: 1000
+ });
+ }
+ }
+ // Check for critical states
+ if (hunger <= 0 || happiness <= 0 || cleanliness <= 0) {
+ // Pet becomes sad - visual feedback only
+ if (LK.ticks % 60 === 0) {
+ LK.effects.flashObject(pet, 0xFF0000, 500);
+ }
+ }
+ // Bonus coins for good care
+ if (hunger > 80 && happiness > 80 && cleanliness > 80 && LK.ticks % 1800 === 0) {
+ coins += 5;
+ updateDisplay();
+ // Show bonus effect
+ var bonusText = new Text2('+5 Coins!', {
+ size: 60,
+ fill: 0xFFD700
+ });
+ bonusText.anchor.set(0.5, 0.5);
+ bonusText.x = 1024;
+ bonusText.y = 800;
+ game.addChild(bonusText);
+ tween(bonusText, {
+ y: bonusText.y - 100,
+ alpha: 0
+ }, {
+ duration: 2000,
+ onFinish: function onFinish() {
+ bonusText.destroy();
+ }
+ });
+ }
+};
\ No newline at end of file