User prompt
make less targets spawn in arcade
User prompt
in the arcade game make it have 3 lives and make it a little easier
User prompt
make the arcade game bigger and give it a countdown
User prompt
make an option for playing where you could either drag a ball on the cat or play an arcade game. do whatever you want with the arcade game
User prompt
make it so you have to drag the food to his mouth to feed him
User prompt
make the playing bring down hjunger
User prompt
make the vaccum bring down his happines
User prompt
make it so the bars dont have to be low enogh to interact, but there is a cooldown on the buttons that turns them grey when on cooldown ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'ReferenceError: mouth is not defined' in or related to this line: 'tween(mouth, {' Line Number: 402
User prompt
make feeding him bring his clenseliness down
User prompt
I still cant drag it :(
User prompt
bring the vaccum up above the button and make it bigger by 2x
User prompt
I cant drag it
User prompt
make it so when you click clean you have to drag a vaccum onto the cat to clean it, but it makes the happiness bar go down by 2.5x ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
turn the text that says "Feed, play with, and clean your pet to keep it happy..." in to DIE DIE DIE DIE DIE DIE DIE DIE DIE DIE DIE DIE and turn the text at the top that says "Digital Pet freind" to say "DIGITAL PET NIGHTMARE" when the bars get too low
User prompt
Not evolution text I meant the text that says "Feed, play with, and clean your pet to keep it happy..." in to DIE DIE DIE DIE DIE DIE DIE DIE DIE DIE DIE DIE and turn the text at the top that says "Digital Pet freind" to say "DIGITAL PET NIGHTMARE"
User prompt
make it so when the bar gets too low the Digital Pet freind turns to DIGITAL PET NIGHTMARE make the text under that turn into DIE DIE DIE DIE DIE DIE DIE DIE DIE DIE DIE DIE
User prompt
Please fix the bug: 'Timeout.tick error: leftEye is not defined' in or related to this line: 'tween(leftEye, {' Line Number: 338
User prompt
make the eyes turn red when the bar gets too low and add an abandon button which makes corruption go all the way up and makes the game get insanly sacary. do whatever you want with that
User prompt
Please fix the bug: 'ReferenceError: corruptionTextGlitching is not defined' in or related to this line: 'if (pet.corruption >= 40 && pet.corruption <= 60) {' Line Number: 846
User prompt
make it so the lower the bars go the darker and less vibrant the game gets and make it so half way down the evolution text is glitching back and fourth to corruption text ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
I cant see the evolution text
User prompt
make it less obvious that its a horror game
User prompt
make bars go down faster
User prompt
y=0
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Button = Container.expand(function (type) { var self = Container.call(this); self.type = type; var buttonShape = self.attachAsset(type + 'Button', { anchorX: 0.5, anchorY: 0.5 }); var icon = self.attachAsset('buttonIcon', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8 }); var label = new Text2(type.charAt(0).toUpperCase() + type.slice(1), { size: 40, fill: 0xFFFFFF }); label.anchor.set(0.5, 0.5); label.y = 70; self.addChild(label); self.interactive = true; self.down = function (x, y, obj) { tween(buttonShape, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut }); }; self.up = function (x, y, obj) { tween(buttonShape, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); LK.getSound(self.type).play(); switch (self.type) { case 'feed': pet.feed(); break; case 'play': pet.play(); break; case 'clean': pet.clean(); break; } }; return self; }); var CorruptionParticle = Container.expand(function () { var self = Container.call(this); var particleGraphics = self.attachAsset('corruptionEffect', { anchorX: 0.5, anchorY: 0.5, alpha: 0.6 }); self.lifespan = 0; self.maxLife = 0; self.speedX = 0; self.speedY = 0; self.active = false; self.initialize = function (x, y, duration) { self.x = x; self.y = y; self.maxLife = duration; self.lifespan = duration; self.speedX = (Math.random() - 0.5) * 3; self.speedY = (Math.random() - 0.5) * 3; self.rotation = Math.random() * Math.PI * 2; self.active = true; self.visible = true; self.alpha = 0.6; var randomColor = Math.random(); if (randomColor < 0.33) { particleGraphics.tint = 0x550055; // Purple } else if (randomColor < 0.66) { particleGraphics.tint = 0x990000; // Dark red } else { particleGraphics.tint = 0x006600; // Dark green } }; self.update = function () { if (!self.active) { return; } self.lifespan--; self.x += self.speedX; self.y += self.speedY; self.alpha = self.lifespan / self.maxLife * 0.6; if (self.lifespan <= 0) { self.active = false; self.visible = false; } }; self.visible = false; self.active = false; return self; }); var GlitchEffect = Container.expand(function () { var self = Container.call(this); var glitchGraphics = self.attachAsset('glitchEffect', { anchorX: 0.5, anchorY: 0.5, alpha: 0.7 }); self.startGlitch = function () { self.visible = true; self.x = Math.random() * 2048; self.y = Math.random() * 2732; self.rotation = Math.random() * Math.PI * 2; self.alpha = 0.7; tween(self, { alpha: 0 }, { duration: 300 + Math.random() * 700, onFinish: function onFinish() { self.visible = false; } }); }; self.visible = false; return self; }); var Pet = Container.expand(function () { var self = Container.call(this); // Stats self.hunger = 100; self.happiness = 100; self.cleanliness = 100; self.corruption = 0; self.stage = 0; // 0 = normal, 1 = starting to corrupt, 2 = more corrupt, 3 = nightmare // Visual components var body = self.attachAsset('petBody', { anchorX: 0.5, anchorY: 0.5, scaleX: 1, scaleY: 1 }); var leftEye = self.attachAsset('petEye', { anchorX: 0.5, anchorY: 0.5, x: -70, y: -50 }); var rightEye = self.attachAsset('petEye', { anchorX: 0.5, anchorY: 0.5, x: 70, y: -50 }); var mouth = self.attachAsset('petMouth', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0 }); // Food item that appears when feeding var foodItem = self.attachAsset('food', { anchorX: 0.5, anchorY: 0.5, visible: false, x: 0, y: -200 }); // Toy that appears when playing var toyItem = self.attachAsset('toy', { anchorX: 0.5, anchorY: 0.5, visible: false, x: 200, y: 0 }); // Dirt patches that appear when pet is dirty var dirtPatches = []; for (var i = 0; i < 5; i++) { var dirt = self.attachAsset('dirt', { anchorX: 0.5, anchorY: 0.5, visible: false, x: (Math.random() - 0.5) * 200, y: (Math.random() - 0.5) * 200 }); dirtPatches.push(dirt); } self.blink = function () { tween(leftEye, { scaleY: 0.1 }, { duration: 100, onFinish: function onFinish() { tween(leftEye, { scaleY: 1 }, { duration: 100 }); } }); tween(rightEye, { scaleY: 0.1 }, { duration: 100, onFinish: function onFinish() { tween(rightEye, { scaleY: 1 }, { duration: 100 }); } }); }; self.breathe = function () { tween(body, { scaleY: 1.05 }, { duration: 1000, onFinish: function onFinish() { tween(body, { scaleY: 1 }, { duration: 1000 }); } }); }; self.feed = function () { if (self.hunger >= 95) { return; } foodItem.visible = true; foodItem.y = -200; tween(foodItem, { y: 0 }, { duration: 500, onFinish: function onFinish() { self.hunger = Math.min(100, self.hunger + 30); updateStatusBars(); tween(foodItem, { alpha: 0 }, { duration: 300, onFinish: function onFinish() { foodItem.visible = false; foodItem.alpha = 1; } }); // Make pet happy from feeding tween(mouth, { scaleX: 1.3, scaleY: 1.3 }, { duration: 300, onFinish: function onFinish() { tween(mouth, { scaleX: 1, scaleY: 1 }, { duration: 300 }); } }); } }); // Sometimes add corruption from feeding in later stages if (self.corruption > 40 && Math.random() < 0.3) { self.addCorruption(5); triggerGlitch(); } }; self.play = function () { if (self.happiness >= 95) { return; } toyItem.visible = true; toyItem.x = 200; tween(toyItem, { x: 0 }, { duration: 500, onFinish: function onFinish() { self.happiness = Math.min(100, self.happiness + 30); updateStatusBars(); // Bounce toy tween(toyItem, { y: -100 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { tween(toyItem, { y: 0, alpha: 0 }, { duration: 300, easing: tween.easeIn, onFinish: function onFinish() { toyItem.visible = false; toyItem.alpha = 1; } }); } }); // Make pet happy from playing tween(body, { rotation: 0.1 }, { duration: 200, onFinish: function onFinish() { tween(body, { rotation: -0.1 }, { duration: 200, onFinish: function onFinish() { tween(body, { rotation: 0 }, { duration: 200 }); } }); } }); } }); // Sometimes add corruption from playing in later stages if (self.corruption > 40 && Math.random() < 0.3) { self.addCorruption(5); triggerGlitch(); } }; self.clean = function () { if (self.cleanliness >= 95) { return; } self.cleanliness = Math.min(100, self.cleanliness + 30); updateStatusBars(); // Hide dirt patches for (var i = 0; i < dirtPatches.length; i++) { dirtPatches[i].visible = false; } // Sparkle effect tween(body, { alpha: 0.7 }, { duration: 200, onFinish: function onFinish() { tween(body, { alpha: 1 }, { duration: 200 }); } }); // Sometimes add corruption from cleaning in later stages if (self.corruption > 40 && Math.random() < 0.3) { self.addCorruption(5); triggerGlitch(); } }; self.updateStats = function () { // Decrease stats over time self.hunger = Math.max(0, self.hunger - 0.1); self.happiness = Math.max(0, self.happiness - 0.15); self.cleanliness = Math.max(0, self.cleanliness - 0.12); // Show dirt when dirty for (var i = 0; i < dirtPatches.length; i++) { dirtPatches[i].visible = self.cleanliness < 50 + i * 10; } // Corruption increases when needs are low if (self.hunger < 30 || self.happiness < 30 || self.cleanliness < 30) { self.addCorruption(0.05); if (Math.random() < 0.1) { triggerGlitch(); } } // Update visual based on corruption level self.updateAppearance(); }; self.addCorruption = function (amount) { var oldCorruption = self.corruption; self.corruption = Math.min(100, self.corruption + amount); if (oldCorruption < 33 && self.corruption >= 33) { self.evolve(1); } else if (oldCorruption < 66 && self.corruption >= 66) { self.evolve(2); } else if (oldCorruption < 100 && self.corruption >= 100) { self.evolve(3); } updateStatusBars(); }; self.evolve = function (stage) { self.stage = stage; LK.getSound('transform').play(); // Create a strong glitch effect for evolution for (var i = 0; i < 10; i++) { LK.setTimeout(function () { triggerGlitch(); }, i * 200); } // Show strong visual change tween(body, { scaleX: 1.3, scaleY: 1.3, alpha: 0.5 }, { duration: 500, onFinish: function onFinish() { self.updateAppearance(); tween(body, { scaleX: 1, scaleY: 1, alpha: 1 }, { duration: 500 }); } }); }; self.updateAppearance = function () { // Base form - cute and blue if (self.stage === 0) { body.tint = 0xaae1fc; leftEye.tint = 0x000000; rightEye.tint = 0x000000; mouth.tint = 0x9966cc; leftEye.x = -70; rightEye.x = 70; leftEye.y = rightEye.y = -50; mouth.y = 30; // Reset any distortions leftEye.scaleX = leftEye.scaleY = 1; rightEye.scaleX = rightEye.scaleY = 1; mouth.scaleX = mouth.scaleY = 1; mouth.rotation = 0; } // Stage 1 - starting to corrupt else if (self.stage === 1) { body.tint = 0x99ccdd; leftEye.tint = 0x220000; rightEye.tint = 0x220000; mouth.tint = 0x774499; // Slight asymmetry leftEye.x = -75; rightEye.x = 68; leftEye.scaleX = 1.1; rightEye.scaleX = 0.9; mouth.rotation = 0.1; } // Stage 2 - more corrupt else if (self.stage === 2) { body.tint = 0x7799aa; leftEye.tint = 0x440000; rightEye.tint = 0x440000; mouth.tint = 0x553366; // More distortion leftEye.x = -80; rightEye.x = 65; leftEye.y = -55; rightEye.y = -45; leftEye.scaleX = 1.3; leftEye.scaleY = 0.8; rightEye.scaleX = 0.8; rightEye.scaleY = 1.2; mouth.y = 60; mouth.scaleX = 1.2; mouth.rotation = 0.2; } // Stage 3 - nightmare else if (self.stage === 3) { body.tint = 0x445566; leftEye.tint = 0x880000; rightEye.tint = 0x880000; mouth.tint = 0x331133; // Severe distortion leftEye.x = -90; rightEye.x = 60; leftEye.y = -65; rightEye.y = -35; leftEye.scaleX = 1.6; leftEye.scaleY = 0.6; rightEye.scaleX = 0.6; rightEye.scaleY = 1.6; mouth.y = 70; mouth.scaleX = 1.5; mouth.scaleY = 0.7; mouth.rotation = 0.3; } }; // Idle animations LK.setInterval(function () { self.blink(); }, 3000 + Math.random() * 2000); LK.setInterval(function () { self.breathe(); }, 2000); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222233 }); /**** * Game Code ****/ // Game variables var pet; var feedButton, playButton, cleanButton; var statusBars = {}; var corruptionMeter; var gameTime = 0; var glitchEffects = []; var corruptionParticles = []; var gameStarted = false; // Initialize game elements function initGame() { // Setup background game.setBackgroundColor(0x222233); // Create pet pet = new Pet(); pet.x = 2048 / 2; pet.y = 2732 / 2 - 200; game.addChild(pet); // Create UI controls feedButton = new Button('feed'); feedButton.x = 2048 / 4; feedButton.y = 2732 - 200; game.addChild(feedButton); playButton = new Button('play'); playButton.x = 2048 / 2; playButton.y = 2732 - 200; game.addChild(playButton); cleanButton = new Button('clean'); cleanButton.x = 2048 * 3 / 4; cleanButton.y = 2732 - 200; game.addChild(cleanButton); // Create status bars createStatusBars(); // Create glitch effects for (var i = 0; i < 10; i++) { var glitch = new GlitchEffect(); game.addChild(glitch); glitchEffects.push(glitch); } // Create corruption particles for (var i = 0; i < 50; i++) { var particle = new CorruptionParticle(); game.addChild(particle); corruptionParticles.push(particle); } // Create and add title var titleText = new Text2("Digital Pet Nightmare", { size: 100, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0); titleText.x = 2048 / 2; titleText.y = 100; LK.gui.addChild(titleText); // Create game instructions var instructionsText = new Text2("Feed, play with, and clean your pet to keep it happy. But beware as it slowly corrupts...", { size: 40, fill: 0xDDDDDD }); instructionsText.anchor.set(0.5, 0); instructionsText.x = 2048 / 2; instructionsText.y = 220; instructionsText.width = 1800; LK.gui.addChild(instructionsText); // Start game music LK.playMusic('petMusic', { fade: { start: 0, end: 0.5, duration: 1000 } }); gameStarted = true; } function createStatusBars() { // Create container for all status bars var statusContainer = new Container(); statusContainer.x = 2048 / 2; statusContainer.y = 400; game.addChild(statusContainer); // Create each status bar var statusTypes = [{ name: 'hunger', label: 'Hunger', color: 0x22cc88 }, { name: 'happiness', label: 'Happiness', color: 0xff8822 }, { name: 'cleanliness', label: 'Cleanliness', color: 0x2288ff }]; var yOffset = 0; for (var i = 0; i < statusTypes.length; i++) { var type = statusTypes[i]; // Create label var label = new Text2(type.label, { size: 40, fill: 0xFFFFFF }); label.anchor.set(1, 0.5); label.x = -20; label.y = yOffset; statusContainer.addChild(label); // Create background bar var barBg = LK.getAsset('feedButton', { anchorX: 0, anchorY: 0.5, x: 0, y: yOffset, scaleX: 4, scaleY: 0.5, tint: 0x444444 }); statusContainer.addChild(barBg); // Create value bar var bar = LK.getAsset('feedButton', { anchorX: 0, anchorY: 0.5, x: 0, y: yOffset, scaleX: 4, scaleY: 0.5, tint: type.color }); statusContainer.addChild(bar); // Store reference to bar statusBars[type.name] = bar; yOffset += 60; } // Create corruption meter var corruptionLabel = new Text2("Corruption", { size: 40, fill: 0xFF0088 }); corruptionLabel.anchor.set(1, 0.5); corruptionLabel.x = -20; corruptionLabel.y = yOffset; statusContainer.addChild(corruptionLabel); var corruptionBg = LK.getAsset('feedButton', { anchorX: 0, anchorY: 0.5, x: 0, y: yOffset, scaleX: 4, scaleY: 0.5, tint: 0x444444 }); statusContainer.addChild(corruptionBg); corruptionMeter = LK.getAsset('feedButton', { anchorX: 0, anchorY: 0.5, x: 0, y: yOffset, scaleX: 0, scaleY: 0.5, tint: 0xff0088 }); statusContainer.addChild(corruptionMeter); } function updateStatusBars() { if (!gameStarted) { return; } // Update status bars based on pet stats statusBars.hunger.scaleX = pet.hunger / 25; statusBars.happiness.scaleX = pet.happiness / 25; statusBars.cleanliness.scaleX = pet.cleanliness / 25; // Update corruption meter corruptionMeter.scaleX = pet.corruption / 25; } function triggerGlitch() { // Play glitch sound LK.getSound('glitch').play(); // Visual glitch effects for (var i = 0; i < 3; i++) { var glitch = glitchEffects[Math.floor(Math.random() * glitchEffects.length)]; glitch.startGlitch(); } // Temporarily distort pet if (Math.random() < 0.3) { var originalRotation = pet.rotation; tween(pet, { rotation: originalRotation + (Math.random() - 0.5) * 0.3 }, { duration: 150, onFinish: function onFinish() { tween(pet, { rotation: originalRotation }, { duration: 150 }); } }); } // Screen shake if (Math.random() < 0.2) { var originalX = game.x; var originalY = game.y; tween(game, { x: originalX + (Math.random() - 0.5) * 20 }, { duration: 100, onFinish: function onFinish() { tween(game, { x: originalX }, { duration: 100 }); } }); } } function spawnCorruptionParticle() { // Find an inactive particle for (var i = 0; i < corruptionParticles.length; i++) { var particle = corruptionParticles[i]; if (!particle.active) { // Calculate position relative to pet var offsetX = (Math.random() - 0.5) * 300; var offsetY = (Math.random() - 0.5) * 300; particle.initialize(pet.x + offsetX, pet.y + offsetY, 60 + Math.floor(Math.random() * 60)); break; } } } // Game Update Logic game.update = function () { if (!gameStarted) { initGame(); return; } gameTime++; // Update pet stats if (gameTime % 30 === 0) { pet.updateStats(); updateStatusBars(); } // Spawn corruption particles based on corruption level if (pet.corruption > 30 && gameTime % Math.max(5, 30 - pet.corruption / 5) === 0) { spawnCorruptionParticle(); } // Update all corruption particles for (var i = 0; i < corruptionParticles.length; i++) { corruptionParticles[i].update(); } // Random glitches when heavily corrupted if (pet.corruption > 70 && Math.random() < 0.005) { triggerGlitch(); } // Check for game over condition if (pet.corruption >= 100 && pet.hunger <= 0 && pet.happiness <= 0 && pet.cleanliness <= 0) { // Nightmare complete for (var i = 0; i < 20; i++) { LK.setTimeout(function () { triggerGlitch(); }, i * 100); } LK.setTimeout(function () { LK.showGameOver(); }, 2000); } };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Button = Container.expand(function (type) {
var self = Container.call(this);
self.type = type;
var buttonShape = self.attachAsset(type + 'Button', {
anchorX: 0.5,
anchorY: 0.5
});
var icon = self.attachAsset('buttonIcon', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
});
var label = new Text2(type.charAt(0).toUpperCase() + type.slice(1), {
size: 40,
fill: 0xFFFFFF
});
label.anchor.set(0.5, 0.5);
label.y = 70;
self.addChild(label);
self.interactive = true;
self.down = function (x, y, obj) {
tween(buttonShape, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
easing: tween.easeOut
});
};
self.up = function (x, y, obj) {
tween(buttonShape, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeOut
});
LK.getSound(self.type).play();
switch (self.type) {
case 'feed':
pet.feed();
break;
case 'play':
pet.play();
break;
case 'clean':
pet.clean();
break;
}
};
return self;
});
var CorruptionParticle = Container.expand(function () {
var self = Container.call(this);
var particleGraphics = self.attachAsset('corruptionEffect', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.6
});
self.lifespan = 0;
self.maxLife = 0;
self.speedX = 0;
self.speedY = 0;
self.active = false;
self.initialize = function (x, y, duration) {
self.x = x;
self.y = y;
self.maxLife = duration;
self.lifespan = duration;
self.speedX = (Math.random() - 0.5) * 3;
self.speedY = (Math.random() - 0.5) * 3;
self.rotation = Math.random() * Math.PI * 2;
self.active = true;
self.visible = true;
self.alpha = 0.6;
var randomColor = Math.random();
if (randomColor < 0.33) {
particleGraphics.tint = 0x550055; // Purple
} else if (randomColor < 0.66) {
particleGraphics.tint = 0x990000; // Dark red
} else {
particleGraphics.tint = 0x006600; // Dark green
}
};
self.update = function () {
if (!self.active) {
return;
}
self.lifespan--;
self.x += self.speedX;
self.y += self.speedY;
self.alpha = self.lifespan / self.maxLife * 0.6;
if (self.lifespan <= 0) {
self.active = false;
self.visible = false;
}
};
self.visible = false;
self.active = false;
return self;
});
var GlitchEffect = Container.expand(function () {
var self = Container.call(this);
var glitchGraphics = self.attachAsset('glitchEffect', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.7
});
self.startGlitch = function () {
self.visible = true;
self.x = Math.random() * 2048;
self.y = Math.random() * 2732;
self.rotation = Math.random() * Math.PI * 2;
self.alpha = 0.7;
tween(self, {
alpha: 0
}, {
duration: 300 + Math.random() * 700,
onFinish: function onFinish() {
self.visible = false;
}
});
};
self.visible = false;
return self;
});
var Pet = Container.expand(function () {
var self = Container.call(this);
// Stats
self.hunger = 100;
self.happiness = 100;
self.cleanliness = 100;
self.corruption = 0;
self.stage = 0; // 0 = normal, 1 = starting to corrupt, 2 = more corrupt, 3 = nightmare
// Visual components
var body = self.attachAsset('petBody', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1,
scaleY: 1
});
var leftEye = self.attachAsset('petEye', {
anchorX: 0.5,
anchorY: 0.5,
x: -70,
y: -50
});
var rightEye = self.attachAsset('petEye', {
anchorX: 0.5,
anchorY: 0.5,
x: 70,
y: -50
});
var mouth = self.attachAsset('petMouth', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0
});
// Food item that appears when feeding
var foodItem = self.attachAsset('food', {
anchorX: 0.5,
anchorY: 0.5,
visible: false,
x: 0,
y: -200
});
// Toy that appears when playing
var toyItem = self.attachAsset('toy', {
anchorX: 0.5,
anchorY: 0.5,
visible: false,
x: 200,
y: 0
});
// Dirt patches that appear when pet is dirty
var dirtPatches = [];
for (var i = 0; i < 5; i++) {
var dirt = self.attachAsset('dirt', {
anchorX: 0.5,
anchorY: 0.5,
visible: false,
x: (Math.random() - 0.5) * 200,
y: (Math.random() - 0.5) * 200
});
dirtPatches.push(dirt);
}
self.blink = function () {
tween(leftEye, {
scaleY: 0.1
}, {
duration: 100,
onFinish: function onFinish() {
tween(leftEye, {
scaleY: 1
}, {
duration: 100
});
}
});
tween(rightEye, {
scaleY: 0.1
}, {
duration: 100,
onFinish: function onFinish() {
tween(rightEye, {
scaleY: 1
}, {
duration: 100
});
}
});
};
self.breathe = function () {
tween(body, {
scaleY: 1.05
}, {
duration: 1000,
onFinish: function onFinish() {
tween(body, {
scaleY: 1
}, {
duration: 1000
});
}
});
};
self.feed = function () {
if (self.hunger >= 95) {
return;
}
foodItem.visible = true;
foodItem.y = -200;
tween(foodItem, {
y: 0
}, {
duration: 500,
onFinish: function onFinish() {
self.hunger = Math.min(100, self.hunger + 30);
updateStatusBars();
tween(foodItem, {
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
foodItem.visible = false;
foodItem.alpha = 1;
}
});
// Make pet happy from feeding
tween(mouth, {
scaleX: 1.3,
scaleY: 1.3
}, {
duration: 300,
onFinish: function onFinish() {
tween(mouth, {
scaleX: 1,
scaleY: 1
}, {
duration: 300
});
}
});
}
});
// Sometimes add corruption from feeding in later stages
if (self.corruption > 40 && Math.random() < 0.3) {
self.addCorruption(5);
triggerGlitch();
}
};
self.play = function () {
if (self.happiness >= 95) {
return;
}
toyItem.visible = true;
toyItem.x = 200;
tween(toyItem, {
x: 0
}, {
duration: 500,
onFinish: function onFinish() {
self.happiness = Math.min(100, self.happiness + 30);
updateStatusBars();
// Bounce toy
tween(toyItem, {
y: -100
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(toyItem, {
y: 0,
alpha: 0
}, {
duration: 300,
easing: tween.easeIn,
onFinish: function onFinish() {
toyItem.visible = false;
toyItem.alpha = 1;
}
});
}
});
// Make pet happy from playing
tween(body, {
rotation: 0.1
}, {
duration: 200,
onFinish: function onFinish() {
tween(body, {
rotation: -0.1
}, {
duration: 200,
onFinish: function onFinish() {
tween(body, {
rotation: 0
}, {
duration: 200
});
}
});
}
});
}
});
// Sometimes add corruption from playing in later stages
if (self.corruption > 40 && Math.random() < 0.3) {
self.addCorruption(5);
triggerGlitch();
}
};
self.clean = function () {
if (self.cleanliness >= 95) {
return;
}
self.cleanliness = Math.min(100, self.cleanliness + 30);
updateStatusBars();
// Hide dirt patches
for (var i = 0; i < dirtPatches.length; i++) {
dirtPatches[i].visible = false;
}
// Sparkle effect
tween(body, {
alpha: 0.7
}, {
duration: 200,
onFinish: function onFinish() {
tween(body, {
alpha: 1
}, {
duration: 200
});
}
});
// Sometimes add corruption from cleaning in later stages
if (self.corruption > 40 && Math.random() < 0.3) {
self.addCorruption(5);
triggerGlitch();
}
};
self.updateStats = function () {
// Decrease stats over time
self.hunger = Math.max(0, self.hunger - 0.1);
self.happiness = Math.max(0, self.happiness - 0.15);
self.cleanliness = Math.max(0, self.cleanliness - 0.12);
// Show dirt when dirty
for (var i = 0; i < dirtPatches.length; i++) {
dirtPatches[i].visible = self.cleanliness < 50 + i * 10;
}
// Corruption increases when needs are low
if (self.hunger < 30 || self.happiness < 30 || self.cleanliness < 30) {
self.addCorruption(0.05);
if (Math.random() < 0.1) {
triggerGlitch();
}
}
// Update visual based on corruption level
self.updateAppearance();
};
self.addCorruption = function (amount) {
var oldCorruption = self.corruption;
self.corruption = Math.min(100, self.corruption + amount);
if (oldCorruption < 33 && self.corruption >= 33) {
self.evolve(1);
} else if (oldCorruption < 66 && self.corruption >= 66) {
self.evolve(2);
} else if (oldCorruption < 100 && self.corruption >= 100) {
self.evolve(3);
}
updateStatusBars();
};
self.evolve = function (stage) {
self.stage = stage;
LK.getSound('transform').play();
// Create a strong glitch effect for evolution
for (var i = 0; i < 10; i++) {
LK.setTimeout(function () {
triggerGlitch();
}, i * 200);
}
// Show strong visual change
tween(body, {
scaleX: 1.3,
scaleY: 1.3,
alpha: 0.5
}, {
duration: 500,
onFinish: function onFinish() {
self.updateAppearance();
tween(body, {
scaleX: 1,
scaleY: 1,
alpha: 1
}, {
duration: 500
});
}
});
};
self.updateAppearance = function () {
// Base form - cute and blue
if (self.stage === 0) {
body.tint = 0xaae1fc;
leftEye.tint = 0x000000;
rightEye.tint = 0x000000;
mouth.tint = 0x9966cc;
leftEye.x = -70;
rightEye.x = 70;
leftEye.y = rightEye.y = -50;
mouth.y = 30;
// Reset any distortions
leftEye.scaleX = leftEye.scaleY = 1;
rightEye.scaleX = rightEye.scaleY = 1;
mouth.scaleX = mouth.scaleY = 1;
mouth.rotation = 0;
}
// Stage 1 - starting to corrupt
else if (self.stage === 1) {
body.tint = 0x99ccdd;
leftEye.tint = 0x220000;
rightEye.tint = 0x220000;
mouth.tint = 0x774499;
// Slight asymmetry
leftEye.x = -75;
rightEye.x = 68;
leftEye.scaleX = 1.1;
rightEye.scaleX = 0.9;
mouth.rotation = 0.1;
}
// Stage 2 - more corrupt
else if (self.stage === 2) {
body.tint = 0x7799aa;
leftEye.tint = 0x440000;
rightEye.tint = 0x440000;
mouth.tint = 0x553366;
// More distortion
leftEye.x = -80;
rightEye.x = 65;
leftEye.y = -55;
rightEye.y = -45;
leftEye.scaleX = 1.3;
leftEye.scaleY = 0.8;
rightEye.scaleX = 0.8;
rightEye.scaleY = 1.2;
mouth.y = 60;
mouth.scaleX = 1.2;
mouth.rotation = 0.2;
}
// Stage 3 - nightmare
else if (self.stage === 3) {
body.tint = 0x445566;
leftEye.tint = 0x880000;
rightEye.tint = 0x880000;
mouth.tint = 0x331133;
// Severe distortion
leftEye.x = -90;
rightEye.x = 60;
leftEye.y = -65;
rightEye.y = -35;
leftEye.scaleX = 1.6;
leftEye.scaleY = 0.6;
rightEye.scaleX = 0.6;
rightEye.scaleY = 1.6;
mouth.y = 70;
mouth.scaleX = 1.5;
mouth.scaleY = 0.7;
mouth.rotation = 0.3;
}
};
// Idle animations
LK.setInterval(function () {
self.blink();
}, 3000 + Math.random() * 2000);
LK.setInterval(function () {
self.breathe();
}, 2000);
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x222233
});
/****
* Game Code
****/
// Game variables
var pet;
var feedButton, playButton, cleanButton;
var statusBars = {};
var corruptionMeter;
var gameTime = 0;
var glitchEffects = [];
var corruptionParticles = [];
var gameStarted = false;
// Initialize game elements
function initGame() {
// Setup background
game.setBackgroundColor(0x222233);
// Create pet
pet = new Pet();
pet.x = 2048 / 2;
pet.y = 2732 / 2 - 200;
game.addChild(pet);
// Create UI controls
feedButton = new Button('feed');
feedButton.x = 2048 / 4;
feedButton.y = 2732 - 200;
game.addChild(feedButton);
playButton = new Button('play');
playButton.x = 2048 / 2;
playButton.y = 2732 - 200;
game.addChild(playButton);
cleanButton = new Button('clean');
cleanButton.x = 2048 * 3 / 4;
cleanButton.y = 2732 - 200;
game.addChild(cleanButton);
// Create status bars
createStatusBars();
// Create glitch effects
for (var i = 0; i < 10; i++) {
var glitch = new GlitchEffect();
game.addChild(glitch);
glitchEffects.push(glitch);
}
// Create corruption particles
for (var i = 0; i < 50; i++) {
var particle = new CorruptionParticle();
game.addChild(particle);
corruptionParticles.push(particle);
}
// Create and add title
var titleText = new Text2("Digital Pet Nightmare", {
size: 100,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0);
titleText.x = 2048 / 2;
titleText.y = 100;
LK.gui.addChild(titleText);
// Create game instructions
var instructionsText = new Text2("Feed, play with, and clean your pet to keep it happy. But beware as it slowly corrupts...", {
size: 40,
fill: 0xDDDDDD
});
instructionsText.anchor.set(0.5, 0);
instructionsText.x = 2048 / 2;
instructionsText.y = 220;
instructionsText.width = 1800;
LK.gui.addChild(instructionsText);
// Start game music
LK.playMusic('petMusic', {
fade: {
start: 0,
end: 0.5,
duration: 1000
}
});
gameStarted = true;
}
function createStatusBars() {
// Create container for all status bars
var statusContainer = new Container();
statusContainer.x = 2048 / 2;
statusContainer.y = 400;
game.addChild(statusContainer);
// Create each status bar
var statusTypes = [{
name: 'hunger',
label: 'Hunger',
color: 0x22cc88
}, {
name: 'happiness',
label: 'Happiness',
color: 0xff8822
}, {
name: 'cleanliness',
label: 'Cleanliness',
color: 0x2288ff
}];
var yOffset = 0;
for (var i = 0; i < statusTypes.length; i++) {
var type = statusTypes[i];
// Create label
var label = new Text2(type.label, {
size: 40,
fill: 0xFFFFFF
});
label.anchor.set(1, 0.5);
label.x = -20;
label.y = yOffset;
statusContainer.addChild(label);
// Create background bar
var barBg = LK.getAsset('feedButton', {
anchorX: 0,
anchorY: 0.5,
x: 0,
y: yOffset,
scaleX: 4,
scaleY: 0.5,
tint: 0x444444
});
statusContainer.addChild(barBg);
// Create value bar
var bar = LK.getAsset('feedButton', {
anchorX: 0,
anchorY: 0.5,
x: 0,
y: yOffset,
scaleX: 4,
scaleY: 0.5,
tint: type.color
});
statusContainer.addChild(bar);
// Store reference to bar
statusBars[type.name] = bar;
yOffset += 60;
}
// Create corruption meter
var corruptionLabel = new Text2("Corruption", {
size: 40,
fill: 0xFF0088
});
corruptionLabel.anchor.set(1, 0.5);
corruptionLabel.x = -20;
corruptionLabel.y = yOffset;
statusContainer.addChild(corruptionLabel);
var corruptionBg = LK.getAsset('feedButton', {
anchorX: 0,
anchorY: 0.5,
x: 0,
y: yOffset,
scaleX: 4,
scaleY: 0.5,
tint: 0x444444
});
statusContainer.addChild(corruptionBg);
corruptionMeter = LK.getAsset('feedButton', {
anchorX: 0,
anchorY: 0.5,
x: 0,
y: yOffset,
scaleX: 0,
scaleY: 0.5,
tint: 0xff0088
});
statusContainer.addChild(corruptionMeter);
}
function updateStatusBars() {
if (!gameStarted) {
return;
}
// Update status bars based on pet stats
statusBars.hunger.scaleX = pet.hunger / 25;
statusBars.happiness.scaleX = pet.happiness / 25;
statusBars.cleanliness.scaleX = pet.cleanliness / 25;
// Update corruption meter
corruptionMeter.scaleX = pet.corruption / 25;
}
function triggerGlitch() {
// Play glitch sound
LK.getSound('glitch').play();
// Visual glitch effects
for (var i = 0; i < 3; i++) {
var glitch = glitchEffects[Math.floor(Math.random() * glitchEffects.length)];
glitch.startGlitch();
}
// Temporarily distort pet
if (Math.random() < 0.3) {
var originalRotation = pet.rotation;
tween(pet, {
rotation: originalRotation + (Math.random() - 0.5) * 0.3
}, {
duration: 150,
onFinish: function onFinish() {
tween(pet, {
rotation: originalRotation
}, {
duration: 150
});
}
});
}
// Screen shake
if (Math.random() < 0.2) {
var originalX = game.x;
var originalY = game.y;
tween(game, {
x: originalX + (Math.random() - 0.5) * 20
}, {
duration: 100,
onFinish: function onFinish() {
tween(game, {
x: originalX
}, {
duration: 100
});
}
});
}
}
function spawnCorruptionParticle() {
// Find an inactive particle
for (var i = 0; i < corruptionParticles.length; i++) {
var particle = corruptionParticles[i];
if (!particle.active) {
// Calculate position relative to pet
var offsetX = (Math.random() - 0.5) * 300;
var offsetY = (Math.random() - 0.5) * 300;
particle.initialize(pet.x + offsetX, pet.y + offsetY, 60 + Math.floor(Math.random() * 60));
break;
}
}
}
// Game Update Logic
game.update = function () {
if (!gameStarted) {
initGame();
return;
}
gameTime++;
// Update pet stats
if (gameTime % 30 === 0) {
pet.updateStats();
updateStatusBars();
}
// Spawn corruption particles based on corruption level
if (pet.corruption > 30 && gameTime % Math.max(5, 30 - pet.corruption / 5) === 0) {
spawnCorruptionParticle();
}
// Update all corruption particles
for (var i = 0; i < corruptionParticles.length; i++) {
corruptionParticles[i].update();
}
// Random glitches when heavily corrupted
if (pet.corruption > 70 && Math.random() < 0.005) {
triggerGlitch();
}
// Check for game over condition
if (pet.corruption >= 100 && pet.hunger <= 0 && pet.happiness <= 0 && pet.cleanliness <= 0) {
// Nightmare complete
for (var i = 0; i < 20; i++) {
LK.setTimeout(function () {
triggerGlitch();
}, i * 100);
}
LK.setTimeout(function () {
LK.showGameOver();
}, 2000);
}
};
dirt speck. In-Game asset. 2d. High contrast. No shadows
chicken leg. In-Game asset. 2d. High contrast. No shadows
sitting cat with no eyes and mouth. In-Game asset. 2d. High contrast. No shadows
closed black cat mouth by itself. In-Game asset. 2d. High contrast. No shadows
glitch effect by itself. In-Game asset. 2d. High contrast. No shadows
ball. In-Game asset. 2d. High contrast. No shadows
vaccum. In-Game asset. 2d. High contrast. No shadows
Iphone. In-Game asset. 2d. High contrast. No shadows