User prompt
make wagging tail go slightly faster
User prompt
make dog jump
User prompt
keep tail in the current position and make it jump with the dog
User prompt
move the wagging tail to it's last position
User prompt
attack wagging tail to dog and make the dog jump slowly
User prompt
wag tail a little faster
User prompt
move wagging tail up slightly and to the left
User prompt
Move wagging tail up slightly
User prompt
move wagging tail to the left some more
User prompt
move wagging tail to the left
User prompt
move wagging tail up slightly
User prompt
move wagging tail up a bit
User prompt
Move wagging tail slightly to the left
User prompt
move wagging tail to the left
User prompt
move wagging tail up some more
User prompt
move wagging tail up more
User prompt
move wagging tail up some more
User prompt
move wagging tail up some more
User prompt
move playbutton up slighty
User prompt
Move play button up slightly
User prompt
playbutton should be aligned with the feedbutton
User prompt
play button and feedbutton should be the same size and aligned
User prompt
Happyness bar should go down every 5 minutes by 10%
User prompt
when feedbutton is pressed happinessbar should fill up
User prompt
when feedbutton is pressed health bar should fill up
/****
* Classes
****/
// Clean Bar class
var CleanBar = Container.expand(function () {
var self = Container.call(this);
// Clean Bar visuals
var barGraphics = self.attachAsset('cleanBar', {
anchorX: 0.0,
anchorY: 0.5
});
// Method to update the clean bar
self.update = function (cleanliness) {
self.scaleX = cleanliness / 100;
};
});
// Happiness Bar class
var HappinessBar = Container.expand(function () {
var self = Container.call(this);
// Happiness Bar visuals
var barGraphics = self.attachAsset('happinessBar', {
anchorX: 0.0,
anchorY: 0.5
});
// Method to update the happiness bar
self.update = function (happiness) {
self.scaleX = happiness / 100;
};
});
// Health Bar class
var HealthBar = Container.expand(function () {
var self = Container.call(this);
// Health Bar visuals
var barGraphics = self.attachAsset('healthBar', {
anchorX: 0.0,
anchorY: 0.5
});
// Method to update the health bar
self.update = function (health) {
self.scaleX = health / 100;
};
});
// Assets will be automatically generated based on usage in the code.
// Pet class
var Pet = Container.expand(function () {
var self = Container.call(this);
// Pet visuals
var petGraphics = self.attachAsset('pet', {
anchorX: 0.5,
anchorY: 0.5
});
var tailGraphics = self.attachAsset('tail', {
anchorX: 0.5,
anchorY: 1
});
tailGraphics.x = petGraphics.width / 2;
tailGraphics.y = petGraphics.height / 2 - 100; // Position the tail at the table corner
self.wagging = false;
self.wagTail = function () {
if (LK.ticks % 60 == 0) {
self.wagging = !self.wagging;
if (self.wagging) {
tailGraphics.rotation = 0.3;
} else {
tailGraphics.rotation = -0.3;
}
}
};
// Pet properties
self.happiness = 100; // Max happiness
self.health = 100; // Max health
// Method to feed the pet
self.feed = function () {
self.happiness += 10;
self.health += 5;
// Ensure values do not exceed 100
self.happiness = Math.min(self.happiness, 100);
self.health = Math.min(self.health, 100);
// Update the health bar
healthBar.update(self.health);
};
// Method to play with the pet
self.play = function () {
self.happiness += 15;
// Ensure happiness does not exceed 100
self.happiness = Math.min(self.happiness, 100);
};
// Update pet status
self.update = function () {
// Decrease happiness and health over time
self.happiness -= 0.05;
self.health -= 0.02;
// Ensure values do not drop below 0
self.happiness = Math.max(self.happiness, 0);
self.health = Math.max(self.health, 0);
};
self.bark = function () {
console.log("Bark!");
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Light blue background
});
/****
* Game Code
****/
var livingRoomBackground = game.addChild(LK.getAsset('livingRoom', {
x: 0,
y: 0,
anchorX: 0,
anchorY: 0
}));
// Create pet instance
var pet = game.addChild(new Pet());
// Create happiness bar instance
var happinessBar = game.addChild(new HappinessBar());
// Create clean bar instance
var cleanBar = game.addChild(new CleanBar());
// Create health bar instance
var healthBar = game.addChild(new HealthBar());
// Position the health bar under the happiness bar
healthBar.x = 50;
healthBar.y = 150;
// Position the clean bar under the health bar
cleanBar.x = 50;
cleanBar.y = 200;
happinessBar.x = 50;
happinessBar.y = 50;
// Position the health bar under the happiness bar
// Position the pet in the center of the screen
pet.x = 2048 / 2;
pet.y = 2000;
// Create interactive buttons for feeding and playing
var feedButton = game.addChild(LK.getAsset('feedButton', {
x: 300,
y: 2400,
anchorX: 0.5,
anchorY: 0.5
}));
var playButton = game.addChild(LK.getAsset('playButton', {
x: 1748,
y: 2500,
anchorX: 0.5,
anchorY: 0.5
}));
// Event listener for feed button
feedButton.on('down', function () {
pet.feed();
pet.bark();
});
// Event listener for play button
playButton.on('down', function () {
pet.play();
});
// Update game state every tick
LK.on('tick', function () {
pet.update();
pet.wagTail();
// Update the happiness bar
happinessBar.update(pet.happiness);
// Update the clean bar
cleanBar.update(pet.cleanliness);
});
pixel art living room. Single Game Texture. In-Game asset. 2d. Blank background.
pixel art dog bowl. Single Game Texture. In-Game asset. 2d. Blank background.
pixel art window with dog food bags displayed within it. Single Game Texture. In-Game asset. 2d. Blank background.
pixel art dog bone. Single Game Texture. In-Game asset. 2d. Blank background.
pixel art horizontal thirst bar that looks like a health bar. Single Game Texture. In-Game asset. 2d. Blank background.
pixel art heart speech bubble. Single Game Texture. In-Game asset. 2d. Blank background.
add white backgrund