User prompt
Please fix the bug: 'Can't find variable: storage' in or related to this line: 'if (storage.has('lastDailyReward')) {' Line Number: 155
User prompt
Do some thing f those
User prompt
Make the naN text say 100,000 and you can buy it with said amount
User prompt
It’s still doing it
User prompt
It still says Chris cost naN fix it
User prompt
Make Chris cost 100,000 instead of na
User prompt
Forget everything about only buying stuff once it’s breaking the game
User prompt
I’m at one million Chris is still shaded what’s happening
User prompt
Make it so Chris can still be bought after I buy John vice versa
User prompt
Let me buy chris
User prompt
I can’t buy chis and John can still be bought multiple times fix this
User prompt
Chris spawns under the fart button put John next to that John can only be bought once
User prompt
I meant next to where Chris spawns
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'johnContainer.x = chrisCatContainer.x + 150; // Adjust position as needed' Line Number: 534
User prompt
Where is John in the shop add him in
User prompt
Please fix the bug: 'Can't find variable: johnSpawned' in or related to this line: 'if (johnSpawned && johnContainer && !johnContainer.parent) {' Line Number: 384
User prompt
Make John in the shop he drastically increases points per click use the John asset and put him next to Chris when bought
User prompt
Remove cat emoji face
User prompt
Put Chris right under the fart button
User prompt
Make Chris the Chris asset
User prompt
Put Chris to the left as a square you can find on assets
User prompt
JO Make an upgrade called Chris where it spawns a cat that drastically increases your rate of auto fart and multiply you can only buy Chris once
User prompt
Do it
User prompt
Make an upgrade called Chris where it spawns a cat that drastically increases your rate of auto fart and multiply you can only buy Chris once
User prompt
Add more words
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Dog face class var DogFace = Container.expand(function () { var self = Container.call(this); // Normal face var normalFace = self.attachAsset('dog_normal', { anchorX: 0.5, anchorY: 0.5 }); // React face var reactFace = self.attachAsset('dog_react', { anchorX: 0.5, anchorY: 0.5, alpha: 0 }); // Show normal face self.showNormal = function () { normalFace.alpha = 1; reactFace.alpha = 0; }; // Show react face self.showReact = function () { normalFace.alpha = 0; reactFace.alpha = 1; }; // Flash react face for a short time, then return to normal self.react = function () { self.showReact(); // Return to normal face after 500ms LK.setTimeout(function () { self.showNormal(); // Always teleport dog to center after animation, even if spammed self.x = 2048 / 2; }, 500); }; self.showNormal(); return self; }); // Fart button class var FartButton = Container.expand(function () { var self = Container.call(this); // Button shape var btn = self.attachAsset('fart_btn', { anchorX: 0.5, anchorY: 0.5 }); // "FART" text var fartTxt = new Text2('FART', { size: 120, fill: 0x7A5C00 }); fartTxt.anchor.set(0.5, 0.5); fartTxt.x = 0; fartTxt.y = 0; self.addChild(fartTxt); // Fart cloud effect (hidden by default) var fartCloud = self.attachAsset('centerCircle', { anchorX: 0.5, anchorY: 1, scaleX: 1.2, scaleY: 0.7, x: 0, y: -110, alpha: 0, tint: 0xeeeecc }); fartCloud.width = btn.width * 0.7; fartCloud.height = btn.height * 0.7; // Show fart cloud with animation self.showFartCloud = function () { fartCloud.alpha = 0.85; fartCloud.scaleX = 1.2; fartCloud.scaleY = 0.7; fartCloud.y = -110; tween(fartCloud, { alpha: 0, y: fartCloud.y - 80, scaleX: 1.5, scaleY: 1.1 }, { duration: 420, easing: tween.cubicOut }); }; // Simple press animation self.animatePress = function () { tween(self, { scaleX: 0.92, scaleY: 0.92 }, { duration: 60, easing: tween.cubicIn, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 80, easing: tween.cubicOut }); } }); self.showFartCloud(); }; return self; }); // Person standing and recording class var PersonRecording = Container.expand(function () { var self = Container.call(this); // Single square for the person var personSquare = self.attachAsset('person_leg', { anchorX: 0.5, anchorY: 0.5 }); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xE3F6FF }); /**** * Game Code ****/ // Fart sound // Big fart button // Cartoon dog face (shocked/disgusted) // Cartoon dog face (normal) // Center dog face // Person recording assets var dogFace = new DogFace(); dogFace.x = 2048 / 2; dogFace.y = 1100; dogFace.lastX = dogFace.x; // Track lastX for edge detection game.addChild(dogFace); // Add person standing and recording at the left side var person = new PersonRecording(); person.x = 400; person.y = 1200; game.addChild(person); // --- Dog sliding and teleport logic --- dogFace.slideSpeed = -12; // Negative: slides left game.update = function () { // Save lastX for edge detection dogFace.lastX = dogFace.x; // Only slide dog left if it is not at the center (prevents repeated sliding after rapid clicks) if (Math.abs(dogFace.x - 2048 / 2) > 1) { dogFace.x += dogFace.slideSpeed; // If dog reaches the left edge, teleport to center and react if (dogFace.lastX > 120 && dogFace.x <= 120) { // Teleport to center dogFace.x = 2048 / 2; // Fun: dog reacts dogFace.react(); // Optional: flash screen for drama LK.effects.flashScreen(0xff0000, 300); } } else { // Always keep dog exactly centered if not sliding dogFace.x = 2048 / 2; } }; // Place fart button below dog face var fartBtn = new FartButton(); fartBtn.x = 2048 / 2; fartBtn.y = 2000; game.addChild(fartBtn); // Prevent accidental tap in top left (menu area): nothing is placed there // Instructions text (top center, GUI) var instrTxt = new Text2('Tap the FART button!', { size: 90, fill: 0x2D2D2D }); instrTxt.anchor.set(0.5, 0); LK.gui.top.addChild(instrTxt); // --- Clicker Game State --- var fartCount = 0; var fartPerClick = 1; // Upgrade definitions: [amount, base cost, cost multiplier] var upgrades = [{ amount: 1, base: 10, mult: 1.15, label: "x1" }, { amount: 10, base: 20, mult: 1.18, label: "x10" }, { amount: 50, base: 120, mult: 1.22, label: "x50" }, { amount: 100, base: 600, mult: 1.28, label: "x100" }, { amount: 1000, base: 4000, mult: 1.35, label: "x1000" }]; // Track how many times each upgrade was bought var upgradesBought = [0, 0, 0, 0, 0]; // --- UI Elements --- var fartCountTxt = new Text2('Farts: 0', { size: 150, fill: 0x2D2D2D, fontWeight: 'bold' }); // Anchor to top right (right edge, top) fartCountTxt.anchor.set(1, 0); // Place at top right using LK.gui.topRight, which will always fit the right border regardless of device size fartCountTxt.x = 0; fartCountTxt.y = 40; LK.gui.topRight.addChild(fartCountTxt); var fartPerClickTxt = new Text2('Farts/click: 1', { size: 60, fill: 0x444444 }); fartPerClickTxt.anchor.set(0.5, 0); fartPerClickTxt.x = 2048 / 2; fartPerClickTxt.y = 340; LK.gui.top.addChild(fartPerClickTxt); // --- Upgrades UI --- var upgradeButtons = []; var upgradeTxts = []; var upgradeCostTxts = []; var upgradeYStart = 550; var upgradeSpacing = 120; // Shop toggle state var shopVisible = false; // Start with shop closed // Create upgrade shop toggle button var shopBtn = LK.getAsset('fart_btn', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.45, scaleY: 0.45, // Make square: scaleX and scaleY are equal x: 400, y: upgradeYStart - 120 }); shopBtn.interactive = true; var shopBtnTxt = new Text2('Upgrade Shop', { size: 70, fill: 0x7A5C00 }); shopBtnTxt.anchor.set(0.5, 0.5); shopBtnTxt.x = 0; shopBtnTxt.y = 0; shopBtn.addChild(shopBtnTxt); game.addChild(shopBtn); // Create upgrade buttons (initially hidden) for (var i = 0; i < upgrades.length; ++i) { // Button var btn = LK.getAsset('fart_btn', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.5, scaleY: 0.5, x: 400, y: upgradeYStart + i * upgradeSpacing }); btn.interactive = true; // Label var txt = new Text2('Upgrade ' + upgrades[i].label, { size: 60, fill: 0x7A5C00 }); txt.anchor.set(0.5, 0.5); txt.x = 0; txt.y = -20; btn.addChild(txt); // Cost var costTxt = new Text2('', { size: 44, fill: 0x444444 }); costTxt.anchor.set(0.5, 0.5); costTxt.x = 0; costTxt.y = 50; btn.addChild(costTxt); // Add to game game.addChild(btn); btn.visible = false; // Hide upgrade buttons initially upgradeButtons.push(btn); upgradeTxts.push(txt); upgradeCostTxts.push(costTxt); } // Shop toggle logic shopBtn.down = function (x, y, obj) { shopVisible = !shopVisible; for (var i = 0; i < upgradeButtons.length; ++i) { upgradeButtons[i].visible = shopVisible; } // Feedback: flash the shop button LK.effects.flashObject(shopBtn, 0xfff7b2, 120); }; // --- Helper: Calculate upgrade cost --- function getUpgradeCost(idx) { var u = upgrades[idx]; var n = upgradesBought[idx]; // Exponential cost scaling return Math.floor(u.base * Math.pow(u.mult, n)); } // --- Helper: Update all UI --- function updateUI() { fartCountTxt.setText('Farts: ' + fartCount); fartPerClickTxt.setText('Farts/click: ' + fartPerClick); for (var i = 0; i < upgrades.length; ++i) { var cost = getUpgradeCost(i); upgradeCostTxts[i].setText('Cost: ' + cost); // Gray out if can't afford if (fartCount >= cost) { upgradeButtons[i].alpha = 1; } else { upgradeButtons[i].alpha = 0.5; } } } updateUI(); // --- Upgrade Button Handlers --- for (var i = 0; i < upgrades.length; ++i) { (function (idx) { upgradeButtons[idx].down = function (x, y, obj) { var cost = getUpgradeCost(idx); if (fartCount >= cost) { fartCount -= cost; upgradesBought[idx]++; fartPerClick += upgrades[idx].amount; updateUI(); // Feedback LK.effects.flashObject(upgradeButtons[idx], 0xeeeecc, 120); } }; })(i); } // --- Fart Button Handler (Clicker) --- fartBtn.down = function (x, y, obj) { // Animate button fartBtn.animatePress(); // Button color flash for feedback LK.effects.flashObject(fartBtn, 0xfff7b2, 120); // Play fart sound LK.getSound('fart_snd').play(); // Dog reacts dogFace.react(); // Dog says a random synonym for 'gross' if (!dogFace.speechBubble) { // Create speech bubble if not already present var bubble = new Text2('', { size: 90, fill: 0xffffff, stroke: 0x222222, strokeThickness: 8, wordWrap: true, wordWrapWidth: 600, align: 'center' }); bubble.anchor.set(0.5, 1); bubble.x = 0; bubble.y = -420; bubble.alpha = 0; dogFace.addChild(bubble); dogFace.speechBubble = bubble; } var grossWords = ["Yuck!", "Ew!", "Disgusting!", "Nasty!", "Foul!", "Repulsive!", "Stinky!", "Revolting!", "Pee-yew!", "Ugh!", "Gross!", "Barf!", "Ick!", "Putrid!", "Rank!", "Vile!", "Sickening!", "Odious!", "No way!", "Bleh!", "Cringe!", "Yikes!", "Gag!", "Pungent!", "Awful!", "Horrid!", "Stench!", "What is that?!", "Oh no!", "Why?!", "Ewww!", "Yeesh!", "Blech!", "GROSS!", "Noxious!", "Obnoxious!", "Yowza!", "Oof!", "Gnar!", "Yow!", "Eek!", "Yowch!", "Ooze!", "Funky!", "Rancid!", "Rotten!", "Whew!", "Stank!", "Phew!", "GROSS-out!"]; var word = grossWords[Math.floor(Math.random() * grossWords.length)]; dogFace.speechBubble.setText(word); dogFace.speechBubble.alpha = 1; tween(dogFace.speechBubble, { alpha: 0 }, { duration: 900, delay: 500, easing: tween.cubicIn }); // Dog teleports to center and stops sliding for a moment dogFace.x = 2048 / 2; dogFace.lastX = dogFace.x; // Add farts according to multiplier! fartCount += fartPerClick; updateUI(); }; // Make the button big and easy to tap: handle press anywhere on the button fartBtn.interactive = true; // --- Auto Clicker Upgrades --- // Each auto clicker has: label, base cost, cost multiplier, interval (ms), amount per tick var autoClickers = [{ label: "Auto 1s", base: 100, mult: 1.18, interval: 1000, amount: 1 }, { label: "Auto 0.5s", base: 500, mult: 1.22, interval: 500, amount: 2 }, { label: "Auto 0.2s", base: 2000, mult: 1.28, interval: 200, amount: 5 }]; var autoClickersBought = [0, 0, 0]; var autoClickerTimers = [null, null, null]; // --- UI for Auto Clickers --- var autoClickerButtons = []; var autoClickerTxts = []; var autoClickerCostTxts = []; var autoClickerYStart = upgradeYStart + upgrades.length * upgradeSpacing + 80; var autoClickerSpacing = 120; for (var i = 0; i < autoClickers.length; ++i) { var btn = LK.getAsset('fart_btn', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.5, scaleY: 0.5, x: 400, y: autoClickerYStart + i * autoClickerSpacing }); btn.interactive = true; var txt = new Text2(autoClickers[i].label, { size: 60, fill: 0x7A5C00 }); txt.anchor.set(0.5, 0.5); txt.x = 0; txt.y = -20; btn.addChild(txt); var costTxt = new Text2('', { size: 44, fill: 0x444444 }); costTxt.anchor.set(0.5, 0.5); costTxt.x = 0; costTxt.y = 50; btn.addChild(costTxt); game.addChild(btn); btn.visible = false; autoClickerButtons.push(btn); autoClickerTxts.push(txt); autoClickerCostTxts.push(costTxt); } // --- Helper: Calculate auto clicker cost --- function getAutoClickerCost(idx) { var ac = autoClickers[idx]; var n = autoClickersBought[idx]; return Math.floor(ac.base * Math.pow(ac.mult, n)); } // --- Update UI: add auto clickers --- var _oldUpdateUI = updateUI; updateUI = function updateUI() { _oldUpdateUI(); for (var i = 0; i < autoClickers.length; ++i) { var cost = getAutoClickerCost(i); autoClickerCostTxts[i].setText('Cost: ' + cost + ' | Owned: ' + autoClickersBought[i]); if (fartCount >= cost) { autoClickerButtons[i].alpha = 1; } else { autoClickerButtons[i].alpha = 0.5; } } }; // --- Shop toggle: show/hide auto clickers too --- var _oldShopBtnDown = shopBtn.down; shopBtn.down = function (x, y, obj) { _oldShopBtnDown(x, y, obj); for (var i = 0; i < autoClickerButtons.length; ++i) { autoClickerButtons[i].visible = shopVisible; } }; // --- Auto Clicker Button Handlers --- for (var i = 0; i < autoClickers.length; ++i) { (function (idx) { autoClickerButtons[idx].down = function (x, y, obj) { var cost = getAutoClickerCost(idx); if (fartCount >= cost) { fartCount -= cost; autoClickersBought[idx]++; updateUI(); LK.effects.flashObject(autoClickerButtons[idx], 0xeeeecc, 120); // If this is the first purchase, start the timer if (autoClickersBought[idx] === 1) { autoClickerTimers[idx] = LK.setInterval(function () { // Each auto clicker tick: add (amount * owned * fartPerClick) to fartCount fartCount += autoClickers[idx].amount * autoClickersBought[idx] * fartPerClick; updateUI(); // Fun: dog reacts every time dogFace.react(); // Dog says a random synonym for 'gross' (same as fartBtn.down) if (!dogFace.speechBubble) { // Create speech bubble if not already present var bubble = new Text2('', { size: 90, fill: 0xffffff, stroke: 0x222222, strokeThickness: 8, wordWrap: true, wordWrapWidth: 600, align: 'center' }); bubble.anchor.set(0.5, 1); bubble.x = 0; bubble.y = -420; bubble.alpha = 0; dogFace.addChild(bubble); dogFace.speechBubble = bubble; } var grossWords = ["Yuck!", "Ew!", "Disgusting!", "Nasty!", "Foul!", "Repulsive!", "Stinky!", "Revolting!", "Pee-yew!", "Ugh!", "Gross!", "Barf!", "Ick!", "Putrid!", "Rank!", "Vile!", "Sickening!", "Odious!", "No way!", "Bleh!", "Cringe!", "Yikes!", "Gag!", "Pungent!", "Awful!", "Horrid!", "Stench!", "What is that?!", "Oh no!", "Why?!", "Ewww!", "Yeesh!", "Blech!", "GROSS!", "Noxious!", "Obnoxious!", "Yowza!", "Oof!", "Gnar!", "Yow!", "Eek!", "Yowch!", "Ooze!", "Funky!", "Rancid!", "Rotten!", "Whew!", "Stank!", "Phew!", "GROSS-out!"]; var word = grossWords[Math.floor(Math.random() * grossWords.length)]; dogFace.speechBubble.setText(word); dogFace.speechBubble.alpha = 1; tween(dogFace.speechBubble, { alpha: 0 }, { duration: 900, delay: 500, easing: tween.cubicIn }); // Dog teleports to center and stops sliding for a moment dogFace.x = 2048 / 2; dogFace.lastX = dogFace.x; LK.getSound('fart_snd').play(); }, autoClickers[idx].interval); } } }; })(i); } // --- Simple Click Counter Button --- // (Removed: click counter button and handler, as clicks are now counted via the FART button); // --- Leaderboard Button removed ---
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Dog face class
var DogFace = Container.expand(function () {
var self = Container.call(this);
// Normal face
var normalFace = self.attachAsset('dog_normal', {
anchorX: 0.5,
anchorY: 0.5
});
// React face
var reactFace = self.attachAsset('dog_react', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0
});
// Show normal face
self.showNormal = function () {
normalFace.alpha = 1;
reactFace.alpha = 0;
};
// Show react face
self.showReact = function () {
normalFace.alpha = 0;
reactFace.alpha = 1;
};
// Flash react face for a short time, then return to normal
self.react = function () {
self.showReact();
// Return to normal face after 500ms
LK.setTimeout(function () {
self.showNormal();
// Always teleport dog to center after animation, even if spammed
self.x = 2048 / 2;
}, 500);
};
self.showNormal();
return self;
});
// Fart button class
var FartButton = Container.expand(function () {
var self = Container.call(this);
// Button shape
var btn = self.attachAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5
});
// "FART" text
var fartTxt = new Text2('FART', {
size: 120,
fill: 0x7A5C00
});
fartTxt.anchor.set(0.5, 0.5);
fartTxt.x = 0;
fartTxt.y = 0;
self.addChild(fartTxt);
// Fart cloud effect (hidden by default)
var fartCloud = self.attachAsset('centerCircle', {
anchorX: 0.5,
anchorY: 1,
scaleX: 1.2,
scaleY: 0.7,
x: 0,
y: -110,
alpha: 0,
tint: 0xeeeecc
});
fartCloud.width = btn.width * 0.7;
fartCloud.height = btn.height * 0.7;
// Show fart cloud with animation
self.showFartCloud = function () {
fartCloud.alpha = 0.85;
fartCloud.scaleX = 1.2;
fartCloud.scaleY = 0.7;
fartCloud.y = -110;
tween(fartCloud, {
alpha: 0,
y: fartCloud.y - 80,
scaleX: 1.5,
scaleY: 1.1
}, {
duration: 420,
easing: tween.cubicOut
});
};
// Simple press animation
self.animatePress = function () {
tween(self, {
scaleX: 0.92,
scaleY: 0.92
}, {
duration: 60,
easing: tween.cubicIn,
onFinish: function onFinish() {
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 80,
easing: tween.cubicOut
});
}
});
self.showFartCloud();
};
return self;
});
// Person standing and recording class
var PersonRecording = Container.expand(function () {
var self = Container.call(this);
// Single square for the person
var personSquare = self.attachAsset('person_leg', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xE3F6FF
});
/****
* Game Code
****/
// Fart sound
// Big fart button
// Cartoon dog face (shocked/disgusted)
// Cartoon dog face (normal)
// Center dog face
// Person recording assets
var dogFace = new DogFace();
dogFace.x = 2048 / 2;
dogFace.y = 1100;
dogFace.lastX = dogFace.x; // Track lastX for edge detection
game.addChild(dogFace);
// Add person standing and recording at the left side
var person = new PersonRecording();
person.x = 400;
person.y = 1200;
game.addChild(person);
// --- Dog sliding and teleport logic ---
dogFace.slideSpeed = -12; // Negative: slides left
game.update = function () {
// Save lastX for edge detection
dogFace.lastX = dogFace.x;
// Only slide dog left if it is not at the center (prevents repeated sliding after rapid clicks)
if (Math.abs(dogFace.x - 2048 / 2) > 1) {
dogFace.x += dogFace.slideSpeed;
// If dog reaches the left edge, teleport to center and react
if (dogFace.lastX > 120 && dogFace.x <= 120) {
// Teleport to center
dogFace.x = 2048 / 2;
// Fun: dog reacts
dogFace.react();
// Optional: flash screen for drama
LK.effects.flashScreen(0xff0000, 300);
}
} else {
// Always keep dog exactly centered if not sliding
dogFace.x = 2048 / 2;
}
};
// Place fart button below dog face
var fartBtn = new FartButton();
fartBtn.x = 2048 / 2;
fartBtn.y = 2000;
game.addChild(fartBtn);
// Prevent accidental tap in top left (menu area): nothing is placed there
// Instructions text (top center, GUI)
var instrTxt = new Text2('Tap the FART button!', {
size: 90,
fill: 0x2D2D2D
});
instrTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(instrTxt);
// --- Clicker Game State ---
var fartCount = 0;
var fartPerClick = 1;
// Upgrade definitions: [amount, base cost, cost multiplier]
var upgrades = [{
amount: 1,
base: 10,
mult: 1.15,
label: "x1"
}, {
amount: 10,
base: 20,
mult: 1.18,
label: "x10"
}, {
amount: 50,
base: 120,
mult: 1.22,
label: "x50"
}, {
amount: 100,
base: 600,
mult: 1.28,
label: "x100"
}, {
amount: 1000,
base: 4000,
mult: 1.35,
label: "x1000"
}];
// Track how many times each upgrade was bought
var upgradesBought = [0, 0, 0, 0, 0];
// --- UI Elements ---
var fartCountTxt = new Text2('Farts: 0', {
size: 150,
fill: 0x2D2D2D,
fontWeight: 'bold'
});
// Anchor to top right (right edge, top)
fartCountTxt.anchor.set(1, 0);
// Place at top right using LK.gui.topRight, which will always fit the right border regardless of device size
fartCountTxt.x = 0;
fartCountTxt.y = 40;
LK.gui.topRight.addChild(fartCountTxt);
var fartPerClickTxt = new Text2('Farts/click: 1', {
size: 60,
fill: 0x444444
});
fartPerClickTxt.anchor.set(0.5, 0);
fartPerClickTxt.x = 2048 / 2;
fartPerClickTxt.y = 340;
LK.gui.top.addChild(fartPerClickTxt);
// --- Upgrades UI ---
var upgradeButtons = [];
var upgradeTxts = [];
var upgradeCostTxts = [];
var upgradeYStart = 550;
var upgradeSpacing = 120;
// Shop toggle state
var shopVisible = false; // Start with shop closed
// Create upgrade shop toggle button
var shopBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.45,
scaleY: 0.45,
// Make square: scaleX and scaleY are equal
x: 400,
y: upgradeYStart - 120
});
shopBtn.interactive = true;
var shopBtnTxt = new Text2('Upgrade Shop', {
size: 70,
fill: 0x7A5C00
});
shopBtnTxt.anchor.set(0.5, 0.5);
shopBtnTxt.x = 0;
shopBtnTxt.y = 0;
shopBtn.addChild(shopBtnTxt);
game.addChild(shopBtn);
// Create upgrade buttons (initially hidden)
for (var i = 0; i < upgrades.length; ++i) {
// Button
var btn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.5,
scaleY: 0.5,
x: 400,
y: upgradeYStart + i * upgradeSpacing
});
btn.interactive = true;
// Label
var txt = new Text2('Upgrade ' + upgrades[i].label, {
size: 60,
fill: 0x7A5C00
});
txt.anchor.set(0.5, 0.5);
txt.x = 0;
txt.y = -20;
btn.addChild(txt);
// Cost
var costTxt = new Text2('', {
size: 44,
fill: 0x444444
});
costTxt.anchor.set(0.5, 0.5);
costTxt.x = 0;
costTxt.y = 50;
btn.addChild(costTxt);
// Add to game
game.addChild(btn);
btn.visible = false; // Hide upgrade buttons initially
upgradeButtons.push(btn);
upgradeTxts.push(txt);
upgradeCostTxts.push(costTxt);
}
// Shop toggle logic
shopBtn.down = function (x, y, obj) {
shopVisible = !shopVisible;
for (var i = 0; i < upgradeButtons.length; ++i) {
upgradeButtons[i].visible = shopVisible;
}
// Feedback: flash the shop button
LK.effects.flashObject(shopBtn, 0xfff7b2, 120);
};
// --- Helper: Calculate upgrade cost ---
function getUpgradeCost(idx) {
var u = upgrades[idx];
var n = upgradesBought[idx];
// Exponential cost scaling
return Math.floor(u.base * Math.pow(u.mult, n));
}
// --- Helper: Update all UI ---
function updateUI() {
fartCountTxt.setText('Farts: ' + fartCount);
fartPerClickTxt.setText('Farts/click: ' + fartPerClick);
for (var i = 0; i < upgrades.length; ++i) {
var cost = getUpgradeCost(i);
upgradeCostTxts[i].setText('Cost: ' + cost);
// Gray out if can't afford
if (fartCount >= cost) {
upgradeButtons[i].alpha = 1;
} else {
upgradeButtons[i].alpha = 0.5;
}
}
}
updateUI();
// --- Upgrade Button Handlers ---
for (var i = 0; i < upgrades.length; ++i) {
(function (idx) {
upgradeButtons[idx].down = function (x, y, obj) {
var cost = getUpgradeCost(idx);
if (fartCount >= cost) {
fartCount -= cost;
upgradesBought[idx]++;
fartPerClick += upgrades[idx].amount;
updateUI();
// Feedback
LK.effects.flashObject(upgradeButtons[idx], 0xeeeecc, 120);
}
};
})(i);
}
// --- Fart Button Handler (Clicker) ---
fartBtn.down = function (x, y, obj) {
// Animate button
fartBtn.animatePress();
// Button color flash for feedback
LK.effects.flashObject(fartBtn, 0xfff7b2, 120);
// Play fart sound
LK.getSound('fart_snd').play();
// Dog reacts
dogFace.react();
// Dog says a random synonym for 'gross'
if (!dogFace.speechBubble) {
// Create speech bubble if not already present
var bubble = new Text2('', {
size: 90,
fill: 0xffffff,
stroke: 0x222222,
strokeThickness: 8,
wordWrap: true,
wordWrapWidth: 600,
align: 'center'
});
bubble.anchor.set(0.5, 1);
bubble.x = 0;
bubble.y = -420;
bubble.alpha = 0;
dogFace.addChild(bubble);
dogFace.speechBubble = bubble;
}
var grossWords = ["Yuck!", "Ew!", "Disgusting!", "Nasty!", "Foul!", "Repulsive!", "Stinky!", "Revolting!", "Pee-yew!", "Ugh!", "Gross!", "Barf!", "Ick!", "Putrid!", "Rank!", "Vile!", "Sickening!", "Odious!", "No way!", "Bleh!", "Cringe!", "Yikes!", "Gag!", "Pungent!", "Awful!", "Horrid!", "Stench!", "What is that?!", "Oh no!", "Why?!", "Ewww!", "Yeesh!", "Blech!", "GROSS!", "Noxious!", "Obnoxious!", "Yowza!", "Oof!", "Gnar!", "Yow!", "Eek!", "Yowch!", "Ooze!", "Funky!", "Rancid!", "Rotten!", "Whew!", "Stank!", "Phew!", "GROSS-out!"];
var word = grossWords[Math.floor(Math.random() * grossWords.length)];
dogFace.speechBubble.setText(word);
dogFace.speechBubble.alpha = 1;
tween(dogFace.speechBubble, {
alpha: 0
}, {
duration: 900,
delay: 500,
easing: tween.cubicIn
});
// Dog teleports to center and stops sliding for a moment
dogFace.x = 2048 / 2;
dogFace.lastX = dogFace.x;
// Add farts according to multiplier!
fartCount += fartPerClick;
updateUI();
};
// Make the button big and easy to tap: handle press anywhere on the button
fartBtn.interactive = true;
// --- Auto Clicker Upgrades ---
// Each auto clicker has: label, base cost, cost multiplier, interval (ms), amount per tick
var autoClickers = [{
label: "Auto 1s",
base: 100,
mult: 1.18,
interval: 1000,
amount: 1
}, {
label: "Auto 0.5s",
base: 500,
mult: 1.22,
interval: 500,
amount: 2
}, {
label: "Auto 0.2s",
base: 2000,
mult: 1.28,
interval: 200,
amount: 5
}];
var autoClickersBought = [0, 0, 0];
var autoClickerTimers = [null, null, null];
// --- UI for Auto Clickers ---
var autoClickerButtons = [];
var autoClickerTxts = [];
var autoClickerCostTxts = [];
var autoClickerYStart = upgradeYStart + upgrades.length * upgradeSpacing + 80;
var autoClickerSpacing = 120;
for (var i = 0; i < autoClickers.length; ++i) {
var btn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.5,
scaleY: 0.5,
x: 400,
y: autoClickerYStart + i * autoClickerSpacing
});
btn.interactive = true;
var txt = new Text2(autoClickers[i].label, {
size: 60,
fill: 0x7A5C00
});
txt.anchor.set(0.5, 0.5);
txt.x = 0;
txt.y = -20;
btn.addChild(txt);
var costTxt = new Text2('', {
size: 44,
fill: 0x444444
});
costTxt.anchor.set(0.5, 0.5);
costTxt.x = 0;
costTxt.y = 50;
btn.addChild(costTxt);
game.addChild(btn);
btn.visible = false;
autoClickerButtons.push(btn);
autoClickerTxts.push(txt);
autoClickerCostTxts.push(costTxt);
}
// --- Helper: Calculate auto clicker cost ---
function getAutoClickerCost(idx) {
var ac = autoClickers[idx];
var n = autoClickersBought[idx];
return Math.floor(ac.base * Math.pow(ac.mult, n));
}
// --- Update UI: add auto clickers ---
var _oldUpdateUI = updateUI;
updateUI = function updateUI() {
_oldUpdateUI();
for (var i = 0; i < autoClickers.length; ++i) {
var cost = getAutoClickerCost(i);
autoClickerCostTxts[i].setText('Cost: ' + cost + ' | Owned: ' + autoClickersBought[i]);
if (fartCount >= cost) {
autoClickerButtons[i].alpha = 1;
} else {
autoClickerButtons[i].alpha = 0.5;
}
}
};
// --- Shop toggle: show/hide auto clickers too ---
var _oldShopBtnDown = shopBtn.down;
shopBtn.down = function (x, y, obj) {
_oldShopBtnDown(x, y, obj);
for (var i = 0; i < autoClickerButtons.length; ++i) {
autoClickerButtons[i].visible = shopVisible;
}
};
// --- Auto Clicker Button Handlers ---
for (var i = 0; i < autoClickers.length; ++i) {
(function (idx) {
autoClickerButtons[idx].down = function (x, y, obj) {
var cost = getAutoClickerCost(idx);
if (fartCount >= cost) {
fartCount -= cost;
autoClickersBought[idx]++;
updateUI();
LK.effects.flashObject(autoClickerButtons[idx], 0xeeeecc, 120);
// If this is the first purchase, start the timer
if (autoClickersBought[idx] === 1) {
autoClickerTimers[idx] = LK.setInterval(function () {
// Each auto clicker tick: add (amount * owned * fartPerClick) to fartCount
fartCount += autoClickers[idx].amount * autoClickersBought[idx] * fartPerClick;
updateUI();
// Fun: dog reacts every time
dogFace.react();
// Dog says a random synonym for 'gross' (same as fartBtn.down)
if (!dogFace.speechBubble) {
// Create speech bubble if not already present
var bubble = new Text2('', {
size: 90,
fill: 0xffffff,
stroke: 0x222222,
strokeThickness: 8,
wordWrap: true,
wordWrapWidth: 600,
align: 'center'
});
bubble.anchor.set(0.5, 1);
bubble.x = 0;
bubble.y = -420;
bubble.alpha = 0;
dogFace.addChild(bubble);
dogFace.speechBubble = bubble;
}
var grossWords = ["Yuck!", "Ew!", "Disgusting!", "Nasty!", "Foul!", "Repulsive!", "Stinky!", "Revolting!", "Pee-yew!", "Ugh!", "Gross!", "Barf!", "Ick!", "Putrid!", "Rank!", "Vile!", "Sickening!", "Odious!", "No way!", "Bleh!", "Cringe!", "Yikes!", "Gag!", "Pungent!", "Awful!", "Horrid!", "Stench!", "What is that?!", "Oh no!", "Why?!", "Ewww!", "Yeesh!", "Blech!", "GROSS!", "Noxious!", "Obnoxious!", "Yowza!", "Oof!", "Gnar!", "Yow!", "Eek!", "Yowch!", "Ooze!", "Funky!", "Rancid!", "Rotten!", "Whew!", "Stank!", "Phew!", "GROSS-out!"];
var word = grossWords[Math.floor(Math.random() * grossWords.length)];
dogFace.speechBubble.setText(word);
dogFace.speechBubble.alpha = 1;
tween(dogFace.speechBubble, {
alpha: 0
}, {
duration: 900,
delay: 500,
easing: tween.cubicIn
});
// Dog teleports to center and stops sliding for a moment
dogFace.x = 2048 / 2;
dogFace.lastX = dogFace.x;
LK.getSound('fart_snd').play();
}, autoClickers[idx].interval);
}
}
};
})(i);
}
// --- Simple Click Counter Button ---
// (Removed: click counter button and handler, as clicks are now counted via the FART button);
// --- Leaderboard Button removed ---