User prompt
Remove the dog teleport achievement since it’s literally impossible to get
User prompt
Make it so I can’t unlock two achievements at the same time
User prompt
Don’t let the counter go into decimals
User prompt
Add update log
User prompt
Turn off the rainbow effects, and the emojis when Outside of autism mod
User prompt
The straw effect is still active went outside of autism mode fix this
User prompt
Add something that will make players think to play this so will be the top game on this app and more people download the app just to play this
User prompt
The stimulant effect is working outside of autism mode fix this
User prompt
Add more cool stuff
User prompt
Don’t make it auto clicks trigger without buying a multi
User prompt
Make auto clicks trigger the stimulus effect in autism mode
User prompt
Make a button called autism mode where all this chaotic stuff happens and you can toggle it on and off make every click in autism mode REALLY COLORFUL AND CAOTIC ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
Make it just really chaotic
User prompt
Add more stimulents for autism
User prompt
Add more stuff
User prompt
Add more stuff
User prompt
Do it
User prompt
Make more cool stuz
User prompt
Add more cool stuff you suggested in that long list
User prompt
Make the yellow circle of the achievements are in into a red square
User prompt
Add a list of achievements that you have unlocked and other achievements that you need to get
User prompt
I love this add more cool achievements and the other cool stuff you suggested
User prompt
Make the sphere the share text is in make it a square
User prompt
Move the daily rewards and share out of the dogs way
User prompt
Please fix the bug: 'storage.has is not a function. (In 'storage.has('lastDailyReward')', 'storage.has' is undefined)' in or related to this line: 'if (storage.has('lastDailyReward')) {' Line Number: 156 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.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;
});
// Floating text class for score popups
var FloatingText = Container.expand(function () {
var self = Container.call(this);
self.textObj = new Text2('', {
size: 80,
fill: 0xffffff,
stroke: 0x222222,
strokeThickness: 4,
align: 'center'
});
self.textObj.anchor.set(0.5, 0.5);
self.addChild(self.textObj);
self.life = 2.0;
self.maxLife = 2.0;
self.vy = -2;
self.setText = function (text) {
self.textObj.setText(text);
};
self.update = function () {
self.y += self.vy;
self.life -= 0.03;
self.alpha = self.life / self.maxLife;
if (self.life <= 0 && self.parent) {
self.parent.removeChild(self);
}
};
return self;
});
// Particle class for explosive visual effects
var Particle = Container.expand(function () {
var self = Container.call(this);
// Create particle visual using a shape
var particleShape = self.attachAsset('person_leg', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.3,
scaleY: 0.3
});
// Particle properties
self.vx = 0;
self.vy = 0;
self.life = 1.0;
self.maxLife = 1.0;
self.update = function () {
// Move particle
self.x += self.vx;
self.y += self.vy;
// Apply gravity
self.vy += 0.5;
// Reduce life
self.life -= 0.02;
// Fade out based on life
self.alpha = self.life / self.maxLife;
// Remove when dead
if (self.life <= 0 && self.parent) {
self.parent.removeChild(self);
}
};
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
****/
// --- Fun: Fart Counter Milestone Popup every 5000 farts ---
if (fartCount > 0 && fartCount % 5000 === 0) {
var milestonePopup = new Container();
var milestoneBg = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.3,
scaleY: 1.3,
x: 2048 / 2,
y: 2732 / 2
});
milestonePopup.addChild(milestoneBg);
var milestoneTxt = new Text2('Milestone!\n' + fartCount + ' Farts!\nDog is amazed!', {
size: 80,
fill: 0x7A5C00,
align: 'center'
});
milestoneTxt.anchor.set(0.5, 0.5);
milestoneTxt.x = 2048 / 2;
milestoneTxt.y = 2732 / 2 - 40;
milestonePopup.addChild(milestoneTxt);
var okBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.7,
x: 2048 / 2,
y: 2732 / 2 + 120
});
var okTxt = new Text2('OK', {
size: 70,
fill: 0x7A5C00
});
okTxt.anchor.set(0.5, 0.5);
okTxt.x = 0;
okTxt.y = 0;
okBtn.addChild(okTxt);
okBtn.interactive = true;
okBtn.down = function () {
game.removeChild(milestonePopup);
};
milestonePopup.addChild(okBtn);
game.addChild(milestonePopup);
LK.effects.flashObject(milestoneBg, 0xfff7b2, 120);
}
// --- Achievements: First 100 Farts ---
// (Removed: click counter button and handler, as clicks are now counted via the FART button);
// --- Leaderboard Button removed ---;
// --- Daily Reward System ---
// Use storage plugin to track last claim date
var lastDailyReward = storage.lastDailyReward || null;
var now = Date.now();
var oneDay = 24 * 60 * 60 * 1000;
var showDailyReward = false;
if (!lastDailyReward || now - lastDailyReward > oneDay) {
showDailyReward = true;
storage.lastDailyReward = now;
}
if (showDailyReward) {
// Show a popup in the center of the screen
var rewardPopup = new Container();
var popupBg = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.2,
scaleY: 1.2,
x: 2048 / 2,
y: 2732 - 350 //{15} // Move to bottom center, above screen edge
});
rewardPopup.addChild(popupBg);
var rewardTxt = new Text2('Daily Reward!\n+100 Farts', {
size: 90,
fill: 0x7A5C00,
align: 'center'
});
rewardTxt.anchor.set(0.5, 0.5);
rewardTxt.x = 2048 / 2;
rewardTxt.y = 2732 - 390;
rewardPopup.addChild(rewardTxt);
var claimBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.7,
x: 2048 / 2,
y: 2732 - 250 //{1g} // Move claim button below popup, but still above bottom
});
var claimTxt = new Text2('Claim!', {
size: 70,
fill: 0x7A5C00
});
claimTxt.anchor.set(0.5, 0.5);
claimTxt.x = 0;
claimTxt.y = 0;
claimBtn.addChild(claimTxt);
claimBtn.interactive = true;
claimBtn.down = function () {
fartCount += 100;
updateUI();
game.removeChild(rewardPopup);
LK.effects.flashScreen(0x83de44, 400);
};
rewardPopup.addChild(claimBtn);
game.addChild(rewardPopup);
}
// Cartoon dog face (shocked/disgusted)
// Big fart button
// Fart sound
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();
// --- Fun: Every 888th fart, dog face gets a sparkle effect ---
if (fartCount > 0 && fartCount % 888 === 0) {
var sparkleCount = 0;
var maxSparkles = 12;
var _sparkle = function sparkle() {
if (sparkleCount >= maxSparkles) return;
var sparkleStar = new Text2("✨", {
size: 80 + Math.floor(Math.random() * 40),
fill: 0xffffff,
align: 'center'
});
sparkleStar.anchor.set(0.5, 0.5);
sparkleStar.x = -200 + Math.random() * 400;
sparkleStar.y = -200 + Math.random() * 400;
sparkleStar.alpha = 1;
dogFace.addChild(sparkleStar);
tween(sparkleStar, {
alpha: 0,
y: sparkleStar.y - 60
}, {
duration: 700,
easing: tween.cubicOut,
onFinish: function onFinish() {
if (sparkleStar.parent) sparkleStar.parent.removeChild(sparkleStar);
}
});
sparkleCount++;
LK.setTimeout(_sparkle, 80);
};
_sparkle();
}
// Optional: flash screen for drama
LK.effects.flashScreen(0xff0000, 300);
}
} else {
// Always keep dog exactly centered if not sliding
dogFace.x = 2048 / 2;
} //;{2j}
// Update particles
for (var p = particles.length - 1; p >= 0; p--) {
particles[p].update();
if (particles[p].life <= 0) {
particles.splice(p, 1);
}
}
// Update floating texts
for (var f = floatingTexts.length - 1; f >= 0; f--) {
floatingTexts[f].update();
if (floatingTexts[f].life <= 0) {
floatingTexts.splice(f, 1);
}
}
// Apply screen shake
if (shakeIntensity > 0) {
game.x = (Math.random() - 0.5) * shakeIntensity;
game.y = (Math.random() - 0.5) * shakeIntensity;
shakeIntensity *= shakeDecay;
if (shakeIntensity < 0.5) {
shakeIntensity = 0;
game.x = 0;
game.y = 0;
}
}
// Update power-ups
for (var p = activePowerUps.length - 1; p >= 0; p--) {
activePowerUps[p].timeLeft -= 16.67; // 60 FPS
if (activePowerUps[p].timeLeft <= 0) {
createFloatingText(2048 / 2, 1700, activePowerUps[p].name + " Expired", 0x888888);
activePowerUps.splice(p, 1);
}
}
// Rainbow mode effect
if (autismMode && hasPowerUp('RAINBOW_MODE') && LK.ticks % 3 === 0) {
var rainbowColors = [0xff0000, 0xff8000, 0xffff00, 0x00ff00, 0x0080ff, 0x8000ff];
var color = rainbowColors[Math.floor(LK.ticks / 3) % rainbowColors.length];
LK.effects.flashScreen(color, 50);
}
// Fart storm effect
if (hasPowerUp('FART_STORM') && LK.ticks % 30 === 0) {
fartCount += 10;
createParticleExplosion(Math.random() * 2048, Math.random() * 2732, 0x0080ff, 5);
updateUI();
}
};
// Place fart button below dog face
var fartBtn = new FartButton();
fartBtn.x = 2048 / 2;
fartBtn.y = 2000;
game.addChild(fartBtn);
// --- Social Share & Viral Challenge Button ---
// Place to the right of the fart button
var shareBtn = LK.getAsset('person_leg', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3.2,
scaleY: 3.2,
x: 2048 - 250,
// Move to bottom right, away from dog/fart button
y: 2732 - 250
});
var shareTxt = new Text2('Share', {
size: 70,
fill: 0x7A5C00
});
shareTxt.anchor.set(0.5, 0.5);
shareTxt.x = 0;
shareTxt.y = 0;
shareBtn.addChild(shareTxt);
shareBtn.interactive = true;
shareBtn.down = function () {
// Show a viral challenge popup with leaderboard and share
var popup = new Container();
var bg = LK.getAsset('person_leg', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 7.5,
scaleY: 7.5,
x: 2048 / 2,
y: 2732 / 2
});
popup.addChild(bg);
var viralTitle = new Text2('🌎 FartDog Viral Challenge 🌎', {
size: 80,
fill: 0xff8000,
align: 'center'
});
viralTitle.anchor.set(0.5, 0.5);
viralTitle.x = 2048 / 2;
viralTitle.y = 2732 / 2 - 320;
popup.addChild(viralTitle);
// Simulate a global leaderboard (local only, but looks viral!)
var fakeScores = [{
name: "You",
score: fartCount
}, {
name: "Chris",
score: 123456
}, {
name: "John",
score: 98765
}, {
name: "DogLover99",
score: 54321
}, {
name: "FartKing",
score: 42000
}, {
name: "CatQueen",
score: 31415
}, {
name: "Guest",
score: 10000 + Math.floor(Math.random() * 9000)
}];
fakeScores.sort(function (a, b) {
return b.score - a.score;
});
for (var i = 0; i < fakeScores.length; ++i) {
var entry = fakeScores[i];
var entryTxt = new Text2(i + 1 + ". " + entry.name + " - " + entry.score + " farts", {
size: 54,
fill: entry.name === "You" ? 0x83de44 : 0x7A5C00,
align: 'left'
});
entryTxt.anchor.set(0.5, 0.5);
entryTxt.x = 2048 / 2;
entryTxt.y = 2732 / 2 - 200 + i * 60;
popup.addChild(entryTxt);
}
var viralTxt = new Text2('I made my dog react to ' + fartCount + ' farts!\nCan you beat me?\n#FartDog', {
size: 70,
fill: 0x7A5C00,
align: 'center'
});
viralTxt.anchor.set(0.5, 0.5);
viralTxt.x = 2048 / 2;
viralTxt.y = 2732 / 2 + 180;
popup.addChild(viralTxt);
var okBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.7,
x: 2048 / 2 - 180,
y: 2732 / 2 + 320
});
var okTxt = new Text2('OK', {
size: 70,
fill: 0x7A5C00
});
okTxt.anchor.set(0.5, 0.5);
okTxt.x = 0;
okTxt.y = 0;
okBtn.addChild(okTxt);
okBtn.interactive = true;
okBtn.down = function () {
game.removeChild(popup);
};
popup.addChild(okBtn);
// Add a "Challenge Friends" button
var challengeBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.7,
x: 2048 / 2 + 180,
y: 2732 / 2 + 320
});
var challengeTxt = new Text2('Challenge Friends', {
size: 54,
fill: 0xff8000
});
challengeTxt.anchor.set(0.5, 0.5);
challengeTxt.x = 0;
challengeTxt.y = 0;
challengeBtn.addChild(challengeTxt);
challengeBtn.interactive = true;
challengeBtn.down = function () {
// Show a popup with a "copy" message
var sharePopup = new Container();
var shareBg = LK.getAsset('person_leg', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 5.5,
scaleY: 2.5,
x: 2048 / 2,
y: 2732 / 2
});
sharePopup.addChild(shareBg);
var shareMsg = new Text2("Copy this challenge to your friends:\n\nI made my dog react to " + fartCount + " farts! Can you beat me? Play on FartDog! #FartDog", {
size: 54,
fill: 0x7A5C00,
align: 'center'
});
shareMsg.anchor.set(0.5, 0.5);
shareMsg.x = 2048 / 2;
shareMsg.y = 2732 / 2 - 40;
sharePopup.addChild(shareMsg);
var closeShareBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.7,
x: 2048 / 2,
y: 2732 / 2 + 120
});
var closeShareTxt = new Text2('OK', {
size: 54,
fill: 0x7A5C00
});
closeShareTxt.anchor.set(0.5, 0.5);
closeShareTxt.x = 0;
closeShareTxt.y = 0;
closeShareBtn.addChild(closeShareTxt);
closeShareBtn.interactive = true;
closeShareBtn.down = function () {
game.removeChild(sharePopup);
};
sharePopup.addChild(closeShareBtn);
game.addChild(sharePopup);
LK.effects.flashObject(shareBg, 0xfff7b2, 120);
};
popup.addChild(challengeBtn);
game.addChild(popup);
LK.effects.flashObject(bg, 0xfff7b2, 120);
};
game.addChild(shareBtn);
// --- Autism Mode Toggle Button ---
var autismModeBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.65,
scaleY: 0.65,
x: 250,
y: 2732 - 350
});
var autismModeTxt = new Text2('Autism Mode\nOFF', {
size: 50,
fill: 0x7A5C00,
align: 'center'
});
autismModeTxt.anchor.set(0.5, 0.5);
autismModeTxt.x = 0;
autismModeTxt.y = 0;
autismModeBtn.addChild(autismModeTxt);
autismModeBtn.interactive = true;
autismModeBtn.down = function () {
autismMode = !autismMode;
storage.autismMode = autismMode;
autismModeTxt.setText('Autism Mode\n' + (autismMode ? 'ON' : 'OFF'));
autismModeTxt.fill = autismMode ? 0xff0000 : 0x7A5C00;
LK.effects.flashObject(autismModeBtn, autismMode ? 0xff0000 : 0x83de44, 200);
if (autismMode) {
// Flash screen rainbow to indicate chaos mode is on
var rainbowColors = [0xff0000, 0xffa500, 0xffff00, 0x00ff00, 0x0000ff, 0x4b0082, 0xee82ee];
var idx = 0;
var _rainbowFlash = function rainbowFlash() {
if (idx >= rainbowColors.length) return;
LK.effects.flashScreen(rainbowColors[idx], 120);
idx++;
LK.setTimeout(_rainbowFlash, 120);
};
_rainbowFlash();
// Start auto clicking every 200ms for maximum chaos (only if player has bought auto-clickers)
var hasAutoClickers = false;
for (var aci = 0; aci < autoClickersBought.length; ++aci) {
if (autoClickersBought[aci] > 0) {
hasAutoClickers = true;
break;
}
}
if (hasAutoClickers) {
autismModeAutoClickTimer = LK.setInterval(function () {
if (autismMode && fartBtn.down) {
fartBtn.down(0, 0, {});
}
}, 200);
}
} else {
// Stop auto clicking when autism mode is turned off
if (autismModeAutoClickTimer) {
LK.clearInterval(autismModeAutoClickTimer);
autismModeAutoClickTimer = null;
}
}
};
game.addChild(autismModeBtn);
// Update autism mode button text on load
autismModeTxt.setText('Autism Mode\n' + (autismMode ? 'ON' : 'OFF'));
autismModeTxt.fill = autismMode ? 0xff0000 : 0x7A5C00;
// 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;
// --- Particle System ---
var particles = [];
var floatingTexts = [];
// Create particle explosion at position
function createParticleExplosion(x, y, color, count) {
count = count || 15;
for (var i = 0; i < count; i++) {
var particle = new Particle();
particle.x = x;
particle.y = y;
// Random velocity
var angle = Math.random() * 2 * Math.PI;
var speed = 5 + Math.random() * 10;
particle.vx = Math.cos(angle) * speed;
particle.vy = Math.sin(angle) * speed - 5; // Upward bias
// Set color
particle.children[0].tint = color || 0xffffff;
// Random life
particle.maxLife = 0.8 + Math.random() * 0.4;
particle.life = particle.maxLife;
particles.push(particle);
game.addChild(particle);
}
}
// Create floating score text
function createFloatingText(x, y, text, color) {
var floatText = new FloatingText();
floatText.x = x;
floatText.y = y;
floatText.setText(text);
floatText.textObj.fill = color || 0xffffff;
floatingTexts.push(floatText);
game.addChild(floatText);
}
// --- Screen shake system
var shakeIntensity = 0;
var shakeDecay = 0.9;
function addScreenShake(intensity) {
shakeIntensity = Math.max(shakeIntensity, intensity);
}
// --- Power-up System ---
var activePowerUps = [];
// Power-up types
var powerUpTypes = {
DOUBLE_FARTS: {
name: "Double Farts",
duration: 10000,
color: 0x00ff00
},
MEGA_COMBO: {
name: "Mega Combo",
duration: 15000,
color: 0xff8000
},
RAINBOW_MODE: {
name: "Rainbow Mode",
duration: 8000,
color: 0xff00ff
},
FART_STORM: {
name: "Fart Storm",
duration: 12000,
color: 0x0080ff
}
};
// Trigger random power-up
function triggerRandomPowerUp() {
var types = Object.keys(powerUpTypes);
var randomType = types[Math.floor(Math.random() * types.length)];
var powerUp = powerUpTypes[randomType];
// Add to active power-ups
activePowerUps.push({
type: randomType,
name: powerUp.name,
timeLeft: powerUp.duration,
color: powerUp.color
});
// Visual feedback
createFloatingText(2048 / 2, 1600, "POWER-UP!\n" + powerUp.name, powerUp.color);
LK.effects.flashScreen(powerUp.color, 500);
createParticleExplosion(2048 / 2, 1600, powerUp.color, 30);
addScreenShake(20);
}
// Check if power-up is active
function hasPowerUp(type) {
for (var i = 0; i < activePowerUps.length; i++) {
if (activePowerUps[i].type === type) return true;
}
return false;
}
// --- Autism Mode State ---
var autismMode = storage.autismMode || false;
var autismModeAutoClickTimer = null;
// --- Combo System ---
var comboCount = 0;
var comboMultiplier = 1;
var lastClickTime = 0;
var comboTimeout = null;
// Reset combo after 2 seconds of no clicking
function resetCombo() {
if (comboCount > 1) {
createFloatingText(2048 / 2, 1400, "Combo Reset!", 0xff6b6b);
}
comboCount = 0;
comboMultiplier = 1;
updateComboUI();
}
function updateComboMultiplier() {
if (comboCount >= 50) comboMultiplier = 5;else if (comboCount >= 25) comboMultiplier = 3;else if (comboCount >= 10) comboMultiplier = 2;else comboMultiplier = 1;
}
// Upgrade definitions: [amount, base cost, cost multiplier]
// Add Chris upgrade as the last upgrade (can only buy once)
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"
}, {
amount: 0,
// Chris doesn't increase fartPerClick, but triggers special effect
base: 100000,
mult: 1,
// Not used, can only buy once
label: "Chris (CAT!)"
}, {
// New John upgrade
amount: 10000,
// Drastically increase points per click
base: 50000,
mult: 1,
label: "John (BOOST!)"
}];
// Track how many times each upgrade was bought
var upgradesBought = [0, 0, 0, 0, 0, 0]; // Add slot for Chris
// --- 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);
// Combo display
var comboTxt = new Text2('Combo: 0x', {
size: 70,
fill: 0xff6b6b,
stroke: 0x222222,
strokeThickness: 3
});
comboTxt.anchor.set(0.5, 0);
comboTxt.x = 2048 / 2;
comboTxt.y = 420;
LK.gui.top.addChild(comboTxt);
function updateComboUI() {
comboTxt.setText('Combo: ' + comboCount + 'x (Multiplier: ' + comboMultiplier + 'x)');
if (comboCount >= 50) comboTxt.fill = 0xff0080; // Pink for mega combo
else if (comboCount >= 25) comboTxt.fill = 0x8000ff; // Purple for super combo
else if (comboCount >= 10) comboTxt.fill = 0xff8000; // Orange for combo
else comboTxt.fill = 0xff6b6b; // Red for small combo
}
// --- 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 labelText = i === upgrades.length - 2 ? "John (BOOST!)" : i === upgrades.length - 1 ? "Chris (CAT!)" : 'Upgrade ' + upgrades[i].label;
var txt = new Text2(labelText, {
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);
}
// --- Chris Cat Upgrade State ---
var chrisCatSpawned = false;
var chrisCatContainer = null;
// --- John Upgrade State ---
var johnSpawned = false;
var johnContainer = null;
var isShowingAchievement = false; // Flag to prevent multiple achievement popups
// 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 idx === upgrades.length - 1 ? 100000 : 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);
// Special handling for Chris and John upgrades (last two)
upgradeCostTxts[i].setText('Cost: ' + (isNaN(cost) || cost === Infinity ? '100,000' : cost));
upgradeButtons[i].alpha = fartCount >= cost ? 1 : 0.5;
upgradeButtons[i].interactive = fartCount >= cost;
}
// Show cat if Chris bought
if (chrisCatSpawned && chrisCatContainer && !chrisCatContainer.parent) {
game.addChild(chrisCatContainer);
}
// Show John if bought
if (johnSpawned && johnContainer && !johnContainer.parent) {
game.addChild(johnContainer);
}
}
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);
// Chris upgrade (last one)
if (idx === upgrades.length - 1) {
if (fartCount >= cost) {
fartCount -= cost;
upgradesBought[idx]++;
// Spawn cat
if (!chrisCatSpawned) {
chrisCatSpawned = true;
// Create cat container
chrisCatContainer = new Container();
// Use Chris asset for cat body
var catBody = LK.getAsset('Chris', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3.2,
scaleY: 2.2
});
chrisCatContainer.addChild(catBody);
// Cat face (text) - Removed
// var catFace = new Text2('😼', {
// size: 160,
// fill: 0x222222
// });
// catFace.anchor.set(0.5, 0.5);
// catFace.x = 0;
// catFace.y = -10;
// chrisCatContainer.addChild(catFace);
// Cat label
var catLabel = new Text2('Chris the Cat!', {
size: 60,
fill: 0x444444
});
catLabel.anchor.set(0.5, 0);
catLabel.x = 0;
catLabel.y = 110;
chrisCatContainer.addChild(catLabel);
// Place cat right under the fart button
chrisCatContainer.x = 2048 / 2;
chrisCatContainer.y = 2000 + 170; // Position below fart button
game.addChild(chrisCatContainer);
// Animate cat in
chrisCatContainer.alpha = 0;
tween(chrisCatContainer, {
alpha: 1
}, {
duration: 600,
easing: tween.cubicOut
});
// Drastically increase auto fart rate: multiply all autoClickers' amount by 5
for (var aci = 0; aci < autoClickers.length; ++aci) {
autoClickers[aci].amount *= 5;
}
// If any autoClicker is already running, clear and restart to apply new rate
for (var aci = 0; aci < autoClickers.length; ++aci) {
if (autoClickersBought[aci] > 0 && autoClickerTimers[aci]) {
LK.clearInterval(autoClickerTimers[aci]);
(function (aci2) {
autoClickerTimers[aci2] = LK.setInterval(function () {
fartCount += autoClickers[aci2].amount * autoClickersBought[aci2] * fartPerClick;
updateUI();
dogFace.react();
// Dog says a random gross word
if (!dogFace.speechBubble) {
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!", "Repugnant!", "Skunky!", "Malodorous!", "Putrescent!", "Fetid!", "Mephitic!", "Moldy!", "Dank!", "Manky!", "Cruddy!", "Crud!", "Yuuuck!", "Ew, dude!", "Stale!", "Funky town!", "Reek!", "Stale cheese!", "Cheesy!", "Mold!", "Ew, stinky!", "Ew, gross!", "Ew, nasty!", "Ew, barf!", "Ew, icky!", "Ew, yuck!", "Ew, blech!", "Ew, pew!", "Ew, phew!", "Ew, stank!", "Ew, rotten!", "Ew, rancid!", "Ew, vile!", "Ew, sick!", "Ew, odious!", "Ew, horrid!", "Ew, foul!", "Ew, revolting!", "Ew, repulsive!", "Ew, stench!", "Ew, noxious!", "Ew, obnoxious!", "Ew, gnarly!", "Ew, yowza!", "Ew, oof!", "Ew, yow!", "Ew, eek!", "Ew, yowch!", "Ew, ooze!", "Ew, funky!", "Ew, whew!", "Ew, gross-out!", "Ew, what is that?!", "Ew, oh no!", "Ew, why?!", "Ew, yeesh!", "Ew, yikes!", "Ew, cringe!", "Ew, gag!", "Ew, pungent!", "Ew, awful!", "Ew, stank!", "Ew, phew!", "Ew, barf!", "Ew, ick!", "Ew, putrid!", "Ew, rank!", "Ew, vile!", "Ew, sickening!", "Ew, odious!", "Ew, bleh!", "Ew, gross!", "Ew, stench!", "Ew, no way!", "Ew, yuck!", "Ew, ewww!", "Ew, blech!", "Ew, GROSS!", "Ew, yikes!", "Ew, cringe!", "Ew, gag!", "Ew, pungent!", "Ew, horrid!", "Ew, stench!", "Ew, what is that?!", "Ew, oh no!", "Ew, why?!", "Ew, yeesh!", "Ew, yikes!", "Ew, cringe!", "Ew, gag!", "Ew, pungent!", "Ew, awful!", "Ew, horrid!", "Ew, stench!", "Ew, what is that?!", "Ew, oh no!", "Ew, why?!", "Ew, ewww!", "Ew, yeesh!", "Ew, blech!", "Ew, GROSS!", "Ew, noxious!", "Ew, obnoxious!", "Ew, yowza!", "Ew, oof!", "Ew, gnar!", "Ew, yow!", "Ew, eek!", "Ew, yowch!", "Ew, ooze!", "Ew, funky!", "Ew, rancid!", "Ew, rotten!", "Ew, whew!", "Ew, stank!", "Ew, phew!", "Ew, 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
});
dogFace.x = 2048 / 2;
dogFace.lastX = dogFace.x;
LK.getSound('fart_snd').play();
}, autoClickers[aci2].interval);
})(aci);
}
}
}
updateUI();
LK.effects.flashObject(upgradeButtons[idx], 0xeeeecc, 120);
}
return;
}
// John upgrade (second last one)
if (idx === upgrades.length - 2) {
if (fartCount >= cost) {
fartCount -= cost;
upgradesBought[idx]++;
// Spawn John
if (!johnSpawned) {
johnSpawned = true;
// Create John container
johnContainer = new Container();
// Use John asset for body
var johnBody = LK.getAsset('John', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3.2,
scaleY: 2.2
});
johnContainer.addChild(johnBody);
// John label
var johnLabel = new Text2('John the Booster!', {
size: 60,
fill: 0x444444
});
johnLabel.anchor.set(0.5, 0);
johnLabel.x = 0;
johnLabel.y = 110;
johnContainer.addChild(johnLabel);
// Place John next to Chris under the fart button
johnContainer.x = 2048 / 2 + 150; // Position John next to Chris
johnContainer.y = 2000 + 170; // Align with Chris's Y position
game.addChild(johnContainer);
// Animate John in
johnContainer.alpha = 0;
tween(johnContainer, {
alpha: 1
}, {
duration: 600,
easing: tween.cubicOut
});
}
updateUI();
LK.effects.flashObject(upgradeButtons[idx], 0xeeeecc, 120);
}
return;
}
// Normal upgrades
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();
// --- COMBO SYSTEM ---
var now = Date.now();
if (now - lastClickTime < 2000) {
// Within 2 seconds
comboCount++;
} else {
comboCount = 1;
}
lastClickTime = now;
// Clear existing combo timeout
if (comboTimeout) {
LK.clearTimeout(comboTimeout);
}
// Set new combo timeout
comboTimeout = LK.setTimeout(resetCombo, 2000);
updateComboMultiplier();
updateComboUI();
// Add particle explosion at button
createParticleExplosion(fartBtn.x, fartBtn.y - 50, 0xfff7b2, 8 + Math.min(comboCount, 20));
// Add screen shake based on combo
addScreenShake(2 + Math.min(comboCount * 0.5, 15));
// Show combo floating text for milestone combos
if (comboCount % 10 === 0 && comboCount >= 10) {
createFloatingText(fartBtn.x + 150, fartBtn.y - 100, "COMBO x" + comboCount + "!", 0xff8000);
}
// --- CHAOS MODE: Every fart triggers a storm of effects when autism mode is ON! ---
if (autismMode) {
// 1. Rapid screen shake
var chaosShakeTimes = 16 + Math.floor(Math.random() * 8);
var _chaosShake = function chaosShake(n) {
if (n <= 0) {
game.x = 0;
return;
}
game.x = n % 2 === 0 ? 40 + Math.random() * 30 : -40 - Math.random() * 30;
game.y = n % 3 === 0 ? 30 + Math.random() * 20 : -30 - Math.random() * 20;
LK.setTimeout(function () {
_chaosShake(n - 1);
}, 18 + Math.floor(Math.random() * 10));
};
_chaosShake(chaosShakeTimes);
// 2. Random color strobe on dog face and fart button
var chaosStrobeColors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0xff00ff, 0x00ffff, 0xffffff, 0x7ec850, 0xf06292, 0xffeb3b, 0x9c27b0, 0xff5722, 0x00bcd4, 0xe91e63];
var chaosStrobeIdx = 0;
var chaosStrobeMax = 10 + Math.floor(Math.random() * 6);
var chaosDogParts = [];
if (dogFace.children && dogFace.children.length > 0) {
for (var i = 0; i < dogFace.children.length; ++i) {
if (dogFace.children[i] && typeof dogFace.children[i].tint !== "undefined") {
chaosDogParts.push(dogFace.children[i]);
}
}
}
var chaosBtnParts = [];
if (fartBtn.children && fartBtn.children.length > 0) {
for (var i = 0; i < fartBtn.children.length; ++i) {
if (fartBtn.children[i] && typeof fartBtn.children[i].tint !== "undefined") {
chaosBtnParts.push(fartBtn.children[i]);
}
}
}
var chaosOriginalDogTints = [];
for (var i = 0; i < chaosDogParts.length; ++i) {
chaosOriginalDogTints.push(chaosDogParts[i].tint);
}
var chaosOriginalBtnTints = [];
for (var i = 0; i < chaosBtnParts.length; ++i) {
chaosOriginalBtnTints.push(chaosBtnParts[i].tint);
}
var _chaosStrobe = function chaosStrobe() {
if (chaosStrobeIdx >= chaosStrobeMax) {
// Restore original tints
for (var i = 0; i < chaosDogParts.length; ++i) {
chaosDogParts[i].tint = chaosOriginalDogTints[i];
}
for (var i = 0; i < chaosBtnParts.length; ++i) {
chaosBtnParts[i].tint = chaosOriginalBtnTints[i];
}
return;
}
var color = chaosStrobeColors[Math.floor(Math.random() * chaosStrobeColors.length)];
for (var i = 0; i < chaosDogParts.length; ++i) {
chaosDogParts[i].tint = color;
}
for (var i = 0; i < chaosBtnParts.length; ++i) {
chaosBtnParts[i].tint = color;
}
// Quick screen flash for extra chaos
LK.effects.flashScreen(color, 40 + Math.floor(Math.random() * 30));
chaosStrobeIdx++;
LK.setTimeout(_chaosStrobe, 40 + Math.floor(Math.random() * 30));
};
_chaosStrobe();
// 3. Emoji explosion: spawn a burst of random emojis from the dog face
var chaosEmojis = ["💥", "💨", "😂", "🤪", "😱", "😜", "🤯", "🔥", "💩", "🐶", "🌈", "⭐", "✨", "😵", "😆", "😹", "😛", "😲", "😬", "😺", "😻", "😈", "👻", "🦴", "🍔", "🍕", "🍟", "🍭", "🍦", "🍉", "🍌", "🍩", "🍪", "🥨", "🥓", "🥚", "🥑", "🥕", "🥦", "🥒", "🥬", "🥥", "🥜", "🥨", "🥯", "🥞", "🥩", "🥠", "🥡", "🥢", "🥤", "🥣", "🥧", "🥨", "🥚", "🥓", "🥩", "🥞", "🥯", "🥠", "🥡", "🥢", "🥤", "🥣", "🥧"];
var chaosEmojiCount = 0;
var chaosEmojiMax = 12 + Math.floor(Math.random() * 8);
var _chaosEmoji = function chaosEmoji() {
if (chaosEmojiCount >= chaosEmojiMax) return;
var emoji = chaosEmojis[Math.floor(Math.random() * chaosEmojis.length)];
var emojiTxt = new Text2(emoji, {
size: 90 + Math.floor(Math.random() * 60),
fill: 0xffffff,
align: 'center'
});
emojiTxt.anchor.set(0.5, 0.5);
emojiTxt.x = dogFace.x + (-120 + Math.random() * 240);
emojiTxt.y = dogFace.y + (-120 + Math.random() * 240);
emojiTxt.alpha = 1;
game.addChild(emojiTxt);
// Animate flying out in a random direction
var dx = -400 + Math.random() * 800;
var dy = -600 + Math.random() * 1200;
tween(emojiTxt, {
x: emojiTxt.x + dx,
y: emojiTxt.y + dy,
alpha: 0
}, {
duration: 700 + Math.random() * 400,
easing: tween.cubicOut,
onFinish: function onFinish() {
if (emojiTxt.parent) emojiTxt.parent.removeChild(emojiTxt);
}
});
chaosEmojiCount++;
LK.setTimeout(_chaosEmoji, 30 + Math.floor(Math.random() * 30));
};
_chaosEmoji();
// 4. Randomly pulse the background color
var chaosBgColors = [0xffe066, 0x7ec850, 0x4fc3f7, 0xf06292, 0xffeb3b, 0x9c27b0, 0xff5722, 0x00bcd4, 0x8bc34a, 0xe91e63, 0xffffff, 0x000000];
var chaosBgIdx = 0;
var chaosBgMax = 6 + Math.floor(Math.random() * 4);
var originalBgChaos = 0xE3F6FF;
var _chaosBgPulse = function chaosBgPulse() {
if (chaosBgIdx >= chaosBgMax) {
game.setBackgroundColor(originalBgChaos);
return;
}
var color = chaosBgColors[Math.floor(Math.random() * chaosBgColors.length)];
game.setBackgroundColor(color);
chaosBgIdx++;
LK.setTimeout(_chaosBgPulse, 50 + Math.floor(Math.random() * 40));
};
_chaosBgPulse();
// 5. Randomly scale and rotate the dog face for a moment
var chaosScale = 0.7 + Math.random() * 1.6;
var chaosRot = -Math.PI + Math.random() * (2 * Math.PI);
tween(dogFace, {
scaleX: chaosScale,
scaleY: chaosScale,
rotation: chaosRot
}, {
duration: 120,
easing: tween.cubicIn,
onFinish: function onFinish() {
tween(dogFace, {
scaleX: 1,
scaleY: 1,
rotation: 0
}, {
duration: 180,
easing: tween.cubicOut
});
}
});
// 6. Randomly move the fart button for a moment
var fartBtnOrigX = fartBtn.x;
var fartBtnOrigY = fartBtn.y;
var chaosBtnDX = -80 + Math.random() * 160;
var chaosBtnDY = -60 + Math.random() * 120;
tween(fartBtn, {
x: fartBtnOrigX + chaosBtnDX,
y: fartBtnOrigY + chaosBtnDY
}, {
duration: 90,
easing: tween.cubicIn,
onFinish: function onFinish() {
tween(fartBtn, {
x: fartBtnOrigX,
y: fartBtnOrigY
}, {
duration: 120,
easing: tween.cubicOut
});
}
});
// 7. Occasionally (10% chance) spawn a huge emoji in the center that fades out
if (Math.random() < 0.1) {
var bigEmoji = chaosEmojis[Math.floor(Math.random() * chaosEmojis.length)];
var bigEmojiTxt = new Text2(bigEmoji, {
size: 400 + Math.floor(Math.random() * 200),
fill: 0xffffff,
align: 'center'
});
bigEmojiTxt.anchor.set(0.5, 0.5);
bigEmojiTxt.x = 2048 / 2;
bigEmojiTxt.y = 2732 / 2;
bigEmojiTxt.alpha = 1;
game.addChild(bigEmojiTxt);
tween(bigEmojiTxt, {
alpha: 0,
scaleX: 2,
scaleY: 2
}, {
duration: 700,
easing: tween.cubicOut,
onFinish: function onFinish() {
if (bigEmojiTxt.parent) bigEmojiTxt.parent.removeChild(bigEmojiTxt);
}
});
}
} // End autism mode chaos effects
// --- MEGA FART SPECIAL EFFECTS ---
if (comboCount >= 100) {
// MEGA FART at 100+ combo!
LK.effects.flashScreen(0xffffff, 300);
createParticleExplosion(dogFace.x, dogFace.y, 0xffffff, 50);
addScreenShake(30);
// Bonus farts for mega combo
fartCount += 1000;
createFloatingText(dogFace.x, dogFace.y - 200, "MEGA FART BONUS!\n+1000 Farts!", 0xffffff);
// Dog reaction
if (!dogFace.speechBubble) {
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;
}
dogFace.speechBubble.setText("MEGA FART!!!\nI CAN'T TAKE IT!");
dogFace.speechBubble.alpha = 1;
tween(dogFace.speechBubble, {
alpha: 0
}, {
duration: 1500,
delay: 1000,
easing: tween.cubicIn
});
}
// Dog reacts
// --- Fun: Randomize dog face (normal, react, or silly) and rare golden fart event ---
var goldenFart = false;
if (Math.random() < 0.01) {
// 1% chance for golden fart
goldenFart = true;
fartCount += 1000;
// Golden fart effect: flash screen gold, show special text
LK.effects.flashScreen(0xffe066, 800);
if (!dogFace.speechBubble) {
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;
}
dogFace.speechBubble.setText("💛 GOLDEN FART! 💛\n+1000 Farts!");
dogFace.speechBubble.alpha = 1;
tween(dogFace.speechBubble, {
alpha: 0
}, {
duration: 1200,
delay: 800,
easing: tween.cubicIn
});
// Dog face flashes gold
tween(dogFace, {
alpha: 0.5
}, {
duration: 100,
yoyo: true,
repeat: 1,
onFinish: function onFinish() {
dogFace.alpha = 1;
}
});
} else {
// 10% chance for silly face (react stays longer)
if (Math.random() < 0.1) {
dogFace.showReact();
LK.setTimeout(function () {
dogFace.showNormal();
dogFace.x = 2048 / 2;
}, 1200);
} else {
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!",
// More synonyms
"Repugnant!", "Skunky!", "Malodorous!", "Putrescent!", "Fetid!", "Mephitic!", "Moldy!", "Dank!", "Manky!", "Cruddy!", "Crud!", "Yuuuck!", "Ew, dude!", "Stale!", "Funky town!", "Reek!", "Stale cheese!", "Cheesy!", "Mold!", "Ew, stinky!", "Ew, gross!", "Ew, nasty!", "Ew, barf!", "Ew, icky!", "Ew, yuck!", "Ew, blech!", "Ew, pew!", "Ew, phew!", "Ew, stank!", "Ew, rotten!", "Ew, rancid!", "Ew, vile!", "Ew, sick!", "Ew, odious!", "Ew, horrid!", "Ew, foul!", "Ew, revolting!", "Ew, repulsive!", "Ew, stench!", "Ew, noxious!", "Ew, obnoxious!", "Ew, gnarly!", "Ew, yowza!", "Ew, oof!", "Ew, yow!", "Ew, eek!", "Ew, yowch!", "Ew, ooze!", "Ew, funky!", "Ew, whew!", "Ew, gross-out!", "Ew, what is that?!", "Ew, oh no!", "Ew, why?!", "Ew, yeesh!", "Ew, yikes!", "Ew, cringe!", "Ew, gag!", "Ew, pungent!", "Ew, awful!", "Ew, stank!", "Ew, phew!", "Ew, barf!", "Ew, ick!", "Ew, putrid!", "Ew, rank!", "Ew, vile!", "Ew, sickening!", "Ew, odious!", "Ew, bleh!", "Ew, gross!", "Ew, stench!", "Ew, no way!", "Ew, yuck!", "Ew, ewww!", "Ew, blech!", "Ew, GROSS!", "Ew, yikes!", "Ew, cringe!", "Ew, gag!", "Ew, pungent!", "Ew, horrid!", "Ew, stench!", "Ew, what is that?!", "Ew, oh no!", "Ew, why?!", "Ew, yeesh!", "Ew, yikes!", "Ew, cringe!", "Ew, gag!", "Ew, pungent!", "Ew, awful!", "Ew, horrid!", "Ew, stench!", "Ew, what is that?!", "Ew, oh no!", "Ew, why?!", "Ew, ewww!", "Ew, yeesh!", "Ew, blech!", "Ew, GROSS!", "Ew, noxious!", "Ew, obnoxious!", "Ew, yowza!", "Ew, oof!", "Ew, gnar!", "Ew, yow!", "Ew, eek!", "Ew, yowch!", "Ew, ooze!", "Ew, funky!", "Ew, rancid!", "Ew, rotten!", "Ew, whew!", "Ew, stank!", "Ew, phew!", "Ew, 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;
// --- Fun: Rare rainbow fart event (0.5% chance) ---
if (Math.random() < 0.005) {
// Rainbow fart: flash screen rainbow, show rainbow text, dog face rainbow overlay
var rainbowColors = [0xff0000, 0xffa500, 0xffff00, 0x00ff00, 0x0000ff, 0x4b0082, 0xee82ee];
var idx = 0;
var _rainbowFlash = function rainbowFlash() {
if (idx >= rainbowColors.length) return;
LK.effects.flashScreen(rainbowColors[idx], 120);
idx++;
LK.setTimeout(_rainbowFlash, 120);
};
_rainbowFlash();
if (!dogFace.speechBubble) {
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;
}
dogFace.speechBubble.setText("🌈 RAINBOW FART! 🌈");
dogFace.speechBubble.alpha = 1;
tween(dogFace.speechBubble, {
alpha: 0
}, {
duration: 1200,
delay: 800,
easing: tween.cubicIn
});
// Rainbow overlay on dog face
if (!dogFace.rainbowOverlay) {
dogFace.rainbowOverlay = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 8,
scaleY: 8,
x: 0,
y: 0,
alpha: 0.4,
tint: 0xffffff
});
dogFace.addChild(dogFace.rainbowOverlay);
}
dogFace.rainbowOverlay.alpha = 0.7;
var rainbowIdx = 0;
var _rainbowTint = function rainbowTint() {
if (rainbowIdx >= rainbowColors.length) {
dogFace.rainbowOverlay.alpha = 0;
return;
}
dogFace.rainbowOverlay.tint = rainbowColors[rainbowIdx];
rainbowIdx++;
LK.setTimeout(_rainbowTint, 120);
};
_rainbowTint();
}
// Apply combo multiplier and power-up bonuses to fart gain calculation
var totalGain = fartPerClick * comboMultiplier;
// Double farts power-up
if (hasPowerUp('DOUBLE_FARTS')) {
totalGain *= 2;
}
// Mega combo power-up
if (hasPowerUp('MEGA_COMBO')) {
totalGain *= 1 + comboCount * 0.1;
}
fartCount += Math.floor(totalGain);
// Show floating score for big gains
if (totalGain > fartPerClick) {
createFloatingText(fartBtn.x - 150, fartBtn.y - 100, "+" + totalGain + " Farts!", 0x83de44);
}
// Trigger random power-up chance (2% base, increases with combo)
var powerUpChance = 0.02 + comboCount * 0.001;
if (Math.random() < powerUpChance) {
triggerRandomPowerUp();
}
// --- Fun: Every 17th fart, color strobe and screen flash for visual stimulation ---
// Only trigger this effect in autism mode!
if (autismMode && fartCount > 0 && fartCount % 17 === 0) {
// Color strobe on dog face
var strobeColors = [0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0xff00ff, 0x00ffff, 0xffffff];
var strobeIdx = 0;
var strobeMax = 7;
var strobeDogParts = [];
if (dogFace.children && dogFace.children.length > 0) {
for (var i = 0; i < dogFace.children.length; ++i) {
if (dogFace.children[i] && typeof dogFace.children[i].tint !== "undefined") {
strobeDogParts.push(dogFace.children[i]);
}
}
}
var strobeOriginalTints = [];
for (var i = 0; i < strobeDogParts.length; ++i) {
strobeOriginalTints.push(strobeDogParts[i].tint);
}
var _doStrobe = function doStrobe() {
// Check if autism mode is still active before continuing strobe
if (!autismMode || strobeIdx >= strobeMax) {
// Restore original tints
for (var i = 0; i < strobeDogParts.length; ++i) {
strobeDogParts[i].tint = strobeOriginalTints[i];
}
return;
}
var color = strobeColors[strobeIdx % strobeColors.length];
for (var i = 0; i < strobeDogParts.length; ++i) {
strobeDogParts[i].tint = color;
}
// Quick screen flash for extra stimulation
LK.effects.flashScreen(color, 60);
strobeIdx++;
LK.setTimeout(_doStrobe, 60);
};
_doStrobe();
}
// --- Fun: Every 33rd fart, dog face wiggles side to side ---
if (fartCount > 0 && fartCount % 33 === 0) {
var _doWiggle = function doWiggle() {
if (wiggleCount >= maxWiggles) {
dogFace.x = originalX;
return;
}
var offset = wiggleCount % 2 === 0 ? 40 : -40;
tween(dogFace, {
x: originalX + offset
}, {
duration: 60,
easing: tween.cubicIn,
onFinish: function onFinish() {
tween(dogFace, {
x: originalX
}, {
duration: 60,
easing: tween.cubicOut,
onFinish: function onFinish() {
wiggleCount++;
_doWiggle();
}
});
}
});
};
// Wiggle dog face left and right 4 times
var wiggleCount = 0;
var maxWiggles = 4;
var originalX = dogFace.x;
_doWiggle();
}
// --- Fun: Every 25th fart, dog face gets a random color for a while ---
if (fartCount > 0 && fartCount % 25 === 0) {
// Pick a fun random color (not too dark)
var funColors = [0xffb347, 0x7ec850, 0x4fc3f7, 0xf06292, 0xffeb3b, 0x9c27b0, 0xff5722, 0x00bcd4, 0x8bc34a, 0xe91e63];
var color = funColors[Math.floor(Math.random() * funColors.length)];
// Animate both faces if present
if (dogFace.children && dogFace.children.length > 0) {
for (var i = 0; i < dogFace.children.length; ++i) {
if (dogFace.children[i] && typeof dogFace.children[i].tint !== "undefined") {
var facePart = dogFace.children[i];
var oldTint = facePart.tint;
facePart.tint = color;
// Animate back to normal after 1.2s
LK.setTimeout(function (part, tint) {
return function () {
part.tint = tint;
};
}(facePart, oldTint), 1200);
}
}
}
}
// --- Fun: Every 50th fart, dog gets a random hat or glasses for a while ---
if (fartCount > 0 && fartCount % 50 === 0) {
if (!dogFace.accessory) {
dogFace.accessory = new Container();
dogFace.addChild(dogFace.accessory);
}
// Remove old accessory
dogFace.accessory.removeChildren();
var accType = Math.random() < 0.5 ? "hat" : "glasses";
if (accType === "hat") {
// Use person_phone as a silly hat
var hat = LK.getAsset('person_phone', {
anchorX: 0.5,
anchorY: 1,
scaleX: 2.2,
scaleY: 1.2,
x: 0,
y: -420,
tint: 0x7A5C00
});
dogFace.accessory.addChild(hat);
} else {
// Use person_leg as glasses
var glasses = LK.getAsset('person_leg', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.2,
scaleY: 0.4,
x: 0,
y: -120,
tint: 0x222222
});
dogFace.accessory.addChild(glasses);
}
// Remove accessory after 2 seconds
LK.setTimeout(function () {
if (dogFace.accessory) dogFace.accessory.removeChildren();
}, 2000);
}
// --- Fun: Every 99th fart, background color pulse for visual stimulation ---
if (fartCount > 0 && fartCount % 99 === 0) {
var bgPulseColors = [0xffe066, 0x7ec850, 0x4fc3f7, 0xf06292, 0xffeb3b, 0x9c27b0, 0xff5722, 0x00bcd4, 0x8bc34a, 0xe91e63];
var bgPulseIdx = 0;
var bgPulseMax = 8;
var originalBg = 0xE3F6FF;
var _doBgPulse = function doBgPulse() {
if (bgPulseIdx >= bgPulseMax) {
game.setBackgroundColor(originalBg);
return;
}
var color = bgPulseColors[bgPulseIdx % bgPulseColors.length];
game.setBackgroundColor(color);
bgPulseIdx++;
LK.setTimeout(_doBgPulse, 80);
};
_doBgPulse();
}
// --- Fun: Every 150th fart, dog face gets a random funny mustache for a while ---
if (fartCount > 0 && fartCount % 150 === 0) {
if (!dogFace.mustache) {
dogFace.mustache = new Container();
dogFace.addChild(dogFace.mustache);
}
// Remove old mustache
dogFace.mustache.removeChildren();
// Use person_leg as a mustache, randomize color and position
var mustacheColors = [0x222222, 0x7A5C00, 0x964B00, 0xFFD700, 0xC0C0C0];
var color = mustacheColors[Math.floor(Math.random() * mustacheColors.length)];
var mustache = LK.getAsset('person_leg', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.1 + Math.random() * 0.7,
scaleY: 0.35 + Math.random() * 0.2,
x: 0,
y: 120 + Math.random() * 30,
tint: color
});
dogFace.mustache.addChild(mustache);
// Remove mustache after 2.2 seconds
LK.setTimeout(function () {
if (dogFace.mustache) dogFace.mustache.removeChildren();
}, 2200);
}
// --- Fun: Every 77th fart, emoji rain for visual stimulation ---
if (fartCount > 0 && fartCount % 77 === 0) {
var emojiRainEmojis = ["🌈", "⭐", "💖", "✨", "🎉", "😃", "🐶", "🦄", "🍀", "🎈", "😺", "😎", "🥳", "😆", "😻"];
var emojiRainCount = 0;
var emojiRainMax = 18;
var _emojiRain = function emojiRain() {
if (emojiRainCount >= emojiRainMax) return;
var emoji = emojiRainEmojis[Math.floor(Math.random() * emojiRainEmojis.length)];
var emojiTxt = new Text2(emoji, {
size: 120 + Math.floor(Math.random() * 40),
fill: 0xffffff,
align: 'center'
});
emojiTxt.anchor.set(0.5, 0.5);
emojiTxt.x = 400 + Math.random() * (2048 - 800);
emojiTxt.y = -100;
emojiTxt.alpha = 1;
game.addChild(emojiTxt);
// Animate falling down
tween(emojiTxt, {
y: 2732 + 100,
alpha: 0.7 + Math.random() * 0.3
}, {
duration: 1200 + Math.random() * 400,
easing: tween.cubicIn,
onFinish: function onFinish() {
if (emojiTxt.parent) emojiTxt.parent.removeChild(emojiTxt);
}
});
emojiRainCount++;
LK.setTimeout(_emojiRain, 60);
};
_emojiRain();
}
// --- Fun: Every 75th fart, dog face flips upside down for a moment ---
if (fartCount > 0 && fartCount % 75 === 0) {
// Animate dog face rotation to upside down and back
tween(dogFace, {
rotation: Math.PI
}, {
duration: 220,
easing: tween.cubicIn,
onFinish: function onFinish() {
LK.setTimeout(function () {
tween(dogFace, {
rotation: 0
}, {
duration: 220,
easing: tween.cubicOut
});
}, 900);
}
});
}
// --- Fun: Every 333rd fart, dog face spins 360 degrees ---
if (fartCount > 0 && fartCount % 333 === 0) {
tween(dogFace, {
rotation: 2 * Math.PI
}, {
duration: 700,
easing: tween.cubicInOut,
onFinish: function onFinish() {
dogFace.rotation = 0;
}
});
}
updateUI();
// --- Fun: Every 111th fart, dog sneezes and face flashes white ---
if (fartCount > 0 && fartCount % 111 === 0) {
// Sneeze text
if (!dogFace.speechBubble) {
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;
}
dogFace.speechBubble.setText("ACHOO!");
dogFace.speechBubble.alpha = 1;
tween(dogFace.speechBubble, {
alpha: 0
}, {
duration: 900,
delay: 500,
easing: tween.cubicIn
});
// Face flashes white
for (var i = 0; i < dogFace.children.length; ++i) {
if (dogFace.children[i] && typeof dogFace.children[i].tint !== "undefined") {
var facePart = dogFace.children[i];
var oldTint = facePart.tint;
facePart.tint = 0xffffff;
LK.setTimeout(function (part, tint) {
return function () {
part.tint = tint;
};
}(facePart, oldTint), 400);
}
}
}
// --- Fun: Every 555th fart, dog face gets a random emoji sticker for a while ---
if (fartCount > 0 && fartCount % 555 === 0) {
if (!dogFace.sticker) {
dogFace.sticker = new Container();
dogFace.addChild(dogFace.sticker);
}
// Remove old sticker
dogFace.sticker.removeChildren();
// Pick a random emoji
var emojis = ["😂", "😎", "🤪", "😍", "😱", "🥳", "😜", "😇", "🤩", "😏", "😬", "😳", "😺", "🐶", "💩", "🌈", "🔥", "⭐", "🎉"];
var emoji = emojis[Math.floor(Math.random() * emojis.length)];
var stickerTxt = new Text2(emoji, {
size: 160 + Math.floor(Math.random() * 40),
fill: 0xffffff,
align: 'center'
});
stickerTxt.anchor.set(0.5, 0.5);
stickerTxt.x = -180 + Math.random() * 360;
stickerTxt.y = -180 + Math.random() * 360;
dogFace.sticker.addChild(stickerTxt);
// Remove sticker after 2.5 seconds
LK.setTimeout(function () {
if (dogFace.sticker) dogFace.sticker.removeChildren();
}, 2500);
}
// --- Fun: Every 444th fart, dog face grows and shrinks ---
if (fartCount > 0 && fartCount % 444 === 0) {
tween(dogFace, {
scaleX: 1.5,
scaleY: 1.5
}, {
duration: 180,
easing: tween.cubicOut,
onFinish: function onFinish() {
tween(dogFace, {
scaleX: 1,
scaleY: 1
}, {
duration: 180,
easing: tween.cubicIn
});
}
});
}
// --- Fun: Every 222nd fart, dog face bounces up and down ---
if (fartCount > 0 && fartCount % 222 === 0) {
var originalY = dogFace.y;
var bounceCount = 0;
var maxBounces = 4;
var _doBounce = function doBounce() {
if (bounceCount >= maxBounces) {
dogFace.y = originalY;
return;
}
var offset = bounceCount % 2 === 0 ? -60 : 60;
tween(dogFace, {
y: originalY + offset
}, {
duration: 70,
easing: tween.cubicIn,
onFinish: function onFinish() {
tween(dogFace, {
y: originalY
}, {
duration: 70,
easing: tween.cubicOut,
onFinish: function onFinish() {
bounceCount++;
_doBounce();
}
});
}
});
};
_doBounce();
}
// --- Fun: Every 200th fart, dog barks and screen shakes ---
if (fartCount > 0 && fartCount % 200 === 0) {
// Bark text
if (!dogFace.speechBubble) {
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;
}
dogFace.speechBubble.setText("🐶 WOOF! 🐶");
dogFace.speechBubble.alpha = 1;
tween(dogFace.speechBubble, {
alpha: 0
}, {
duration: 900,
delay: 500,
easing: tween.cubicIn
});
// Screen shake effect
var shakeTimes = 10;
var _shake = function shake(n) {
if (n <= 0) {
game.x = 0;
return;
}
game.x = n % 2 === 0 ? 20 : -20;
LK.setTimeout(function () {
_shake(n - 1);
}, 30);
};
_shake(shakeTimes);
}
// --- Achievements: First 100 Farts ---
if (!window._first100FartsShown && fartCount >= 100 && !isShowingAchievement) {
window._first100FartsShown = true;
isShowingAchievement = true;
// Show achievement popup
var achPopup = new Container();
var achBg = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.1,
scaleY: 1.1,
x: 2048 / 2,
y: 2732 / 2
});
achPopup.addChild(achBg);
var achTxt = new Text2('Achievement Unlocked!\nFirst 100 Farts!', {
size: 80,
fill: 0x7A5C00,
align: 'center'
});
achTxt.anchor.set(0.5, 0.5);
achTxt.x = 2048 / 2;
achTxt.y = 2732 / 2 - 40;
achPopup.addChild(achTxt);
var okBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.7,
x: 2048 / 2,
y: 2732 / 2 + 120
});
var okTxt = new Text2('OK', {
size: 70,
fill: 0x7A5C00
});
okTxt.anchor.set(0.5, 0.5);
okTxt.x = 0;
okTxt.y = 0;
okBtn.addChild(okTxt);
okBtn.interactive = true;
okBtn.down = function () {
game.removeChild(achPopup);
isShowingAchievement = false;
};
achPopup.addChild(okBtn);
game.addChild(achPopup);
LK.effects.flashObject(achBg, 0xfff7b2, 120);
}
// --- Achievements: 1000 Farts ---
if (!window._first1000FartsShown && fartCount >= 1000 && !isShowingAchievement) {
window._first1000FartsShown = true;
isShowingAchievement = true;
var achPopup = new Container();
var achBg = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.1,
scaleY: 1.1,
x: 2048 / 2,
y: 2732 / 2
});
achPopup.addChild(achBg);
var achTxt = new Text2('Achievement Unlocked!\n1000 Farts!\nDog is a Fart Legend!', {
size: 80,
fill: 0x7A5C00,
align: 'center'
});
achTxt.anchor.set(0.5, 0.5);
achTxt.x = 2048 / 2;
achTxt.y = 2732 / 2 - 40;
achPopup.addChild(achTxt);
var okBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.7,
x: 2048 / 2,
y: 2732 / 2 + 120
});
var okTxt = new Text2('OK', {
size: 70,
fill: 0x7A5C00
});
okTxt.anchor.set(0.5, 0.5);
okTxt.x = 0;
okTxt.y = 0;
okBtn.addChild(okTxt);
okBtn.interactive = true;
okBtn.down = function () {
game.removeChild(achPopup);
isShowingAchievement = false;
};
achPopup.addChild(okBtn);
game.addChild(achPopup);
LK.effects.flashObject(achBg, 0xfff7b2, 120);
}
// --- Achievements: 10,000 Farts ---
if (!window._first10kFartsShown && fartCount >= 10000 && !isShowingAchievement) {
window._first10kFartsShown = true;
isShowingAchievement = true;
var achPopup = new Container();
var achBg = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.1,
scaleY: 1.1,
x: 2048 / 2,
y: 2732 / 2
});
achPopup.addChild(achBg);
var achTxt = new Text2('Achievement Unlocked!\n10,000 Farts!\nDog is a Fart GOD!', {
size: 80,
fill: 0x7A5C00,
align: 'center'
});
achTxt.anchor.set(0.5, 0.5);
achTxt.x = 2048 / 2;
achTxt.y = 2732 / 2 - 40;
achPopup.addChild(achTxt);
var okBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.7,
x: 2048 / 2,
y: 2732 / 2 + 120
});
var okTxt = new Text2('OK', {
size: 70,
fill: 0x7A5C00
});
okTxt.anchor.set(0.5, 0.5);
okTxt.x = 0;
okTxt.y = 0;
okBtn.addChild(okTxt);
okBtn.interactive = true;
okBtn.down = function () {
game.removeChild(achPopup);
isShowingAchievement = false;
};
achPopup.addChild(okBtn);
game.addChild(achPopup);
LK.effects.flashObject(achBg, 0xfff7b2, 120);
}
// --- Achievements: 1,000,000 Farts ---
if (!window._first1MFartsShown && fartCount >= 1000000 && !isShowingAchievement) {
window._first1MFartsShown = true;
isShowingAchievement = true;
var achPopup = new Container();
var achBg = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.1,
scaleY: 1.1,
x: 2048 / 2,
y: 2732 / 2
});
achPopup.addChild(achBg);
var achTxt = new Text2('Achievement Unlocked!\n1,000,000 Farts!\nDog Ascends to Fart Heaven!', {
size: 80,
fill: 0x7A5C00,
align: 'center'
});
achTxt.anchor.set(0.5, 0.5);
achTxt.x = 2048 / 2;
achTxt.y = 2732 / 2 - 40;
achPopup.addChild(achTxt);
var okBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.7,
x: 2048 / 2,
y: 2732 / 2 + 120
});
var okTxt = new Text2('OK', {
size: 70,
fill: 0x7A5C00
});
okTxt.anchor.set(0.5, 0.5);
okTxt.x = 0;
okTxt.y = 0;
okBtn.addChild(okTxt);
okBtn.interactive = true;
okBtn.down = function () {
game.removeChild(achPopup);
isShowingAchievement = false;
};
achPopup.addChild(okBtn);
game.addChild(achPopup);
LK.effects.flashObject(achBg, 0xfff7b2, 120);
}
// --- Fun: Achievement for buying Chris the Cat ---
if (!window._chrisCatAchievement && chrisCatSpawned && !isShowingAchievement) {
window._chrisCatAchievement = true;
isShowingAchievement = true;
var achPopup = new Container();
var achBg = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.1,
scaleY: 1.1,
x: 2048 / 2,
y: 2732 / 2
});
achPopup.addChild(achBg);
var achTxt = new Text2('Achievement Unlocked!\nChris the Cat!\nFeline Fart Power!', {
size: 80,
fill: 0x7A5C00,
align: 'center'
});
achTxt.anchor.set(0.5, 0.5);
achTxt.x = 2048 / 2;
achTxt.y = 2732 / 2 - 40;
achPopup.addChild(achTxt);
var okBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.7,
x: 2048 / 2,
y: 2732 / 2 + 120
});
var okTxt = new Text2('OK', {
size: 70,
fill: 0x7A5C00
});
okTxt.anchor.set(0.5, 0.5);
okTxt.x = 0;
okTxt.y = 0;
okBtn.addChild(okTxt);
okBtn.interactive = true;
okBtn.down = function () {
game.removeChild(achPopup);
isShowingAchievement = false;
};
achPopup.addChild(okBtn);
game.addChild(achPopup);
LK.effects.flashObject(achBg, 0xfff7b2, 120);
}
// --- Fun: Achievement for buying John the Booster ---
if (!window._johnAchievement && johnSpawned && !isShowingAchievement) {
window._johnAchievement = true;
isShowingAchievement = true;
var achPopup = new Container();
var achBg = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.1,
scaleY: 1.1,
x: 2048 / 2,
y: 2732 / 2
});
achPopup.addChild(achBg);
var achTxt = new Text2('Achievement Unlocked!\nJohn the Booster!\nFart Power Overload!', {
size: 80,
fill: 0x7A5C00,
align: 'center'
});
achTxt.anchor.set(0.5, 0.5);
achTxt.x = 2048 / 2;
achTxt.y = 2732 / 2 - 40;
achPopup.addChild(achTxt);
var okBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.7,
x: 2048 / 2,
y: 2732 / 2 + 120
});
var okTxt = new Text2('OK', {
size: 70,
fill: 0x7A5C00
});
okTxt.anchor.set(0.5, 0.5);
okTxt.x = 0;
okTxt.y = 0;
okBtn.addChild(okTxt);
okBtn.interactive = true;
okBtn.down = function () {
game.removeChild(achPopup);
isShowingAchievement = false;
};
achPopup.addChild(okBtn);
game.addChild(achPopup);
LK.effects.flashObject(achBg, 0xfff7b2, 120);
}
};
// 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!",
// More synonyms
"Repugnant!", "Skunky!", "Malodorous!", "Putrescent!", "Fetid!", "Mephitic!", "Moldy!", "Dank!", "Manky!", "Cruddy!", "Crud!", "Yuuuck!", "Ew, dude!", "Stale!", "Funky town!", "Reek!", "Stale cheese!", "Cheesy!", "Mold!", "Ew, stinky!", "Ew, gross!", "Ew, nasty!", "Ew, barf!", "Ew, icky!", "Ew, yuck!", "Ew, blech!", "Ew, pew!", "Ew, phew!", "Ew, stank!", "Ew, rotten!", "Ew, rancid!", "Ew, vile!", "Ew, sick!", "Ew, odious!", "Ew, horrid!", "Ew, foul!", "Ew, revolting!", "Ew, repulsive!", "Ew, stench!", "Ew, noxious!", "Ew, obnoxious!", "Ew, gnarly!", "Ew, yowza!", "Ew, oof!", "Ew, yow!", "Ew, eek!", "Ew, yowch!", "Ew, ooze!", "Ew, funky!", "Ew, whew!", "Ew, gross-out!", "Ew, what is that?!", "Ew, oh no!", "Ew, why?!", "Ew, yeesh!", "Ew, yikes!", "Ew, cringe!", "Ew, gag!", "Ew, pungent!", "Ew, awful!", "Ew, stank!", "Ew, phew!", "Ew, barf!", "Ew, ick!", "Ew, putrid!", "Ew, rank!", "Ew, vile!", "Ew, sickening!", "Ew, odious!", "Ew, bleh!", "Ew, gross!", "Ew, stench!", "Ew, no way!", "Ew, yuck!", "Ew, ewww!", "Ew, blech!", "Ew, GROSS!", "Ew, yikes!", "Ew, cringe!", "Ew, gag!", "Ew, pungent!", "Ew, horrid!", "Ew, stench!", "Ew, what is that?!", "Ew, oh no!", "Ew, why?!", "Ew, yeesh!", "Ew, yikes!", "Ew, cringe!", "Ew, gag!", "Ew, pungent!", "Ew, awful!", "Ew, horrid!", "Ew, stench!", "Ew, what is that?!", "Ew, oh no!", "Ew, why?!", "Ew, ewww!", "Ew, yeesh!", "Ew, blech!", "Ew, GROSS!", "Ew, noxious!", "Ew, obnoxious!", "Ew, yowza!", "Ew, oof!", "Ew, gnar!", "Ew, yow!", "Ew, eek!", "Ew, yowch!", "Ew, ooze!", "Ew, funky!", "Ew, rancid!", "Ew, rotten!", "Ew, whew!", "Ew, stank!", "Ew, phew!", "Ew, 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 ---;
// --- Achievements List UI ---
// Define all achievements with their unlock condition and description
var achievements = [{
key: "first100Farts",
name: "First 100 Farts",
desc: "Reach 100 farts.",
unlocked: function unlocked() {
return fartCount >= 100 || !!window._first100FartsShown;
}
}, {
key: "first1000Farts",
name: "Fart Legend",
desc: "Reach 1,000 farts.",
unlocked: function unlocked() {
return fartCount >= 1000 || !!window._first1000FartsShown;
}
}, {
key: "first10kFarts",
name: "Fart GOD",
desc: "Reach 10,000 farts.",
unlocked: function unlocked() {
return fartCount >= 10000 || !!window._first10kFartsShown;
}
}, {
key: "first1MFarts",
name: "Fart Heaven",
desc: "Reach 1,000,000 farts.",
unlocked: function unlocked() {
return fartCount >= 1000000 || !!window._first1MFartsShown;
}
}, {
key: "dogTeleport",
name: "Dog Teleport",
desc: "Make the dog run away (hit left edge).",
unlocked: function unlocked() {
return !!window._firstDogTeleport;
}
}, {
key: "chrisCat",
name: "Chris the Cat",
desc: "Buy Chris the Cat upgrade.",
unlocked: function unlocked() {
return chrisCatSpawned || !!window._chrisCatAchievement;
}
}, {
key: "johnBooster",
name: "John the Booster",
desc: "Buy John the Booster upgrade.",
unlocked: function unlocked() {
return johnSpawned || !!window._johnAchievement;
}
}];
// Achievements list popup container (hidden by default)
var achievementsPopup = null;
// Achievements button (bottom left, out of dog's way)
var achievementsBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.6,
scaleY: 0.6,
x: 180,
y: 2732 - 220
});
var achievementsBtnTxt = new Text2('Achievements', {
size: 54,
fill: 0x7A5C00
});
achievementsBtnTxt.anchor.set(0.5, 0.5);
achievementsBtnTxt.x = 0;
achievementsBtnTxt.y = 0;
achievementsBtn.addChild(achievementsBtnTxt);
achievementsBtn.interactive = true;
game.addChild(achievementsBtn);
// Show/hide achievements popup
achievementsBtn.down = function () {
if (isShowingAchievement) {
return;
}
if (achievementsPopup && achievementsPopup.parent) {
game.removeChild(achievementsPopup);
return;
}
if (achievementsPopup) {
game.addChild(achievementsPopup);
updateAchievementsList();
return;
}
// Create popup
achievementsPopup = new Container();
var bg = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2.2,
scaleY: 2.7,
x: 2048 / 2,
y: 2732 / 2
});
achievementsPopup.addChild(bg);
var title = new Text2('Achievements', {
size: 90,
fill: 0x7A5C00,
align: 'center'
});
title.anchor.set(0.5, 0);
title.x = 2048 / 2;
title.y = 2732 / 2 - 540;
achievementsPopup.addChild(title);
// --- SCROLLABLE LIST CONTAINER ---
var listContainer = new Container();
listContainer.x = 0;
listContainer.y = 0;
achievementsPopup.addChild(listContainer);
// List container Y start and row height
var listY = 2732 / 2 - 400;
var rowHeight = 120;
achievementsPopup.achRows = [];
for (var i = 0; i < achievements.length; ++i) {
var ach = achievements[i];
var row = new Container();
row.x = 2048 / 2 - 500;
row.y = listY + i * rowHeight;
var status = new Text2('', {
size: 60,
fill: 0x7A5C00
});
status.anchor.set(0, 0.5);
status.x = 0;
status.y = 0;
row.status = status;
row.addChild(status);
var name = new Text2(ach.name, {
size: 60,
fill: 0x222222
});
name.anchor.set(0, 0.5);
name.x = 90;
name.y = 0;
row.addChild(name);
var desc = new Text2(ach.desc, {
size: 38,
fill: 0x444444
});
desc.anchor.set(0, 0.5);
desc.x = 90;
desc.y = 38;
row.addChild(desc);
listContainer.addChild(row);
achievementsPopup.achRows.push(row);
}
// --- SCROLL LOGIC ---
var maxVisibleRows = 7;
var totalRows = achievements.length;
var visibleHeight = maxVisibleRows * rowHeight;
var minY = listY;
var maxY = listY + Math.max(0, (totalRows - maxVisibleRows) * rowHeight);
listContainer.y = 0;
achievementsPopup._scrollOffset = 0;
achievementsPopup._dragStartY = null;
achievementsPopup._dragLastY = null;
achievementsPopup.interactive = true;
achievementsPopup.down = function (x, y, obj) {
achievementsPopup._dragStartY = y;
achievementsPopup._dragLastY = y;
achievementsPopup._startScrollOffset = achievementsPopup._scrollOffset;
};
achievementsPopup.move = function (x, y, obj) {
if (achievementsPopup._dragStartY !== null) {
var dy = y - achievementsPopup._dragLastY;
achievementsPopup._dragLastY = y;
achievementsPopup._scrollOffset += dy;
// Clamp scroll
if (achievementsPopup._scrollOffset > 0) achievementsPopup._scrollOffset = 0;
if (achievementsPopup._scrollOffset < -(maxY - minY)) achievementsPopup._scrollOffset = -(maxY - minY);
listContainer.y = achievementsPopup._scrollOffset;
}
};
achievementsPopup.up = function (x, y, obj) {
achievementsPopup._dragStartY = null;
achievementsPopup._dragLastY = null;
};
// Close button
var closeBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.7,
x: 2048 / 2,
y: 2732 / 2 + 600
});
var closeTxt = new Text2('Close', {
size: 70,
fill: 0x7A5C00
});
closeTxt.anchor.set(0.5, 0.5);
closeTxt.x = 0;
closeTxt.y = 0;
closeBtn.addChild(closeTxt);
closeBtn.interactive = true;
closeBtn.down = function () {
game.removeChild(achievementsPopup);
isShowingAchievement = false;
};
achievementsPopup.addChild(closeBtn);
game.addChild(achievementsPopup);
isShowingAchievement = true;
updateAchievementsList();
};
// Helper to update achievements list UI
function updateAchievementsList() {
if (!achievementsPopup || !achievementsPopup.achRows) return;
for (var i = 0; i < achievements.length; ++i) {
var ach = achievements[i];
var row = achievementsPopup.achRows[i];
// Remove old background if present
if (row.achBg) {
row.removeChild(row.achBg);
row.achBg = null;
}
// Add red square background behind status icon
var achBg = LK.getAsset('person_leg', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.2,
scaleY: 1.2,
x: 30,
y: 0,
tint: 0xd83318 // strong red
});
row.addChildAt(achBg, 0);
row.achBg = achBg;
if (ach.unlocked()) {
row.status.setText("✔️");
row.status.fill = 0x83de44;
row.alpha = 1;
} else {
row.status.setText("❌");
row.status.fill = 0xcd544e;
row.alpha = 0.5;
}
}
}
// Update achievements list UI whenever UI updates
var _oldUpdateUI_ach = updateUI;
updateUI = function updateUI() {
_oldUpdateUI_ach();
updateAchievementsList();
};
// --- Update Log Button and Popup ---
var updateLogBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.6,
scaleY: 0.6,
x: 2048 - 180,
// Bottom right, near share button
y: 2732 - 220
});
var updateLogBtnTxt = new Text2('Update Log', {
size: 54,
fill: 0x7A5C00
});
updateLogBtnTxt.anchor.set(0.5, 0.5);
updateLogBtnTxt.x = 0;
updateLogBtnTxt.y = 0;
updateLogBtn.addChild(updateLogBtnTxt);
updateLogBtn.interactive = true;
game.addChild(updateLogBtn);
var updateLogPopup = null;
var updateLogEntries = ["v1.0: Initial Release!", "v1.1: Added dog reactions and fart sound.", "v1.2: Implemented basic clicker functionality.", "v1.3: Added fart button and UI.", "v1.4: Added sliding dog and teleport.", "v1.5: Added Person standing and recording.", "v1.6: Introduced achievements.", "v1.7: Added particle system and floating text.", "v1.8: Added combo system and UI.", "v1.9: Implemented screen shake.", "v2.0: Added Mega Fart special effect.", "v2.1: Introduced power-up system.", "v2.2: Added daily reward.", "v2.3: Implemented upgrade shop.", "v2.4: Added Auto Clicker upgrades.", "v2.5: Added Chris the Cat upgrade and special effect.", "v2.6: Added John the Booster upgrade and effect.", "v2.7: Added Autism Mode with chaos effects.", "v2.8: Added social share/viral challenge popup.", "v2.9: Added achievement list UI.", "v3.0: Minor bug fixes and performance improvements."];
updateLogBtn.down = function () {
if (updateLogPopup && updateLogPopup.parent) {
game.removeChild(updateLogPopup);
return;
}
if (updateLogPopup) {
game.addChild(updateLogPopup);
return;
}
updateLogPopup = new Container();
var bg = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2.2,
scaleY: 2.7,
x: 2048 / 2,
y: 2732 / 2
});
updateLogPopup.addChild(bg);
var title = new Text2('Update Log', {
size: 90,
fill: 0x7A5C00,
align: 'center'
});
title.anchor.set(0.5, 0);
title.x = 2048 / 2;
title.y = 2732 / 2 - 540;
updateLogPopup.addChild(title);
// --- SCROLLABLE LIST CONTAINER ---
var listContainer = new Container();
listContainer.x = 2048 / 2 - 500; // Align left edge of the text
listContainer.y = 2732 / 2 - 400;
updateLogPopup.addChild(listContainer);
var rowHeight = 60; // Smaller row height for log entries
updateLogPopup.logRows = [];
for (var i = 0; i < updateLogEntries.length; ++i) {
var entry = updateLogEntries[i];
var row = new Container();
row.y = i * rowHeight;
var entryTxt = new Text2(entry, {
size: 54,
fill: 0x222222,
align: 'left'
});
entryTxt.anchor.set(0, 0.5); // Anchor left center
entryTxt.x = 0;
entryTxt.y = 0;
row.addChild(entryTxt);
listContainer.addChild(row);
updateLogPopup.logRows.push(row);
}
// --- SCROLL LOGIC ---
var maxVisibleRows = 10; // Adjust based on the log length
var totalRows = updateLogEntries.length;
var visibleHeight = maxVisibleRows * rowHeight;
var minY = 2732 / 2 - 400; // Start Y of the list container
var maxY = minY + Math.max(0, (totalRows - maxVisibleRows) * rowHeight);
updateLogPopup._scrollOffset = 0;
updateLogPopup._dragStartY = null;
updateLogPopup._dragLastY = null;
updateLogPopup.interactive = true;
// Use the popup's interactive area for dragging
updateLogPopup.down = function (x, y, obj) {
// Convert global tap coordinates to local popup coordinates
var localPos = updateLogPopup.toLocal({
x: x,
y: y
});
updateLogPopup._dragStartY = localPos.y;
updateLogPopup._dragLastY = localPos.y;
updateLogPopup._startScrollOffset = listContainer.y; // Use listContainer.y for scroll offset
};
updateLogPopup.move = function (x, y, obj) {
if (updateLogPopup._dragStartY !== null) {
// Convert global drag coordinates to local popup coordinates
var localPos = updateLogPopup.toLocal({
x: x,
y: y
});
var dy = localPos.y - updateLogPopup._dragLastY;
updateLogPopup._dragLastY = localPos.y;
listContainer.y += dy;
// Clamp scroll
if (listContainer.y > minY) listContainer.y = minY; // Clamp to the initial Y
if (listContainer.y < minY - (totalRows * rowHeight - visibleHeight)) {
listContainer.y = minY - (totalRows * rowHeight - visibleHeight);
}
// If total rows are less than visible rows, don't allow scrolling below initial position
if (totalRows <= maxVisibleRows) {
if (listContainer.y < minY) listContainer.y = minY;
}
}
};
updateLogPopup.up = function (x, y, obj) {
updateLogPopup._dragStartY = null;
updateLogPopup._dragLastY = null;
};
// Close button
var closeBtn = LK.getAsset('fart_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.7,
scaleY: 0.7,
x: 2048 / 2,
y: 2732 / 2 + 600
});
var closeTxt = new Text2('Close', {
size: 70,
fill: 0x7A5C00
});
closeTxt.anchor.set(0.5, 0.5);
closeTxt.x = 0;
closeTxt.y = 0;
closeBtn.addChild(closeTxt);
closeBtn.interactive = true;
closeBtn.down = function () {
game.removeChild(updateLogPopup);
};
updateLogPopup.addChild(closeBtn);
game.addChild(updateLogPopup);
}; ===================================================================
--- original.js
+++ change.js
@@ -2165,56 +2165,8 @@
achPopup.addChild(okBtn);
game.addChild(achPopup);
LK.effects.flashObject(achBg, 0xfff7b2, 120);
}
- // --- Fun: Achievement for first time dog hits left edge (teleport) ---
- if (!window._firstDogTeleport && dogFace.lastX > 120 && dogFace.x <= 120 && !isShowingAchievement) {
- window._firstDogTeleport = true;
- isShowingAchievement = true;
- var achPopup = new Container();
- var achBg = LK.getAsset('fart_btn', {
- anchorX: 0.5,
- anchorY: 0.5,
- scaleX: 1.1,
- scaleY: 1.1,
- x: 2048 / 2,
- y: 2732 / 2
- });
- achPopup.addChild(achBg);
- var achTxt = new Text2('Achievement Unlocked!\nDog Teleport!\nYou made the dog run away!', {
- size: 80,
- fill: 0x7A5C00,
- align: 'center'
- });
- achTxt.anchor.set(0.5, 0.5);
- achTxt.x = 2048 / 2;
- achTxt.y = 2732 / 2 - 40;
- achPopup.addChild(achTxt);
- var okBtn = LK.getAsset('fart_btn', {
- anchorX: 0.5,
- anchorY: 0.5,
- scaleX: 0.7,
- scaleY: 0.7,
- x: 2048 / 2,
- y: 2732 / 2 + 120
- });
- var okTxt = new Text2('OK', {
- size: 70,
- fill: 0x7A5C00
- });
- okTxt.anchor.set(0.5, 0.5);
- okTxt.x = 0;
- okTxt.y = 0;
- okBtn.addChild(okTxt);
- okBtn.interactive = true;
- okBtn.down = function () {
- game.removeChild(achPopup);
- isShowingAchievement = false;
- };
- achPopup.addChild(okBtn);
- game.addChild(achPopup);
- LK.effects.flashObject(achBg, 0xfff7b2, 120);
- }
// --- Fun: Achievement for buying Chris the Cat ---
if (!window._chrisCatAchievement && chrisCatSpawned && !isShowingAchievement) {
window._chrisCatAchievement = true;
isShowingAchievement = true;