/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Achievement = Container.expand(function (achievementData) { var self = Container.call(this); var badgeGraphics = self.attachAsset('achievementBadge', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8 }); self.achievementData = achievementData; var nameText = new Text2(achievementData.name, { size: 30, fill: 0xFFFFFF }); nameText.anchor.set(0.5, 0.5); nameText.y = 60; self.addChild(nameText); var progressText = new Text2('0/' + achievementData.target, { size: 26, fill: 0xCCCCCC }); progressText.anchor.set(0.5, 0.5); progressText.y = 85; self.addChild(progressText); self.updateProgress = function () { var progress = Math.min(achievementData.current, achievementData.target); progressText.setText(progress + '/' + achievementData.target); if (achievementData.completed && !achievementData.claimed) { badgeGraphics.tint = 0xFFD700; // Gold when ready to claim tween(badgeGraphics, { rotation: badgeGraphics.rotation + Math.PI * 2 }, { duration: 2000, easing: tween.linear }); } else if (achievementData.claimed) { badgeGraphics.tint = 0x888888; // Gray when claimed } else { badgeGraphics.tint = 0xFFFFFF; // White when in progress } }; self.down = function (x, y, obj) { if (achievementData.completed && !achievementData.claimed) { claimAchievement(achievementData); } }; return self; }); var BoostButton = Container.expand(function (boostData) { var self = Container.call(this); var buttonGraphics = self.attachAsset('boostButton', { anchorX: 0.5, anchorY: 0.5 }); self.boostData = boostData; var nameText = new Text2(boostData.name, { size: 40, fill: 0xFFFFFF }); nameText.anchor.set(0.5, 0.5); nameText.y = -15; self.addChild(nameText); var costText = new Text2('Cost: ' + boostData.cost, { size: 30, fill: 0xFFFF00 }); costText.anchor.set(0.5, 0.5); costText.y = 15; self.addChild(costText); self.updateDisplay = function () { if (points >= boostData.cost && !activeBoosts[boostData.type]) { buttonGraphics.tint = 0xFFFFFF; } else { buttonGraphics.tint = 0x666666; } if (activeBoosts[boostData.type]) { var timeLeft = Math.ceil((activeBoosts[boostData.type].endTime - Date.now()) / 1000); costText.setText('Active: ' + timeLeft + 's'); } else { costText.setText('Cost: ' + boostData.cost); } }; self.down = function (x, y, obj) { if (points >= boostData.cost && !activeBoosts[boostData.type]) { points -= boostData.cost; activateBoost(boostData); updateUI(); saveGame(); } }; return self; }); var BreathingGuide = Container.expand(function () { var self = Container.call(this); var guideGraphics = self.attachAsset('multiplierOrb', { anchorX: 0.5, anchorY: 0.5, alpha: 0.3, scaleX: 2, scaleY: 2 }); guideGraphics.tint = 0xE6E6FA; // Lavender for calming effect var breathingText = new Text2('Breathe with the circle', { size: 36, fill: 0xF0F8FF }); breathingText.anchor.set(0.5, 0.5); breathingText.y = -150; self.addChild(breathingText); self.breathingCycle = 0; self.isBreathingIn = true; self.startBreathingGuide = function () { // 4-7-8 breathing technique: inhale 4, hold 7, exhale 8 if (self.isBreathingIn) { breathingText.setText('Breathe In Slowly...'); // Use seasonal colors if available var currentTheme = seasonalThemes && seasonalThemes[seasonalThemeIndex] ? seasonalThemes[seasonalThemeIndex] : null; breathingText.tint = currentTheme ? currentTheme.colors[0] : 0x98FB98; guideGraphics.tint = currentTheme ? currentTheme.colors[1] : 0xE6E6FA; tween(guideGraphics, { scaleX: 4, scaleY: 4, alpha: 0.6 }, { duration: 4000, easing: tween.easeInOut, onFinish: function onFinish() { breathingText.setText('Hold...'); breathingText.tint = currentTheme ? currentTheme.colors[2] : 0xFFE4B5; LK.setTimeout(function () { self.isBreathingIn = false; self.startBreathingGuide(); }, 7000); } }); } else { breathingText.setText('Breathe Out Slowly...'); var currentTheme = seasonalThemes && seasonalThemes[seasonalThemeIndex] ? seasonalThemes[seasonalThemeIndex] : null; breathingText.tint = currentTheme ? currentTheme.colors[1] : 0x87CEEB; tween(guideGraphics, { scaleX: 2, scaleY: 2, alpha: 0.2 }, { duration: 8000, easing: tween.easeInOut, onFinish: function onFinish() { self.isBreathingIn = true; self.breathingCycle++; // Track completed breathing cycles // Update mindfulness achievement if (typeof mindfulnessAchievements !== 'undefined') { mindfulnessAchievements[0].current++; storage.mindful_breathing = mindfulnessAchievements[0].current; } self.startBreathingGuide(); } }); } }; return self; }); var ChaosPortal = Container.expand(function () { var self = Container.call(this); var portalGraphics = self.attachAsset('multiplierOrb', { anchorX: 0.5, anchorY: 0.5, alpha: 0.7, scaleX: 2, scaleY: 2 }); portalGraphics.tint = 0x800080; self.spawnTimer = 0; self.rotation = 0; self.update = function () { self.rotation += 0.1; portalGraphics.rotation = self.rotation; portalGraphics.scaleX = 2 + Math.sin(self.rotation * 2) * 0.5; portalGraphics.scaleY = 2 + Math.cos(self.rotation * 2) * 0.5; self.spawnTimer++; if (self.spawnTimer >= 60) { self.spawnTimer = 0; var chaosEffect = new ExplodingClickEffect(); chaosEffect.x = self.x + (Math.random() - 0.5) * 200; chaosEffect.y = self.y + (Math.random() - 0.5) * 200; game.addChild(chaosEffect); } }; return self; }); var ChaoticBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('gunBarrel', { anchorX: 0.5, anchorY: 0.5 }); bulletGraphics.tint = 0xFF0000; self.angle = 0; self.speed = 5; self.life = 300; self.bounces = 0; self.update = function () { self.x += Math.cos(self.angle) * self.speed; self.y += Math.sin(self.angle) * self.speed; self.life--; bulletGraphics.rotation += 0.2; if (self.x < 0 || self.x > 2048 || self.y < 0 || self.y > 2732) { if (self.bounces < 3) { if (self.x < 0 || self.x > 2048) { self.angle = Math.PI - self.angle; } if (self.y < 0 || self.y > 2732) { self.angle = -self.angle; } self.bounces++; self.x = Math.max(0, Math.min(2048, self.x)); self.y = Math.max(0, Math.min(2732, self.y)); } else { self.destroy(); } } if (self.life <= 0) { self.destroy(); } }; return self; }); var ChaoticDogWithGun = Container.expand(function () { var self = Container.call(this); var dogGraphics = self.attachAsset('dogWithGun', { anchorX: 0.5, anchorY: 0.5 }); self.ammo = 100; self.isShootingMode = false; self.shootCooldown = 0; self.randomMovement = 0; self.craziness = 1; self.startChaos = function () { self.isShootingMode = true; // Wild spinning animation tween(dogGraphics, { rotation: dogGraphics.rotation + Math.PI * 8 }, { duration: 3000, easing: tween.linear, onFinish: function onFinish() { self.startChaos(); } }); }; self.shootBullet = function () { if (self.ammo > 0 && self.shootCooldown <= 0) { var bullet = new ChaoticBullet(); bullet.x = self.x; bullet.y = self.y; bullet.angle = Math.random() * Math.PI * 2; bullet.speed = 3 + Math.random() * 5; chaoticBullets.push(bullet); game.addChild(bullet); self.ammo--; self.shootCooldown = 5 + Math.random() * 10; LK.getSound('click').play(); } }; self.update = function () { if (self.shootCooldown > 0) { self.shootCooldown--; } self.randomMovement += 0.1; self.x += Math.sin(self.randomMovement) * self.craziness; self.y += Math.cos(self.randomMovement * 0.7) * self.craziness; self.craziness = Math.min(10, self.craziness + 0.01); if (self.isShootingMode && Math.random() < 0.3) { self.shootBullet(); } }; self.down = function (x, y, obj) { self.startChaos(); self.ammo = 100; LK.effects.flashScreen(0xFF0000, 200); }; return self; }); var ClickEffect = Container.expand(function () { var self = Container.call(this); var effectGraphics = self.attachAsset('clickEffect', { anchorX: 0.5, anchorY: 0.5, alpha: 0.4, scaleX: 0.3, scaleY: 0.3 }); // Soft zen colors for click effects var zenClickColors = [0xE6E6FA, 0xF0F8FF, 0x98FB98, 0x87CEEB, 0xDDA0DD]; effectGraphics.tint = zenClickColors[Math.floor(Math.random() * zenClickColors.length)]; self.animate = function () { // Gentler, more peaceful click animation tween(effectGraphics, { scaleX: 2.2, scaleY: 2.2, alpha: 0 }, { duration: 800, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); // Add gentle rotation for extra zen effect tween(effectGraphics, { rotation: effectGraphics.rotation + Math.PI * 0.5 }, { duration: 800, easing: tween.easeInOut }); }; return self; }); var ClickPowerUp = Container.expand(function (powerUpType) { var self = Container.call(this); self.powerUpType = powerUpType; self.duration = 0; self.multiplier = 1; var powerUpGraphics = self.attachAsset('multiplierOrb', { anchorX: 0.5, anchorY: 0.5, alpha: 0.8, scaleX: 0.6, scaleY: 0.6 }); // Different colors for different power-ups var powerUpColors = { 'speed': 0x00FFFF, // Cyan for speed boost 'critical': 0xFF6B35, // Orange for critical boost 'mega': 0xFF1493, // Deep pink for mega clicks 'combo': 0x32CD32 // Lime green for combo extend }; powerUpGraphics.tint = powerUpColors[powerUpType] || 0xFFFFFF; var timerText = new Text2('', { size: 20, fill: 0xFFFFFF }); timerText.anchor.set(0.5, 0.5); timerText.y = 50; self.addChild(timerText); self.activate = function (duration, multiplier) { self.duration = duration; self.multiplier = multiplier; // Pulsing animation self.startPulse(); }; self.startPulse = function () { tween(powerUpGraphics, { scaleX: 0.8, scaleY: 0.8, alpha: 1 }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { tween(powerUpGraphics, { scaleX: 0.6, scaleY: 0.6, alpha: 0.8 }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { if (self.duration > 0) { self.startPulse(); } } }); } }); }; self.update = function () { if (self.duration > 0) { self.duration--; var seconds = Math.ceil(self.duration / 60); timerText.setText(seconds + 's'); if (self.duration <= 0) { self.expire(); } } }; self.expire = function () { // Fade out animation tween(self, { alpha: 0, scaleX: 0.3, scaleY: 0.3 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); var ComboDisplay = Container.expand(function () { var self = Container.call(this); var comboText = new Text2('', { size: 64, fill: 0xFFD700 }); comboText.anchor.set(0.5, 0.5); self.addChild(comboText); var multiplierText = new Text2('', { size: 48, fill: 0xFF6B35 }); multiplierText.anchor.set(0.5, 0.5); multiplierText.y = 60; self.addChild(multiplierText); self.showCombo = function (combo, multiplier) { comboText.setText('COMBO x' + combo); multiplierText.setText(multiplier.toFixed(1) + 'x BONUS!'); // Scale up animation comboText.scaleX = 0.5; comboText.scaleY = 0.5; multiplierText.scaleX = 0.5; multiplierText.scaleY = 0.5; tween(comboText, { scaleX: 1.2, scaleY: 1.2 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(comboText, { scaleX: 1, scaleY: 1 }, { duration: 100, easing: tween.easeOut }); } }); tween(multiplierText, { scaleX: 1.1, scaleY: 1.1 }, { duration: 250, easing: tween.easeOut, onFinish: function onFinish() { tween(multiplierText, { scaleX: 1, scaleY: 1 }, { duration: 150, easing: tween.easeOut }); } }); // Color flash effect if (combo >= 50) { comboText.tint = 0xFF1493; // Mega combo - hot pink } else if (combo >= 25) { comboText.tint = 0xFF6B35; // Super combo - orange } else if (combo >= 10) { comboText.tint = 0xFFD700; // Good combo - gold } }; self.hide = function () { tween(self, { alpha: 0, scaleX: 0.5, scaleY: 0.5 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); var CriticalHit = Container.expand(function () { var self = Container.call(this); var criticalText = new Text2('CRITICAL!', { size: 72, fill: 0xFF1493 }); criticalText.anchor.set(0.5, 0.5); self.addChild(criticalText); var damageText = new Text2('', { size: 48, fill: 0xFFFFFF }); damageText.anchor.set(0.5, 0.5); damageText.y = 80; self.addChild(damageText); self.showCritical = function (damage) { damageText.setText('+' + Math.floor(damage)); // Explosive scale animation criticalText.scaleX = 0.3; criticalText.scaleY = 0.3; damageText.scaleX = 0.3; damageText.scaleY = 0.3; tween(criticalText, { scaleX: 1.5, scaleY: 1.5 }, { duration: 150, easing: tween.easeOut, onFinish: function onFinish() { tween(criticalText, { scaleX: 1, scaleY: 1 }, { duration: 100, easing: tween.easeOut }); } }); tween(damageText, { scaleX: 1.3, scaleY: 1.3 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(damageText, { scaleX: 1, scaleY: 1 }, { duration: 150, easing: tween.easeOut }); } }); // Float up and fade LK.setTimeout(function () { tween(self, { y: self.y - 100, alpha: 0 }, { duration: 800, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }, 500); }; return self; }); var DogPark = Container.expand(function () { var self = Container.call(this); var dogParkGraphics = self.attachAsset('dogPark', { anchorX: 0.5, anchorY: 0.5 }); self.updateSkin = function () { // Skin system exists but no visual changes needed }; self.bounce = function () { // Gentle, relaxing bounce instead of sharp bounce tween(dogParkGraphics, { scaleX: 1.1, scaleY: 1.1 }, { duration: 400, easing: tween.easeInOut, onFinish: function onFinish() { tween(dogParkGraphics, { scaleX: 1, scaleY: 1 }, { duration: 600, easing: tween.easeOut }); } }); }; // Add gentle breathing animation to the dog self.startGentleBreathing = function () { tween(dogParkGraphics, { scaleX: 1.03, scaleY: 1.03 }, { duration: 3000, easing: tween.easeInOut, onFinish: function onFinish() { tween(dogParkGraphics, { scaleX: 1, scaleY: 1 }, { duration: 3000, easing: tween.easeInOut, onFinish: function onFinish() { self.startGentleBreathing(); } }); } }); }; // Add gentle floating movement self.startGentleFloat = function () { tween(self, { y: self.y - 8 }, { duration: 4000, easing: tween.easeInOut, onFinish: function onFinish() { tween(self, { y: self.y + 8 }, { duration: 4000, easing: tween.easeInOut, onFinish: function onFinish() { self.startGentleFloat(); } }); } }); }; self.down = function (x, y, obj) { updateBoostMultiplier(); // Combo system var currentTime = Date.now(); if (currentTime - lastClickTime < 1000) { // 1 second window for combo comboCount++; comboTimer = 180; // 3 seconds to continue combo } else { comboCount = 1; comboTimer = 180; } lastClickTime = currentTime; // Update max combo if (comboCount > maxCombo) { maxCombo = comboCount; storage.maxCombo = maxCombo; } // Calculate combo multiplier if (comboCount >= 10) { comboMultiplier = 1 + (comboCount - 9) * 0.1; // +10% per combo after 10 } else { comboMultiplier = 1; } // Critical hit calculation var isCritical = Math.random() < criticalChance; var critMultiplier = isCritical ? criticalMultiplier : 1; // Apply power-up effects var powerUpMultiplier = 1; for (var i = 0; i < clickPowerUps.length; i++) { var powerUp = clickPowerUps[i]; if (powerUp.powerUpType === 'mega') { powerUpMultiplier *= powerUp.multiplier; } else if (powerUp.powerUpType === 'critical' && isCritical) { critMultiplier *= powerUp.multiplier; } } var clickBoost = activeBoosts.click ? activeBoosts.click.multiplier : 1; var allBoost = activeBoosts.all ? activeBoosts.all.multiplier : 1; var basePoints = (1 + pointsPerClick) * prestigeMultiplier * clickBoost * allBoost * comboMultiplier * critMultiplier * powerUpMultiplier; points += basePoints; totalPointsEarned += basePoints; totalClicks += 1; clicksInLastSecond++; if (isCritical) { totalCriticalHits++; storage.totalCriticalHits = totalCriticalHits; } // Show combo display if (comboCount >= 5 && comboCount % 5 === 0) { var comboDisplay = new ComboDisplay(); comboDisplay.x = self.x + 200; comboDisplay.y = self.y; game.addChild(comboDisplay); comboDisplay.showCombo(comboCount, comboMultiplier); // Hide combo display after 2 seconds LK.setTimeout(function () { comboDisplay.hide(); }, 2000); } // Random power-up chance if (Math.random() < 0.01) { // 1% chance createRandomPowerUp(); } // Track click for stress level calculation if (typeof clickHistory !== 'undefined') { clickHistory.push(Date.now()); lastClickTime = Date.now(); } checkSkinUnlock(); self.bounce(); LK.getSound('click').play(); // Create EXPLOSIVE effects instead of zen ripples var explosion = new ExplodingClickEffect(); explosion.x = x; explosion.y = y; game.addChild(explosion); // Random chance to spawn MORE chaos if (Math.random() < 0.3) { for (var i = 0; i < 5; i++) { var chaosEffect = new ExplodingClickEffect(); chaosEffect.x = self.x + (Math.random() - 0.5) * 300; chaosEffect.y = self.y + (Math.random() - 0.5) * 300; game.addChild(chaosEffect); } } // EXTREME CHAOS EXPLOSIONS if (insanityLevel > 60) { // Spawn TONS of explosions everywhere for (var i = 0; i < 15; i++) { var megaExplosion = new ExplodingClickEffect(); megaExplosion.x = Math.random() * 2048; megaExplosion.y = Math.random() * 2732; game.addChild(megaExplosion); } } // FEVER DREAM CLICK EFFECTS realityDistortionLevel += 2; // Make click create reality ripples if (realityDistortionLevel > 50) { for (var i = 0; i < 8; i++) { var realityRipple = new ZenRipple(); realityRipple.x = x + (Math.random() - 0.5) * 200; realityRipple.y = y + (Math.random() - 0.5) * 200; realityRipple.tint = Math.floor(Math.random() * 0xFFFFFF); realityRipple.scaleX = 0.1 + Math.random() * 0.3; realityRipple.scaleY = 0.1 + Math.random() * 0.3; game.addChild(realityRipple); realityRipple.animate(); } } // Make clicking warp space-time if (realityDistortionLevel > 100) { // Create space-time distortion var distortionRadius = 300; var distortionStrength = 50; // Make everything near the click warp and bend var nearbyElements = [summer, upgradeContainer, prestigeButton]; for (var i = 0; i < nearbyElements.length; i++) { var element = nearbyElements[i]; if (element && _typeof2(element) === 'object') { var distance = Math.sqrt(Math.pow(element.x - x, 2) + Math.pow(element.y - y, 2)); if (distance < distortionRadius) { var warpStrength = (distortionRadius - distance) / distortionRadius * distortionStrength; tween(element, { x: element.x + (Math.random() - 0.5) * warpStrength, y: element.y + (Math.random() - 0.5) * warpStrength, rotation: element.rotation + (Math.random() - 0.5) * Math.PI * 0.2, scaleX: element.scaleX * (1 + (Math.random() - 0.5) * 0.3), scaleY: element.scaleY * (1 + (Math.random() - 0.5) * 0.3) }, { duration: 800 + Math.random() * 1200, easing: tween.elasticOut }); } } } } // Psychedelic click response - make the dog phase between dimensions if (realityDistortionLevel > 75) { tween(self, { alpha: 0.3, tint: Math.floor(Math.random() * 0xFFFFFF), scaleX: self.scaleX * (1.5 + Math.random()), scaleY: self.scaleY * (1.5 + Math.random()) }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { tween(self, { alpha: 1, tint: Math.floor(Math.random() * 0xFFFFFF), scaleX: 1, scaleY: 1 }, { duration: 500, easing: tween.bounceOut }); } }); } // Make clicking create impossible geometry if (realityDistortionLevel > 120) { for (var i = 0; i < 5; i++) { var impossibleShape = new FloatingParticle(); impossibleShape.x = x; impossibleShape.y = y; impossibleShape.tint = Math.floor(Math.random() * 0xFFFFFF); impossibleShape.alpha = 0.7; impossibleShape.scaleX = 0.2; impossibleShape.scaleY = 0.2; game.addChild(impossibleShape); // Make it move in impossible ways tween(impossibleShape, { x: impossibleShape.x + Math.sin(i) * 400, y: impossibleShape.y + Math.cos(i) * 400, rotation: impossibleShape.rotation + Math.PI * 4, scaleX: 3, scaleY: 3, alpha: 0 }, { duration: 2000 + Math.random() * 1000, easing: tween.easeInOut, onFinish: function onFinish() { impossibleShape.destroy(); } }); } } // CHAOTIC CLICK EFFECTS if (chaosMode) { // Make the dog bounce insanely tween(self, { scaleX: 2, scaleY: 2, rotation: self.rotation + Math.PI * 2 }, { duration: 200, easing: tween.bounceOut, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.elasticOut }); } }); // Spawn chaotic bullets from the dog for (var i = 0; i < 20; i++) { var chaosBullet = new ChaoticBullet(); chaosBullet.x = self.x; chaosBullet.y = self.y; chaosBullet.angle = i / 20 * Math.PI * 2; chaosBullet.speed = 8 + Math.random() * 12; chaosBullets.push(chaosBullet); game.addChild(chaosBullet); } } // Screen shake on every click screenShakeIntensity = 20; // Increase insanity level insanityLevel++; if (insanityLevel > 100) { chaosMode = true; LK.effects.flashScreen(0xFF0000, 100); } updateAchievements(); updateUI(); saveGame(); }; return self; }); var ExplodingClickEffect = Container.expand(function () { var self = Container.call(this); var explosionColors = [0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0xFF00FF, 0x00FFFF]; for (var i = 0; i < 8; i++) { var fragment = self.attachAsset('clickEffect', { anchorX: 0.5, anchorY: 0.5, alpha: 0.8, scaleX: 0.3, scaleY: 0.3 }); fragment.tint = explosionColors[Math.floor(Math.random() * explosionColors.length)]; var angle = i / 8 * Math.PI * 2; tween(fragment, { x: Math.cos(angle) * 150, y: Math.sin(angle) * 150, alpha: 0, scaleX: 0.1, scaleY: 0.1 }, { duration: 800, easing: tween.easeOut }); } LK.setTimeout(function () { self.destroy(); }, 800); return self; }); var FloatingParticle = Container.expand(function () { var self = Container.call(this); var colors = [0xff6b35, 0x00ffff, 0xffd700, 0xff69b4, 0x98fb98, 0xffa500]; var randomColor = colors[Math.floor(Math.random() * colors.length)]; var particleGraphics = self.attachAsset('multiplierOrb', { anchorX: 0.5, anchorY: 0.5, alpha: 0.3, scaleX: 0.2 + Math.random() * 0.4, scaleY: 0.2 + Math.random() * 0.4 }); particleGraphics.tint = randomColor; self.speed = 0.5 + Math.random() * 2; self.floatDirection = Math.random() * Math.PI * 2; self.rotationSpeed = (Math.random() - 0.5) * 0.1; self.pulsePhase = Math.random() * Math.PI * 2; self.startFloat = function () { var targetX = self.x + Math.cos(self.floatDirection) * (200 + Math.random() * 400); var targetY = self.y + Math.sin(self.floatDirection) * (200 + Math.random() * 400); tween(self, { x: targetX, y: targetY }, { duration: 8000 + Math.random() * 4000, easing: tween.easeInOut, onFinish: function onFinish() { self.floatDirection = Math.random() * Math.PI * 2; self.startFloat(); } }); }; self.update = function () { particleGraphics.rotation += self.rotationSpeed; self.pulsePhase += 0.05; particleGraphics.alpha = 0.2 + Math.sin(self.pulsePhase) * 0.2; }; return self; }); var FloatingStar = Container.expand(function () { var self = Container.call(this); var starGraphics = self.attachAsset('clickEffect', { anchorX: 0.5, anchorY: 0.5, alpha: 0.6, scaleX: 0.3 + Math.random() * 0.2, scaleY: 0.3 + Math.random() * 0.2 }); starGraphics.tint = 0xFFFFFF; self.speed = 0.2 + Math.random() * 0.8; self.direction = Math.random() * Math.PI * 2; self.twinklePhase = Math.random() * Math.PI * 2; self.rotationSpeed = (Math.random() - 0.5) * 0.05; self.startTwinkle = function () { tween(starGraphics, { alpha: 0.9, scaleX: starGraphics.scaleX * 1.5, scaleY: starGraphics.scaleY * 1.5 }, { duration: 1000 + Math.random() * 2000, easing: tween.easeInOut, onFinish: function onFinish() { tween(starGraphics, { alpha: 0.2, scaleX: starGraphics.scaleX * 0.7, scaleY: starGraphics.scaleY * 0.7 }, { duration: 1000 + Math.random() * 2000, easing: tween.easeInOut, onFinish: function onFinish() { self.startTwinkle(); } }); } }); }; self.update = function () { self.x += Math.cos(self.direction) * self.speed; self.y += Math.sin(self.direction) * self.speed; starGraphics.rotation += self.rotationSpeed; // Wrap around screen edges if (self.x < -50) { self.x = 2098; } if (self.x > 2098) { self.x = -50; } if (self.y < -50) { self.y = 2782; } if (self.y > 2782) { self.y = -50; } }; return self; }); var MeditationBubble = Container.expand(function () { var self = Container.call(this); var bubbleGraphics = self.attachAsset('multiplierOrb', { anchorX: 0.5, anchorY: 0.5, alpha: 0.1, scaleX: 0.3 + Math.random() * 0.4, scaleY: 0.3 + Math.random() * 0.4 }); // Soft meditation colors var meditationColors = [0xE6E6FA, 0xF0F8FF, 0xFDF5E6, 0xF5FFFA, 0xFFF8DC]; bubbleGraphics.tint = meditationColors[Math.floor(Math.random() * meditationColors.length)]; self.floatSpeed = 0.3 + Math.random() * 0.5; self.pulsePhase = Math.random() * Math.PI * 2; self.startFloating = function () { tween(self, { y: self.y - 300 - Math.random() * 200 }, { duration: 15000 + Math.random() * 10000, easing: tween.easeInOut, onFinish: function onFinish() { self.destroy(); } }); }; self.update = function () { self.pulsePhase += 0.02; bubbleGraphics.alpha = 0.05 + Math.sin(self.pulsePhase) * 0.1; bubbleGraphics.scaleX += Math.sin(self.pulsePhase * 0.7) * 0.001; bubbleGraphics.scaleY += Math.cos(self.pulsePhase * 0.5) * 0.001; }; return self; }); var MegaChaosPortal = Container.expand(function () { var self = Container.call(this); var portalGraphics = self.attachAsset('multiplierOrb', { anchorX: 0.5, anchorY: 0.5, alpha: 0.9, scaleX: 4, scaleY: 4 }); portalGraphics.tint = 0xFF0000; self.chaosLevel = 0; self.spawnTimer = 0; self.rotation = 0; self.update = function () { self.rotation += 0.3; portalGraphics.rotation = self.rotation; // Pulsating chaos portal tween(portalGraphics, { scaleX: 6 + Math.sin(self.rotation) * 2, scaleY: 6 + Math.cos(self.rotation) * 2, alpha: 0.5 + Math.sin(self.rotation * 2) * 0.4 }, { duration: 100, easing: tween.linear }); self.spawnTimer++; if (self.spawnTimer >= 30) { // Spawn every half second self.spawnTimer = 0; self.chaosLevel++; // Spawn different chaos based on level if (self.chaosLevel % 5 === 0) { // Spawn mega explosions for (var i = 0; i < 10; i++) { var megaExplosion = new ExplodingClickEffect(); megaExplosion.x = self.x + (Math.random() - 0.5) * 400; megaExplosion.y = self.y + (Math.random() - 0.5) * 400; game.addChild(megaExplosion); } } // Spawn chaotic bullets in all directions for (var i = 0; i < 8; i++) { var bullet = new ChaoticBullet(); bullet.x = self.x; bullet.y = self.y; bullet.angle = i / 8 * Math.PI * 2; bullet.speed = 10 + Math.random() * 15; chaoticBullets.push(bullet); game.addChild(bullet); } // Random screen effects LK.effects.flashScreen(Math.floor(Math.random() * 0xFFFFFF), 100); } }; return self; }); var MultiplierOrb = Container.expand(function () { var self = Container.call(this); var orbGraphics = self.attachAsset('multiplierOrb', { anchorX: 0.5, anchorY: 0.5, alpha: 0.8 }); self["float"] = function () { tween(orbGraphics, { y: orbGraphics.y - 20 }, { duration: 1500, easing: tween.easeInOut, onFinish: function onFinish() { tween(orbGraphics, { y: orbGraphics.y + 20 }, { duration: 1500, easing: tween.easeInOut, onFinish: function onFinish() { self["float"](); } }); } }); }; return self; }); var PrestigeButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('prestigeButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.95, scaleY: 1.0 }); var titleText = new Text2('PRESTIGE', { size: 56, fill: 0x000000 }); titleText.anchor.set(0.5, 0.5); titleText.y = -25; self.addChild(titleText); var rewardText = new Text2('Reset for +' + calculatePrestigeReward() + 'x multiplier', { size: 38, fill: 0x8B0000 }); rewardText.anchor.set(0.5, 0.5); rewardText.y = 15; self.addChild(rewardText); var costText = new Text2('Requires: 1M total clicks', { size: 34, fill: 0x444444 }); costText.anchor.set(0.5, 0.5); costText.y = 45; self.addChild(costText); self.updateDisplay = function () { var reward = calculatePrestigeReward(); rewardText.setText('Reset for +' + reward + 'x multiplier'); if (totalClicks >= 1000000) { buttonGraphics.tint = 0xFFFFFF; titleText.tint = 0x000000; } else { buttonGraphics.tint = 0x666666; titleText.tint = 0x999999; } }; self.down = function (x, y, obj) { if (totalClicks >= 1000000) { performPrestige(); } }; return self; }); var PrestigeParticle = Container.expand(function () { var self = Container.call(this); var particleGraphics = self.attachAsset('prestigeParticle', { anchorX: 0.5, anchorY: 0.5, alpha: 1.0, scaleX: 0.5, scaleY: 0.5 }); self.animate = function () { var randomX = (Math.random() - 0.5) * 800; var randomY = -Math.random() * 400 - 200; tween(self, { x: self.x + randomX, y: self.y + randomY }, { duration: 2000, easing: tween.easeOut }); tween(particleGraphics, { scaleX: 1.5, scaleY: 1.5, alpha: 0 }, { duration: 2000, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); var RelaxationMode = Container.expand(function () { var self = Container.call(this); var overlayGraphics = self.attachAsset('statisticsPanel', { anchorX: 0.5, anchorY: 0.5, alpha: 0.8, scaleX: 4, scaleY: 6 }); overlayGraphics.tint = 0x2E2E4F; var titleText = new Text2('RELAXATION MODE', { size: 72, fill: 0xE6E6FA }); titleText.anchor.set(0.5, 0.5); titleText.y = -300; self.addChild(titleText); var instructionText = new Text2('Take deep breaths and focus on the gentle movements\nClick anywhere to exit', { size: 40, fill: 0xF0F8FF }); instructionText.anchor.set(0.5, 0.5); instructionText.y = 250; self.addChild(instructionText); self.breathingCycle = 0; var breathingText = new Text2('Breathe In...', { size: 60, fill: 0x98FB98 }); breathingText.anchor.set(0.5, 0.5); breathingText.y = 0; self.addChild(breathingText); self.startRelaxation = function () { self.breathingCycle = 0; self.updateBreathingText(); // Play multiple ambient sounds for deep relaxation if (relaxationPreferences.meditationSoundEnabled) { LK.getSound('gentleWaves').play(); LK.setTimeout(function () { LK.getSound('windChimes').play(); }, 2000); LK.setTimeout(function () { LK.getSound('softRain').play(); }, 4000); } // Start gentle background pulse with slower, deeper breathing rhythm tween(overlayGraphics, { alpha: 0.95, scaleX: 4.1, scaleY: 6.1 }, { duration: 6000, easing: tween.easeInOut, onFinish: function onFinish() { tween(overlayGraphics, { alpha: 0.65, scaleX: 3.9, scaleY: 5.9 }, { duration: 8000, easing: tween.easeInOut, onFinish: function onFinish() { self.startRelaxation(); } }); } }); }; self.updateBreathingText = function () { var cycle = Math.floor(self.breathingCycle / 240); // 4 second cycles at 60fps var phase = cycle % 2; // Add psychedelic breathing messages var psychedelicMessages = ['Breathe in the cosmos...', 'Exhale your reality...', 'The universe breathes through you...', 'Your breath bends space-time...', 'Feel the quantum air...', 'Breathe in impossible colors...']; if (phase === 0) { if (realityDistortionLevel > 80) { breathingText.setText(psychedelicMessages[Math.floor(Math.random() * psychedelicMessages.length)]); } else { breathingText.setText('Breathe In...'); } breathingText.tint = realityDistortionLevel > 50 ? Math.floor(Math.random() * 0xFFFFFF) : 0x98FB98; } else { if (realityDistortionLevel > 80) { breathingText.setText(psychedelicMessages[Math.floor(Math.random() * psychedelicMessages.length)]); } else { breathingText.setText('Breathe Out...'); } breathingText.tint = realityDistortionLevel > 50 ? Math.floor(Math.random() * 0xFFFFFF) : 0x87CEEB; } }; self.update = function () { self.breathingCycle += 1; if (self.breathingCycle % 240 === 0) { self.updateBreathingText(); } // Gentle breathing animation var breathPhase = self.breathingCycle % 240 / 240; var breathScale = 1 + Math.sin(breathPhase * Math.PI) * 0.1; breathingText.scaleX = breathScale; breathingText.scaleY = breathScale; }; self.down = function (x, y, obj) { exitRelaxationMode(); }; return self; }); var RelaxingAffirmation = Container.expand(function () { var self = Container.call(this); var defaultAffirmations = ['You are at peace', 'Breathe and let go', 'This moment is perfect', 'You are calm and centered', 'Feel the tranquility', 'Let peace flow through you', 'You are exactly where you need to be', 'Embrace this peaceful moment']; // Use seasonal affirmations if available, otherwise use default var currentTheme = seasonalThemes && seasonalThemes[seasonalThemeIndex] ? seasonalThemes[seasonalThemeIndex] : null; var affirmations = currentTheme ? currentTheme.affirmations.concat(defaultAffirmations) : defaultAffirmations; var selectedAffirmation = affirmations[Math.floor(Math.random() * affirmations.length)]; var affirmationText = new Text2(selectedAffirmation, { size: 48, fill: currentTheme ? currentTheme.colors[0] : 0xE6E6FA }); affirmationText.anchor.set(0.5, 0.5); affirmationText.alpha = 0; self.addChild(affirmationText); self.showAffirmation = function () { tween(affirmationText, { alpha: 0.8, scaleX: 1.1, scaleY: 1.1 }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { LK.setTimeout(function () { tween(affirmationText, { alpha: 0, scaleX: 1, scaleY: 1 }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { self.destroy(); } }); }, 3000); } }); }; return self; }); var SoothingWave = Container.expand(function () { var self = Container.call(this); var waveGraphics = self.attachAsset('multiplierOrb', { anchorX: 0.5, anchorY: 0.5, alpha: 0.1, scaleX: 0.5, scaleY: 0.1 }); var waveColors = [0xE0FFFF, 0xF0FFFF, 0xF5FFFA, 0xF0F8FF]; waveGraphics.tint = waveColors[Math.floor(Math.random() * waveColors.length)]; self.wavePhase = Math.random() * Math.PI * 2; self.startWave = function () { tween(self, { scaleX: 8 + Math.random() * 4, scaleY: 0.3 + Math.random() * 0.2, alpha: 0 }, { duration: 6000 + Math.random() * 4000, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); var StatisticsPanel = Container.expand(function () { var self = Container.call(this); var panelGraphics = self.attachAsset('statisticsPanel', { anchorX: 0.5, anchorY: 0.5, alpha: 0.9 }); var titleText = new Text2('STATISTICS', { size: 60, fill: 0xFFD700 }); titleText.anchor.set(0.5, 0.5); titleText.y = -200; self.addChild(titleText); var statsText = new Text2('', { size: 36, fill: 0xFFFFFF }); statsText.anchor.set(0, 0.5); statsText.x = -300; statsText.y = -50; self.addChild(statsText); self.updateStats = function () { var stats = ['Total Clicks: ' + totalClicks, 'Total Points Earned: ' + Math.floor(totalPointsEarned), 'Time Played: ' + Math.floor(timePlayed / 60) + ' minutes', 'Highest CPS: ' + Math.floor(highestCPS), 'Upgrades Purchased: ' + totalUpgradesPurchased, 'Prestiges: ' + prestigeLevel, 'Achievements: ' + completedAchievements + '/' + achievements.length]; statsText.setText(stats.join('\n')); }; return self; }); var TutorialText = Container.expand(function () { var self = Container.call(this); var tutorialTips = ["Click the cute dog to earn points!", "Use points to buy upgrades on the right", "Higher upgrades give more points per click", "Auto upgrades earn points automatically", "Build combos by clicking rapidly", "Watch your zen meter - stay relaxed!", "Click RELAX button for meditation mode", "Prestige when you reach 1M clicks", "Achievements give bonus points", "Use boosts for temporary bonuses"]; var currentTipIndex = 0; var tipCycleTimer = 0; var tutorialBackground = self.attachAsset('statisticsPanel', { anchorX: 0.5, anchorY: 0.5, alpha: 0.7, scaleX: 0.8, scaleY: 0.4 }); tutorialBackground.tint = 0x2A2A4A; var titleText = new Text2('HOW TO PLAY', { size: 44, fill: 0xFFD700 }); titleText.anchor.set(0.5, 0.5); titleText.y = -60; self.addChild(titleText); var tipText = new Text2(tutorialTips[0], { size: 32, fill: 0xE6E6FA }); tipText.anchor.set(0.5, 0.5); tipText.y = -10; self.addChild(tipText); var progressText = new Text2('Tip 1 of ' + tutorialTips.length, { size: 24, fill: 0xCCCCCC }); progressText.anchor.set(0.5, 0.5); progressText.y = 30; self.addChild(progressText); var nextButton = new Text2('NEXT TIP >', { size: 28, fill: 0x98FB98 }); nextButton.anchor.set(0.5, 0.5); nextButton.y = 65; self.addChild(nextButton); self.showNextTip = function () { currentTipIndex = (currentTipIndex + 1) % tutorialTips.length; // Fade out current tip tween(tipText, { alpha: 0, scaleX: 0.8, scaleY: 0.8 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { // Update text and fade in tipText.setText(tutorialTips[currentTipIndex]); progressText.setText('Tip ' + (currentTipIndex + 1) + ' of ' + tutorialTips.length); tween(tipText, { alpha: 1, scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.easeOut }); } }); // Add gentle glow effect to title tween(titleText, { tint: 0xFFFFFF }, { duration: 150, easing: tween.easeOut, onFinish: function onFinish() { tween(titleText, { tint: 0xFFD700 }, { duration: 150, easing: tween.easeOut }); } }); }; self.update = function () { // Auto-cycle tips every 8 seconds tipCycleTimer++; if (tipCycleTimer >= 480) { // 8 seconds at 60fps self.showNextTip(); tipCycleTimer = 0; } // Add subtle pulsing to next button var pulsePhase = LK.ticks * 0.05 % (Math.PI * 2); nextButton.alpha = 0.7 + Math.sin(pulsePhase) * 0.3; }; nextButton.down = function (x, y, obj) { self.showNextTip(); tipCycleTimer = 0; // Reset auto-cycle timer }; return self; }); var UpgradeButton = Container.expand(function (upgradeData) { var self = Container.call(this); var buttonGraphics = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.9 }); self.upgradeData = upgradeData; var nameText = new Text2(upgradeData.name, { size: 36, fill: 0xFFFFFF }); nameText.anchor.set(0, 0.5); nameText.x = -160; nameText.y = -15; self.addChild(nameText); var costText = new Text2('Cost: ' + upgradeData.cost, { size: 28, fill: 0xFFFF00 }); costText.anchor.set(0, 0.5); costText.x = -160; costText.y = 8; self.addChild(costText); var countText = new Text2('Owned: ' + upgradeData.owned, { size: 26, fill: 0xCCCCCC }); countText.anchor.set(1, 0.5); countText.x = 160; countText.y = 0; self.addChild(countText); self.updateDisplay = function () { costText.setText('Cost: ' + upgradeData.cost); countText.setText('Owned: ' + upgradeData.owned); if (points >= upgradeData.cost) { buttonGraphics.tint = 0xE6E6FA; // Soft lavender when affordable for zen feeling // Add gentle glow for affordable upgrades if (!self.isGlowing) { self.isGlowing = true; self.startGentleGlow(); } } else { buttonGraphics.tint = 0x888888; // Softer gray when not affordable if (self.isGlowing) { self.isGlowing = false; tween.stop(buttonGraphics, { alpha: true, scaleX: true, scaleY: true }); buttonGraphics.alpha = 1; buttonGraphics.scaleX = 0.8; buttonGraphics.scaleY = 0.9; } } }; // Add gentle glowing animation for affordable upgrades self.startGentleGlow = function () { tween(buttonGraphics, { alpha: 0.7, scaleX: 0.82, scaleY: 0.92 }, { duration: 1500, easing: tween.easeInOut, onFinish: function onFinish() { if (self.isGlowing) { tween(buttonGraphics, { alpha: 1, scaleX: 0.8, scaleY: 0.9 }, { duration: 1500, easing: tween.easeInOut, onFinish: function onFinish() { if (self.isGlowing) { self.startGentleGlow(); } } }); } } }); }; self.down = function (x, y, obj) { if (points >= upgradeData.cost) { points -= upgradeData.cost; upgradeData.owned++; totalUpgradesPurchased++; if (upgradeData.type === 'click') { pointsPerClick += upgradeData.power; } else if (upgradeData.type === 'auto') { pointsPerSecond += upgradeData.power; } // Exponential cost increase formula upgradeData.cost = Math.floor(upgradeData.baseCost * Math.pow(1.15, upgradeData.owned)); // Play cash register sound LK.getSound('cashRegister').play(); // Flash button pink tween(buttonGraphics, { tint: 0xFF69B4 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { updateAchievements(); updateUI(); } }); saveGame(); } }; return self; }); var ZenBreathingOrb = Container.expand(function () { var self = Container.call(this); var orbGraphics = self.attachAsset('multiplierOrb', { anchorX: 0.5, anchorY: 0.5, alpha: 0.15, scaleX: 0.8, scaleY: 0.8 }); // Soft zen colors var zenColors = [0x87CEEB, 0x98FB98, 0xDDA0DD, 0xF0E68C, 0xFFB6C1]; orbGraphics.tint = zenColors[Math.floor(Math.random() * zenColors.length)]; self.breathingPhase = Math.random() * Math.PI * 2; self.baseScale = 0.6 + Math.random() * 0.4; self.startBreathing = function () { // Slow breathing cycle like meditation tween(orbGraphics, { scaleX: self.baseScale * 1.8, scaleY: self.baseScale * 1.8, alpha: 0.25 }, { duration: 4000, easing: tween.easeInOut, onFinish: function onFinish() { tween(orbGraphics, { scaleX: self.baseScale, scaleY: self.baseScale, alpha: 0.1 }, { duration: 4000, easing: tween.easeInOut, onFinish: function onFinish() { self.startBreathing(); } }); } }); }; self.update = function () { // Gentle floating movement self.breathingPhase += 0.01; self.y += Math.sin(self.breathingPhase) * 0.3; self.x += Math.cos(self.breathingPhase * 0.7) * 0.2; }; return self; }); var ZenRipple = Container.expand(function () { var self = Container.call(this); var rippleGraphics = self.attachAsset('multiplierOrb', { anchorX: 0.5, anchorY: 0.5, alpha: 0.4, scaleX: 0.1, scaleY: 0.1 }); rippleGraphics.tint = 0x87CEEB; // Sky blue for peaceful ripples self.animate = function () { tween(rippleGraphics, { scaleX: 8, scaleY: 8, alpha: 0 }, { duration: 2500, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x8B4B9C }); /**** * Game Code ****/ // Game state variables function _typeof2(o) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof2(o); } function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } var points = 0; var pointsPerClick = 0; // Always start at 0, will be calculated from upgrades var pointsPerSecond = 0; // Always start at 0, will be calculated from upgrades var totalClicks = storage.totalClicks || 0; var currentSkin = storage.currentSkin || 0; var skinMilestones = [0, 100, 500, 1000, 2500, 5000, 10000, 25000, 50000, 100000]; // Prestige system variables var prestigeLevel = storage.prestigeLevel || 0; var prestigeMultiplier = 1 + prestigeLevel * 1; // +100% per prestige level (each prestige = +1x multiplier) var multiplierOrbs = []; // Achievement system variables var achievements = []; var completedAchievements = storage.completedAchievements || 0; var totalPointsEarned = storage.totalPointsEarned || 0; var timePlayed = storage.timePlayed || 0; var gameStartTime = Date.now(); var highestCPS = storage.highestCPS || 0; var totalUpgradesPurchased = storage.totalUpgradesPurchased || 0; // Boost system variables var activeBoosts = {}; var boostMultiplier = 1; // Statistics tracking var clicksInLastSecond = 0; var lastSecondTime = Date.now(); // Enhanced clicker features var comboMultiplier = 1; var comboCount = 0; var lastClickTime = 0; var comboTimer = 0; var maxCombo = storage.maxCombo || 0; var criticalChance = 0.05; // 5% base critical chance var criticalMultiplier = 2; var clickPowerUps = []; var totalCriticalHits = storage.totalCriticalHits || 0; // Achievement definitions var achievementDefinitions = [{ id: 'first_click', name: 'First Click', target: 1, type: 'clicks', reward: 10 }, { id: 'hundred_clicks', name: 'Clicking Master', target: 100, type: 'clicks', reward: 100 }, { id: 'thousand_clicks', name: 'Click Champion', target: 1000, type: 'clicks', reward: 1000 }, { id: 'first_upgrade', name: 'First Purchase', target: 1, type: 'upgrades', reward: 50 }, { id: 'ten_upgrades', name: 'Shopping Spree', target: 10, type: 'upgrades', reward: 500 }, { id: 'first_prestige', name: 'Prestige Master', target: 1, type: 'prestiges', reward: 10000 }, { id: 'million_points', name: 'Millionaire', target: 1000000, type: 'points', reward: 5000 }, { id: 'speed_demon', name: 'Speed Demon', target: 10, type: 'cps', reward: 2000 }, { id: 'time_played', name: 'Dedicated Player', target: 3600, type: 'time', reward: 1500 }]; // Initialize achievements from definitions and load saved progress for (var i = 0; i < achievementDefinitions.length; i++) { var def = achievementDefinitions[i]; var keyPrefix = 'achievement_' + def.id + '_'; achievements.push({ id: def.id, name: def.name, target: def.target, type: def.type, reward: def.reward, current: storage[keyPrefix + 'current'] || 0, completed: storage[keyPrefix + 'completed'] || false, claimed: storage[keyPrefix + 'claimed'] || false }); } ; // Boost definitions var boostDefinitions = [{ name: '2x Click', type: 'click', multiplier: 2, duration: 30000, cost: 1000 }, { name: '3x Auto', type: 'auto', multiplier: 3, duration: 60000, cost: 5000 }, { name: '5x All', type: 'all', multiplier: 5, duration: 15000, cost: 10000 }]; // Floating particles system var floatingParticles = []; function createFloatingParticles() { var particleCount = 15; for (var i = 0; i < particleCount; i++) { var particle = new FloatingParticle(); particle.x = Math.random() * 2048; particle.y = Math.random() * 2732; floatingParticles.push(particle); game.addChild(particle); particle.startFloat(); } } function calculatePrestigeReward() { return Math.floor(totalClicks / 1000000) * 0.5; } function createPrestigeParticles(centerX, centerY) { for (var i = 0; i < 15; i++) { var particle = new PrestigeParticle(); particle.x = centerX + (Math.random() - 0.5) * 100; particle.y = centerY + (Math.random() - 0.5) * 100; game.addChild(particle); particle.animate(); } } function performPrestige() { var reward = calculatePrestigeReward(); prestigeLevel += reward; prestigeMultiplier = 1 + prestigeLevel * 1; // Create particle explosion createPrestigeParticles(summer.x, summer.y); // Flash screen gold LK.effects.flashScreen(0xffd700, 1500); // Reset game state but keep prestige bonuses points = 0; pointsPerClick = 0; pointsPerSecond = 0; totalClicks = 0; currentSkin = 0; // Reset all upgrades for (var i = 0; i < upgrades.length; i++) { upgrades[i].owned = 0; upgrades[i].cost = upgrades[i].baseCost; } // Create multiplier orbs around dog createMultiplierOrbs(); // Update everything updateUI(); summer.updateSkin(); saveGame(); } function updateAchievements() { for (var i = 0; i < achievements.length; i++) { var achievement = achievements[i]; if (achievement.completed) { continue; } var oldCurrent = achievement.current; switch (achievement.type) { case 'clicks': achievement.current = totalClicks; break; case 'upgrades': achievement.current = totalUpgradesPurchased; break; case 'prestiges': achievement.current = prestigeLevel; break; case 'points': achievement.current = totalPointsEarned; break; case 'cps': achievement.current = highestCPS; break; case 'time': achievement.current = timePlayed; break; } if (achievement.current >= achievement.target && !achievement.completed) { achievement.completed = true; LK.effects.flashScreen(0x00FF00, 1000); // Show achievement notification if (achievementButtons[i]) { achievementButtons[i].updateProgress(); } } } } function claimAchievement(achievement) { if (achievement.completed && !achievement.claimed) { achievement.claimed = true; points += achievement.reward; completedAchievements++; LK.effects.flashScreen(0xFFD700, 500); updateUI(); saveGame(); } } function activateBoost(boostData) { activeBoosts[boostData.type] = { multiplier: boostData.multiplier, endTime: Date.now() + boostData.duration, type: boostData.type }; updateBoostMultiplier(); } function updateBoostMultiplier() { boostMultiplier = 1; var currentTime = Date.now(); for (var type in activeBoosts) { var boost = activeBoosts[type]; if (boost.endTime > currentTime) { if (type === 'all' || type === 'click' || type === 'auto') { boostMultiplier *= boost.multiplier; } } else { delete activeBoosts[type]; } } } function createMultiplierOrbs() { // Clear existing orbs for (var i = 0; i < multiplierOrbs.length; i++) { multiplierOrbs[i].destroy(); } multiplierOrbs = []; // Create new orbs based on prestige level var orbCount = Math.min(prestigeLevel, 8); for (var i = 0; i < orbCount; i++) { var orb = new MultiplierOrb(); var angle = i / orbCount * Math.PI * 2; orb.x = summer.x + Math.cos(angle) * 300; orb.y = summer.y + Math.sin(angle) * 200; multiplierOrbs.push(orb); game.addChild(orb); orb["float"](); // Animate orb appearance orb.alpha = 0; orb.scaleX = 0; orb.scaleY = 0; tween(orb, { alpha: 0.8, scaleX: 1, scaleY: 1 }, { duration: 800, easing: tween.elasticOut }); } } function createRandomPowerUp() { var powerUpTypes = ['speed', 'critical', 'mega', 'combo']; var randomType = powerUpTypes[Math.floor(Math.random() * powerUpTypes.length)]; var powerUp = new ClickPowerUp(randomType); powerUp.x = summer.x + (Math.random() - 0.5) * 400; powerUp.y = summer.y + (Math.random() - 0.5) * 300; var duration = 300 + Math.random() * 300; // 5-10 seconds var multiplier = 1.5 + Math.random() * 1.5; // 1.5x to 3x // Adjust based on power-up type switch (randomType) { case 'speed': duration = 600; // 10 seconds multiplier = 1; // Doesn't affect damage, just visual break; case 'critical': duration = 420; // 7 seconds multiplier = 1.5; // +50% critical multiplier break; case 'mega': duration = 180; // 3 seconds multiplier = 3; // 3x click damage break; case 'combo': duration = 600; // 10 seconds multiplier = 1; // Extends combo timer break; } clickPowerUps.push(powerUp); game.addChild(powerUp); powerUp.activate(duration, multiplier); // Flash screen with power-up color var colors = { 'speed': 0x00FFFF, 'critical': 0xFF6B35, 'mega': 0xFF1493, 'combo': 0x32CD32 }; LK.effects.flashScreen(colors[randomType], 300); } function updateClickPowerUps() { for (var i = clickPowerUps.length - 1; i >= 0; i--) { var powerUp = clickPowerUps[i]; if (powerUp.duration <= 0) { clickPowerUps.splice(i, 1); } else { powerUp.update(); } } } // Upgrade definitions with exponential growth - ordered from cheapest to most expensive var upgrades = [{ name: 'Squeaky Toy', type: 'click', cost: storage.squeakyToyCost || 15, baseCost: 15, power: 1, owned: storage.squeakyToyOwned || 0 }, { name: 'Dog Walker', type: 'auto', cost: storage.dogWalkerCost || 50, baseCost: 50, power: 1, owned: storage.dogWalkerOwned || 0 }, { name: 'Tennis Ball', type: 'click', cost: storage.tennisBallCost || 100, baseCost: 100, power: 5, owned: storage.tennisBallOwned || 0 }, { name: 'Poop Bag Station', type: 'auto', cost: storage.poopBagStationCost || 500, baseCost: 500, power: 8, owned: storage.poopBagStationOwned || 0 }, { name: 'Premium Treats', type: 'click', cost: storage.premiumTreatsCost || 1200, baseCost: 1200, power: 47, owned: storage.premiumTreatsOwned || 0 }, { name: 'Dog Fountain', type: 'auto', cost: storage.dogFountainCost || 8000, baseCost: 8000, power: 47, owned: storage.dogFountainOwned || 0 }, { name: 'Chew Bone', type: 'click', cost: storage.chewBoneCost || 15000, baseCost: 15000, power: 260, owned: storage.chewBoneOwned || 0 }, { name: 'Agility Course', type: 'auto', cost: storage.agilityCourseC || 90000, baseCost: 90000, power: 260, owned: storage.agilityCourseo || 0 }, { name: 'Diamond Collar', type: 'click', cost: storage.diamondCollarCost || 180000, baseCost: 180000, power: 1400, owned: storage.diamondCollarOwned || 0 }, { name: 'Dog Daycare', type: 'auto', cost: storage.dogDaycareCost || 900000, baseCost: 900000, power: 1400, owned: storage.dogDaycareOwned || 0 }, { name: 'Golden Leash', type: 'click', cost: storage.goldenLeashCost || 1800000, baseCost: 1800000, power: 7800, owned: storage.goldenLeashOwned || 0 }, { name: 'Mobile Grooming Van', type: 'auto', cost: storage.mobileGroomingVanCost || 9000000, baseCost: 9000000, power: 7800, owned: storage.mobileGroomingVanOwned || 0 }, { name: 'Laser Pointer', type: 'click', cost: storage.laserPointerCost || 27000000, baseCost: 27000000, power: 44000, owned: storage.laserPointerOwned || 0 }, { name: 'Dog Hotel', type: 'auto', cost: storage.dogHotelCost || 135000000, baseCost: 135000000, power: 44000, owned: storage.dogHotelOwned || 0 }, { name: 'Robotic Paw', type: 'click', cost: storage.roboticPawCost || 540000000, baseCost: 540000000, power: 260000, owned: storage.roboticPawOwned || 0 }, { name: 'Bark Park', type: 'auto', cost: storage.barkParkCost || 2700000000, baseCost: 2700000000, power: 260000, owned: storage.barkParkOwned || 0 }, { name: 'Tail Wag Generator', type: 'click', cost: storage.tailWagGeneratorCost || 8100000000, baseCost: 8100000000, power: 1600000, owned: storage.tailWagGeneratorOwned || 0 }, { name: 'Doggy Resort Chain', type: 'auto', cost: storage.doggyResortChainCost || 40500000000, baseCost: 40500000000, power: 1600000, owned: storage.doggyResortChainOwned || 0 }, { name: 'Frisbee Factory', type: 'click', cost: storage.frisbeeFactoryCost || 121500000000, baseCost: 121500000000, power: 10000000, owned: storage.frisbeeFactoryOwned || 0 }, { name: 'Canine Island', type: 'auto', cost: storage.canineIslandCost || 607500000000, baseCost: 607500000000, power: 10000000, owned: storage.canineIslandOwned || 0 }, { name: 'Doghouse Empire', type: 'click', cost: storage.doghouseEmpireCost || 1822500000000, baseCost: 1822500000000, power: 65000000, owned: storage.doghouseEmpireOwned || 0 }, { name: 'Puppy Planet', type: 'auto', cost: storage.puppyPlanetCost || 9112500000000, baseCost: 9112500000000, power: 65000000, owned: storage.puppyPlanetOwned || 0 }, { name: 'Biscuit Factory', type: 'auto', cost: storage.biscuitFactoryCost || 136687500000000, baseCost: 136687500000000, power: 430000000, owned: storage.biscuitFactoryOwned || 0 }, { name: 'Fetch Robot Workshop', type: 'auto', cost: storage.fetchRobotWorkshopCost || 2733750000000000, baseCost: 2733750000000000, power: 2900000000, owned: storage.fetchRobotWorkshopOwned || 0 }, { name: 'Treat Plantation', type: 'auto', cost: storage.treatPlantationCost || 41006250000000000, baseCost: 41006250000000000, power: 21000000000000000, owned: storage.treatPlantationOwned || 0 }, { name: 'Doggy Spa Chain', type: 'auto', cost: storage.doggySpaChainCost || 615093750000000000, baseCost: 615093750000000000, power: 150000000000, owned: storage.doggySpaChainOwned || 0 }, { name: 'Canine Universe', type: 'auto', cost: storage.canineUniverseCost || 9226406250000000000, baseCost: 9226406250000000000, power: 1100000000000, owned: storage.canineUniverseOwned || 0 }]; // Sort upgrades from cheapest to most expensive upgrades.sort(function (a, b) { return a.baseCost - b.baseCost; }); // Load saved upgrade states for (var i = 0; i < upgrades.length; i++) { var upgrade = upgrades[i]; if (upgrade.type === 'click') { pointsPerClick += upgrade.owned * upgrade.power; } else if (upgrade.type === 'auto') { pointsPerSecond += upgrade.owned * upgrade.power; } } // UI Elements - Compacted and repositioned to avoid overlap var pointsDisplay = new Text2('Points: ' + Math.floor(points), { size: 60, fill: 0xFFFFFF }); pointsDisplay.anchor.set(0.5, 0); LK.gui.top.addChild(pointsDisplay); var displayPerSecond = pointsPerSecond; // Track the displayed value for animation var perSecondDisplay = new Text2('Per Second: ' + displayPerSecond, { size: 45, fill: 0xFFFF00 }); perSecondDisplay.anchor.set(0.5, 0); perSecondDisplay.y = 70; LK.gui.top.addChild(perSecondDisplay); // Dog Park title - moved to top center to avoid overlapping with game assets var dogParkTitle = new Text2('CHAOTIC DOG MADNESS!!!', { size: 50, fill: 0xFF0000 }); dogParkTitle.anchor.set(0.5, 0); dogParkTitle.x = -100; dogParkTitle.y = 120; LK.gui.top.addChild(dogParkTitle); // Insanity meter var insanityDisplay = new Text2('INSANITY: 0%', { size: 30, fill: 0xFF00FF }); insanityDisplay.anchor.set(0, 0); insanityDisplay.x = 120; insanityDisplay.y = 320; LK.gui.topLeft.addChild(insanityDisplay); // Prestige display var prestigeDisplay = new Text2('Prestige Level: ' + prestigeLevel + ' (x' + prestigeMultiplier.toFixed(1) + ')', { size: 40, fill: 0xffd700 }); prestigeDisplay.anchor.set(0.5, 0); prestigeDisplay.y = 175; LK.gui.top.addChild(prestigeDisplay); // Prestige button var prestigeButton = new PrestigeButton(); prestigeButton.x = 400; prestigeButton.y = 1700; game.addChild(prestigeButton); // Achievement panel var achievementContainer = new Container(); achievementContainer.x = 50; achievementContainer.y = 2200; game.addChild(achievementContainer); var achievementButtons = []; for (var i = 0; i < achievements.length; i++) { var achievementButton = new Achievement(achievements[i]); achievementButton.x = i % 3 * 120; achievementButton.y = Math.floor(i / 3) * 150; achievementButtons.push(achievementButton); achievementContainer.addChild(achievementButton); achievementButton.updateProgress(); } // Boost buttons var boostContainer = new Container(); boostContainer.x = 100; boostContainer.y = 1950; game.addChild(boostContainer); var boostButtons = []; for (var i = 0; i < boostDefinitions.length; i++) { var boostButton = new BoostButton(boostDefinitions[i]); boostButton.x = i * 450; boostButton.y = 0; boostButtons.push(boostButton); boostContainer.addChild(boostButton); } // Statistics panel (initially hidden) var statsPanel = new StatisticsPanel(); statsPanel.x = 1024; statsPanel.y = 1366; statsPanel.alpha = 0; game.addChild(statsPanel); // Statistics button var statsButton = new Text2('STATS', { size: 30, fill: 0xFFFFFF }); statsButton.anchor.set(1, 0); statsButton.x = -10; statsButton.y = 220; var showingStats = false; LK.gui.topRight.addChild(statsButton); // Relaxation mode button var relaxButton = new Text2('RELAX', { size: 30, fill: 0xE6E6FA }); relaxButton.anchor.set(1, 0); relaxButton.x = -10; relaxButton.y = 260; LK.gui.topRight.addChild(relaxButton); relaxButton.down = function (x, y, obj) { if (!isInRelaxationMode) { enterRelaxationMode(); } }; // Stress level indicator (zen meter) var zenMeter = new Text2('Zen: 100%', { size: 27, fill: 0x98FB98 }); zenMeter.anchor.set(1, 0); zenMeter.x = -10; zenMeter.y = 300; LK.gui.topRight.addChild(zenMeter); // Combo display var comboDisplay = new Text2('Combo: 0x', { size: 32, fill: 0xFFD700 }); comboDisplay.anchor.set(0, 0); comboDisplay.x = 120; comboDisplay.y = 220; LK.gui.topLeft.addChild(comboDisplay); // Critical stats display var criticalStatsDisplay = new Text2('Criticals: 0', { size: 25, fill: 0xFF6B35 }); criticalStatsDisplay.anchor.set(0, 0); criticalStatsDisplay.x = 120; criticalStatsDisplay.y = 260; LK.gui.topLeft.addChild(criticalStatsDisplay); // Max combo display var maxComboDisplay = new Text2('Best Combo: 0x', { size: 23, fill: 0xFFFFFF }); maxComboDisplay.anchor.set(0, 0); maxComboDisplay.x = 120; maxComboDisplay.y = 290; LK.gui.topLeft.addChild(maxComboDisplay); // Seasonal theme indicator var themeIndicator = new Text2('Spring Awakening', { size: 24, fill: 0xE6E6FA }); themeIndicator.anchor.set(0.5, 0); themeIndicator.y = 220; LK.gui.top.addChild(themeIndicator); // Main summer (the dog) var summer = game.addChild(new DogPark()); summer.x = 1024; // Center horizontally summer.y = 1200; // Better vertical position // Initialize current skin summer.updateSkin(); // Start relaxing animations for the main character summer.startGentleBreathing(); summer.startGentleFloat(); // Create scrollable upgrade container var upgradeContainer = new Container(); upgradeContainer.x = 1650; // Move even further to the right edge upgradeContainer.y = 350; game.addChild(upgradeContainer); // Upgrade buttons var upgradeButtons = []; for (var i = 0; i < upgrades.length; i++) { var button = new UpgradeButton(upgrades[i]); button.x = 0; button.y = i * 140; upgradeButtons.push(button); upgradeContainer.addChild(button); } // Scroll variables var scrollY = 0; var maxScroll = Math.max(0, upgrades.length * 140 - 1600); var lastTouchY = 0; var isDragging = false; // Auto-clicker timer var autoClickTimer = 0; function updateUI() { pointsDisplay.setText('Points: ' + Math.floor(points)); prestigeDisplay.setText('Prestige Level: ' + prestigeLevel + ' (x' + prestigeMultiplier.toFixed(1) + ')'); // Update combo display if (comboCount > 1) { comboDisplay.setText('Combo: ' + comboCount + 'x (' + comboMultiplier.toFixed(1) + 'x)'); comboDisplay.tint = comboCount >= 25 ? 0xFF1493 : comboCount >= 10 ? 0xFF6B35 : 0xFFD700; } else { comboDisplay.setText('Combo: 0x'); comboDisplay.tint = 0xFFD700; } // Update critical stats criticalStatsDisplay.setText('Criticals: ' + totalCriticalHits); // Update max combo maxComboDisplay.setText('Best Combo: ' + maxCombo + 'x'); // Update zen meter var zenPercent = Math.max(0, 100 - stressLevel); zenMeter.setText('Zen: ' + zenPercent + '%'); // Change zen meter color based on stress level if (stressLevel < 30) { zenMeter.tint = 0x98FB98; // Green - very zen } else if (stressLevel < 60) { zenMeter.tint = 0xFFE4B5; // Yellow - moderate } else { zenMeter.tint = 0xFFB6C1; // Pink - needs relaxation } // Update insanity display insanityDisplay.setText('INSANITY: ' + Math.min(100, insanityLevel) + '%'); insanityDisplay.tint = insanityLevel > 100 ? 0xFF0000 : 0xFF00FF; // Make title flash when in chaos mode if (chaosMode) { dogParkTitle.tint = Math.floor(Math.random() * 0xFFFFFF); } else { dogParkTitle.tint = 0xFF0000; } // Update seasonal theme indicator if (seasonalThemes && seasonalThemes[seasonalThemeIndex]) { var currentTheme = seasonalThemes[seasonalThemeIndex]; themeIndicator.setText(currentTheme.name); themeIndicator.tint = currentTheme.colors[0]; } // Animate per second display if value changed var adjustedPerSecond = Math.floor(pointsPerSecond * prestigeMultiplier); if (displayPerSecond !== adjustedPerSecond) { tween.stop({ displayPerSecond: true }); // Stop any existing tween tween({ displayPerSecond: displayPerSecond }, { displayPerSecond: adjustedPerSecond }, { duration: 800, easing: tween.easeOut, onUpdate: function onUpdate() { perSecondDisplay.setText('Per Second: ' + Math.floor(displayPerSecond)); }, onFinish: function onFinish() { displayPerSecond = adjustedPerSecond; perSecondDisplay.setText('Per Second: ' + adjustedPerSecond); } }); } else { perSecondDisplay.setText('Per Second: ' + adjustedPerSecond); } for (var i = 0; i < upgradeButtons.length; i++) { upgradeButtons[i].updateDisplay(); } prestigeButton.updateDisplay(); } function checkSkinUnlock() { for (var i = skinMilestones.length - 1; i >= 0; i--) { if (totalClicks >= skinMilestones[i] && currentSkin < i) { currentSkin = i; summer.updateSkin(); // Flash effect for skin unlock LK.effects.flashScreen(0x00ff00, 500); break; } } } function saveGame() { storage.points = points; storage.totalClicks = totalClicks; storage.currentSkin = currentSkin; storage.prestigeLevel = prestigeLevel; // Save achievement data as individual keys to avoid nested objects in arrays for (var i = 0; i < achievements.length; i++) { var achievement = achievements[i]; var keyPrefix = 'achievement_' + achievement.id + '_'; storage[keyPrefix + 'current'] = achievement.current; storage[keyPrefix + 'completed'] = achievement.completed; storage[keyPrefix + 'claimed'] = achievement.claimed; } storage.completedAchievements = completedAchievements; storage.totalPointsEarned = totalPointsEarned; storage.timePlayed = timePlayed; storage.highestCPS = highestCPS; storage.totalUpgradesPurchased = totalUpgradesPurchased; // Don't save pointsPerClick or pointsPerSecond - they should be calculated from upgrades for (var i = 0; i < upgrades.length; i++) { var upgrade = upgrades[i]; var baseName = upgrade.name.replace(/\s+/g, ''); storage[baseName.toLowerCase() + 'Cost'] = upgrade.cost; storage[baseName.toLowerCase() + 'Owned'] = upgrade.owned; } // Save relaxation preferences storage.relaxationPreferences = relaxationPreferences; } // Statistics button interaction statsButton.down = function (x, y, obj) { showingStats = !showingStats; if (showingStats) { statsPanel.updateStats(); tween(statsPanel, { alpha: 1 }, { duration: 300, easing: tween.easeOut }); } else { tween(statsPanel, { alpha: 0 }, { duration: 300, easing: tween.easeOut }); } }; // Initialize prestige orbs if player has prestige levels if (prestigeLevel > 0) { createMultiplierOrbs(); } // Create floating particles for visual appeal createFloatingParticles(); // Meditation and relaxation features var meditationBubbles = []; var relaxationMode = null; var isInRelaxationMode = false; var relaxationPreferences = storage.relaxationPreferences || { autoRelaxationReminder: true, bubbleIntensity: 1, meditationSoundEnabled: true }; // Dynamic Relaxation Intensity System var stressLevel = 0; // 0-100, higher = more stressed var relaxationIntensity = 1; // 1-3, higher = more calming effects var clickHistory = []; var lastClickTime = 0; var seasonalThemeIndex = 0; var seasonalTimer = 0; // Seasonal zen themes with colors and effects var seasonalThemes = [{ name: "Spring Awakening", colors: [0x98FB98, 0xE6E6FA, 0xF0F8FF, 0xFFF8DC], bgColors: [0x8FBC8F, 0x9370DB, 0x8B4B9C], affirmations: ["New beginnings bloom within you", "Feel the fresh energy of spring", "You are growing beautifully"] }, { name: "Summer Serenity", colors: [0xFFE4B5, 0x87CEEB, 0xF0F8FF, 0xFFFAF0], bgColors: [0xDDA0DD, 0xB0C4DE, 0x8B4B9C], affirmations: ["Bask in the warm glow of peace", "You radiate calm energy", "Feel the gentle summer breeze within"] }, { name: "Autumn Reflection", colors: [0xDEB887, 0xCD853F, 0xF4A460, 0xFFE4B5], bgColors: [0xBC8F8F, 0xCD853F, 0x8B4B9C], affirmations: ["Let go of what no longer serves you", "Find beauty in change", "You are perfectly balanced"] }, { name: "Winter Stillness", colors: [0xF0F8FF, 0xE6E6FA, 0xF5F5F5, 0xFFFAF0], bgColors: [0x6495ED, 0x9370DB, 0x8B4B9C], affirmations: ["Embrace the quiet within", "You are at perfect peace", "Rest in this moment of stillness"] }]; // Mindfulness achievement definitions var mindfulnessAchievements = [{ id: 'mindful_breathing', name: 'Mindful Breather', description: 'Complete 10 breathing cycles', target: 10, current: storage.mindful_breathing || 0, claimed: storage.mindful_breathing_claimed || false }, { id: 'zen_master', name: 'Zen Master', description: 'Maintain low stress for 5 minutes', target: 300, // 5 minutes in seconds current: storage.zen_master || 0, claimed: storage.zen_master_claimed || false }, { id: 'seasonal_harmony', name: 'Seasonal Harmony', description: 'Experience all seasonal themes', target: 4, current: storage.seasonal_harmony || 0, claimed: storage.seasonal_harmony_claimed || false }]; function calculateStressLevel() { var currentTime = Date.now(); // Remove old clicks (older than 10 seconds) clickHistory = clickHistory.filter(function (clickTime) { return currentTime - clickTime < 10000; }); // Calculate stress based on click frequency var clicksPerSecond = clickHistory.length / 10; if (clicksPerSecond > 5) { stressLevel = Math.min(100, stressLevel + 2); } else if (clicksPerSecond < 1) { stressLevel = Math.max(0, stressLevel - 1); } // Determine relaxation intensity based on stress if (stressLevel > 70) { relaxationIntensity = 3; // Maximum calming effects } else if (stressLevel > 40) { relaxationIntensity = 2; // Moderate calming effects } else { relaxationIntensity = 1; // Base level effects } } function updateSeasonalTheme() { seasonalTimer++; // Change theme every 2 minutes (7200 ticks at 60fps) if (seasonalTimer >= 7200) { seasonalTimer = 0; seasonalThemeIndex = (seasonalThemeIndex + 1) % seasonalThemes.length; // Update mindfulness achievement var uniqueThemes = storage.seasonal_themes_seen || []; if (uniqueThemes.indexOf(seasonalThemeIndex) === -1) { uniqueThemes.push(seasonalThemeIndex); storage.seasonal_themes_seen = uniqueThemes; mindfulnessAchievements[2].current = uniqueThemes.length; } // Show theme transition effect var themeText = new Text2('~ ' + seasonalThemes[seasonalThemeIndex].name + ' ~', { size: 48, fill: seasonalThemes[seasonalThemeIndex].colors[0] }); themeText.anchor.set(0.5, 0.5); themeText.x = 1024; themeText.y = 500; themeText.alpha = 0; game.addChild(themeText); tween(themeText, { alpha: 0.8, scaleX: 1.2, scaleY: 1.2 }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { tween(themeText, { alpha: 0, y: themeText.y - 100 }, { duration: 1500, easing: tween.easeOut, onFinish: function onFinish() { themeText.destroy(); } }); } }); } } function createStressReliefEffect() { if (stressLevel > 50) { // Create extra calming bubbles when stressed for (var i = 0; i < relaxationIntensity; i++) { var calmingBubble = new MeditationBubble(); calmingBubble.x = summer.x + (Math.random() - 0.5) * 400; calmingBubble.y = summer.y + (Math.random() - 0.5) * 400; // Use current seasonal theme colors var currentTheme = seasonalThemes[seasonalThemeIndex]; calmingBubble.children[0].tint = currentTheme.colors[Math.floor(Math.random() * currentTheme.colors.length)]; game.addChild(calmingBubble); calmingBubble.startFloating(); } // Play extra soothing sounds for high stress if (relaxationPreferences.meditationSoundEnabled && Math.random() < 0.3) { LK.getSound('windChimes').play(); } } } function createMeditationBubbles() { var bubbleCount = Math.floor(3 * relaxationPreferences.bubbleIntensity); for (var i = 0; i < bubbleCount; i++) { var bubble = new MeditationBubble(); bubble.x = Math.random() * 2048; bubble.y = 2732 + Math.random() * 200; meditationBubbles.push(bubble); game.addChild(bubble); bubble.startFloating(); } } function enterRelaxationMode() { if (isInRelaxationMode) { return; } isInRelaxationMode = true; relaxationMode = new RelaxationMode(); relaxationMode.x = 1024; relaxationMode.y = 1366; game.addChild(relaxationMode); relaxationMode.startRelaxation(); if (relaxationPreferences.meditationSoundEnabled) { LK.getSound('meditation').play(); } // Slow down all animations for (var i = 0; i < zenBreathingOrbs.length; i++) { tween.stop(zenBreathingOrbs[i]); } } function exitRelaxationMode() { if (!isInRelaxationMode) { return; } isInRelaxationMode = false; if (relaxationMode) { relaxationMode.destroy(); relaxationMode = null; } // Resume normal zen breathing for (var i = 0; i < zenBreathingOrbs.length; i++) { zenBreathingOrbs[i].startBreathing(); } } // Create zen breathing orbs system with enhanced tranquility var zenBreathingOrbs = []; function createZenBreathingOrbs() { var orbCount = 12; // More orbs for deeper zen atmosphere for (var i = 0; i < orbCount; i++) { var orb = new ZenBreathingOrb(); orb.x = 150 + Math.random() * 1748; // Wider distribution orb.y = 350 + Math.random() * 2032; // Cover more area zenBreathingOrbs.push(orb); game.addChild(orb); orb.startBreathing(); // Add gentle rotation for extra mesmerizing effect tween(orb, { rotation: orb.rotation + Math.PI * 2 }, { duration: 30000 + Math.random() * 20000, // Very slow rotation easing: tween.linear, onFinish: function onFinish() { // Continue rotating indefinitely tween(orb, { rotation: orb.rotation + Math.PI * 2 }, { duration: 30000, easing: tween.linear }); } }); } } // Initialize zen breathing orbs createZenBreathingOrbs(); // CHAOS VARIABLES var chaoticDog = null; var chaoticBullets = []; var chaosPortals = []; var chaosMode = false; var chaosTimer = 0; var screenShakeIntensity = 0; var randomEventTimer = 0; var insanityLevel = 0; var colorChaos = false; var explosionQueue = []; // FEVER DREAM VARIABLES var realityDistortionLevel = 0; var psychedelicColorPhase = 0; var timeDistortion = 1; var dreamSequenceActive = false; var hallucinationTimer = 0; var colorShiftIntensity = 0; var perspectiveWarping = false; var dreamParticles = []; var realityGlitches = []; var psychedelicTrails = []; // Create chaotic dog with gun chaoticDog = new ChaoticDogWithGun(); chaoticDog.x = 300; chaoticDog.y = 800; game.addChild(chaoticDog); // Create chaos portals for (var i = 0; i < 3; i++) { var portal = new ChaosPortal(); portal.x = 200 + i * 600; portal.y = 400 + Math.random() * 200; chaosPortals.push(portal); game.addChild(portal); } // Create tutorial text in the empty center-left area var tutorialPanel = new TutorialText(); tutorialPanel.x = 400; // Center-left position to avoid overlapping with other UI tutorialPanel.y = 900; // Middle height position game.addChild(tutorialPanel); // Create breathing guide for ultimate relaxation var breathingGuide = new BreathingGuide(); breathingGuide.x = 1024; breathingGuide.y = 800; game.addChild(breathingGuide); breathingGuide.startBreathingGuide(); // Soothing waves system var soothingWaves = []; function createSoothingWave() { var wave = new SoothingWave(); wave.x = Math.random() * 2048; wave.y = 1200 + Math.random() * 800; soothingWaves.push(wave); game.addChild(wave); wave.startWave(); } // Relaxing affirmations system var affirmationTimer = 0; function showRelaxingAffirmation() { var affirmation = new RelaxingAffirmation(); affirmation.x = 1024; affirmation.y = 600 + Math.random() * 400; game.addChild(affirmation); affirmation.showAffirmation(); } // Create floating stars system var floatingStars = []; function createFloatingStars() { var starCount = 20; for (var i = 0; i < starCount; i++) { var star = new FloatingStar(); star.x = Math.random() * 2048; star.y = Math.random() * 2732; floatingStars.push(star); game.addChild(star); star.startTwinkle(); } } // Zen background color wave effect var zenColorWave = 0; var zenColors = [0x8B4B9C, // Original purple 0x9370DB, // Medium slate blue 0x7B68EE, // Medium slate blue 0x6A5ACD, // Slate blue 0x8A2BE2 // Blue violet ]; var currentZenColorIndex = 0; function updateZenBackgroundWave() { zenColorWave += 0.008; // Very slow transition for zen feeling // Use seasonal theme colors if available var currentTheme = seasonalThemes[seasonalThemeIndex]; var activeZenColors = currentTheme ? currentTheme.bgColors : zenColors; // Transition between zen colors very slowly if (zenColorWave >= Math.PI * 2) { zenColorWave = 0; currentZenColorIndex = (currentZenColorIndex + 1) % activeZenColors.length; } var nextColorIndex = (currentZenColorIndex + 1) % activeZenColors.length; var currentColor = activeZenColors[currentZenColorIndex]; var nextColor = activeZenColors[nextColorIndex]; // Smooth transition between colors var transition = (Math.sin(zenColorWave) + 1) * 0.5; var currentRed = currentColor >> 16 & 0xFF; var currentGreen = currentColor >> 8 & 0xFF; var currentBlue = currentColor & 0xFF; var nextRed = nextColor >> 16 & 0xFF; var nextGreen = nextColor >> 8 & 0xFF; var nextBlue = nextColor & 0xFF; var red = Math.floor(currentRed + (nextRed - currentRed) * transition); var green = Math.floor(currentGreen + (nextGreen - currentGreen) * transition); var blue = Math.floor(currentBlue + (nextBlue - currentBlue) * transition); var finalColor = red << 16 | green << 8 | blue; game.setBackgroundColor(finalColor); } // Initialize floating stars createFloatingStars(); // Initial UI update updateUI(); // Start peaceful background music LK.playMusic('peacefulBgMusic'); // Touch controls for scrolling game.down = function (x, y, obj) { if (x > 1550) { // Adjust for new upgrade container position isDragging = true; lastTouchY = y; } }; game.up = function (x, y, obj) { isDragging = false; }; game.move = function (x, y, obj) { if (isDragging && x > 1550) { // Adjust for new upgrade container position var deltaY = y - lastTouchY; scrollY = Math.max(0, Math.min(maxScroll, scrollY - deltaY)); upgradeContainer.y = 350 - scrollY; lastTouchY = y; } }; game.update = function () { // Update time played var currentTime = Date.now(); timePlayed += (currentTime - gameStartTime) / 1000; gameStartTime = currentTime; // Track clicks per second if (currentTime - lastSecondTime >= 1000) { var currentCPS = clicksInLastSecond; if (currentCPS > highestCPS) { highestCPS = currentCPS; } clicksInLastSecond = 0; lastSecondTime = currentTime; } // Update active boosts updateBoostMultiplier(); // Auto-clicker logic autoClickTimer++; if (autoClickTimer >= 60) { // Every second at 60 FPS var autoBoost = activeBoosts.auto ? activeBoosts.auto.multiplier : 1; var allBoost = activeBoosts.all ? activeBoosts.all.multiplier : 1; var autoPoints = pointsPerSecond * prestigeMultiplier * autoBoost * allBoost; points += autoPoints; totalPointsEarned += autoPoints; autoClickTimer = 0; updateAchievements(); updateUI(); if (pointsPerSecond > 0) { saveGame(); } } // Update boost buttons for (var i = 0; i < boostButtons.length; i++) { boostButtons[i].updateDisplay(); } // Update clicker features updateClickPowerUps(); // Update combo timer if (comboTimer > 0) { comboTimer--; if (comboTimer <= 0 && comboCount > 1) { // Combo ended, reset comboCount = 0; comboMultiplier = 1; } } // Increase critical chance based on upgrades and combo criticalChance = 0.05 + totalUpgradesPurchased * 0.001 + comboCount * 0.002; criticalChance = Math.min(criticalChance, 0.5); // Cap at 50% // Update stress level and relaxation systems calculateStressLevel(); updateSeasonalTheme(); // Create stress relief effects when needed if (LK.ticks % (180 - relaxationIntensity * 30) === 0) { // More frequent when stressed createStressReliefEffect(); } // Update zen master achievement (low stress for 5 minutes) if (stressLevel < 30) { mindfulnessAchievements[1].current++; if (mindfulnessAchievements[1].current >= 300) { // 5 minutes storage.zen_master = mindfulnessAchievements[1].current; } } else { mindfulnessAchievements[1].current = 0; // Reset if stress gets high } // Update zen background wave effect updateZenBackgroundWave(); // Update zen breathing orbs for (var i = 0; i < zenBreathingOrbs.length; i++) { zenBreathingOrbs[i].update(); } // Regenerate particles that go off screen for (var i = floatingParticles.length - 1; i >= 0; i--) { var particle = floatingParticles[i]; if (particle.x < -100 || particle.x > 2148 || particle.y < -100 || particle.y > 2832) { particle.destroy(); floatingParticles.splice(i, 1); // Create new particle to replace it var newParticle = new FloatingParticle(); newParticle.x = Math.random() * 2048; newParticle.y = Math.random() * 2732; floatingParticles.push(newParticle); game.addChild(newParticle); newParticle.startFloat(); } } // Regenerate stars that drift off screen for (var i = floatingStars.length - 1; i >= 0; i--) { var star = floatingStars[i]; // Stars wrap around automatically in their update, so no need to recreate } // Create gentle zen particles around summer instead of rainbow burst if (LK.ticks % 240 === 0) { // Every 4 seconds - slower for more zen feeling for (var i = 0; i < 3; i++) { var zenParticle = new FloatingParticle(); zenParticle.x = summer.x + (Math.random() - 0.5) * 300; zenParticle.y = summer.y + (Math.random() - 0.5) * 300; // Apply zen colors to particles var zenParticleColors = [0xE6E6FA, 0xF0F8FF, 0x98FB98, 0x87CEEB, 0xFFE4B5]; zenParticle.attachedGraphics = zenParticle.children[0]; if (zenParticle.attachedGraphics) { zenParticle.attachedGraphics.tint = zenParticleColors[Math.floor(Math.random() * zenParticleColors.length)]; zenParticle.attachedGraphics.alpha = 0.2; } floatingParticles.push(zenParticle); game.addChild(zenParticle); zenParticle.startFloat(); } } // Add gentle sparkles around the main play area if (LK.ticks % 120 === 0) { // Every 2 seconds var sparkle = new ClickEffect(); sparkle.x = 400 + Math.random() * 800; sparkle.y = 1200 + Math.random() * 600; game.addChild(sparkle); sparkle.animate(); } // Create meditation bubbles periodically if (LK.ticks % 300 === 0) { // Every 5 seconds createMeditationBubbles(); } // Create soothing waves periodically for ultimate relaxation if (LK.ticks % 240 === 0) { // Every 4 seconds createSoothingWave(); } // Show peaceful affirmations periodically affirmationTimer++; if (affirmationTimer >= 1800) { // Every 30 seconds showRelaxingAffirmation(); affirmationTimer = 0; } // Ambient sound cycling for deep relaxation if (LK.ticks % 900 === 0) { // Every 15 seconds var ambientSounds = ['windChimes', 'gentleWaves', 'softRain']; var randomSound = ambientSounds[Math.floor(Math.random() * ambientSounds.length)]; if (relaxationPreferences.meditationSoundEnabled) { LK.getSound(randomSound).play(); } } // Switch to deeper meditation music occasionally if (LK.ticks % 3600 === 0) { // Every minute if (Math.random() < 0.3) { // 30% chance LK.playMusic('tibetanBowls', { fade: { start: 0, end: 0.2, duration: 2000 } }); } } // Update meditation bubbles for (var i = meditationBubbles.length - 1; i >= 0; i--) { var bubble = meditationBubbles[i]; if (bubble.y < -100) { bubble.destroy(); meditationBubbles.splice(i, 1); } } // Update relaxation mode if (isInRelaxationMode && relaxationMode) { relaxationMode.update(); } // CHAOS UPDATES if (chaoticDog) { chaoticDog.update(); } // Update chaotic bullets for (var i = chaoticBullets.length - 1; i >= 0; i--) { var bullet = chaoticBullets[i]; bullet.update(); if (bullet.life <= 0) { chaoticBullets.splice(i, 1); } } // Update chaos portals for (var i = 0; i < chaosPortals.length; i++) { chaosPortals[i].update(); } // Screen shake effect if (screenShakeIntensity > 0) { game.x = (Math.random() - 0.5) * screenShakeIntensity; game.y = (Math.random() - 0.5) * screenShakeIntensity; screenShakeIntensity *= 0.9; if (screenShakeIntensity < 0.1) { screenShakeIntensity = 0; game.x = 0; game.y = 0; } } // Random chaos events randomEventTimer++; if (randomEventTimer >= 60) { // Every second now - MORE CHAOS randomEventTimer = 0; var randomEvent = Math.floor(Math.random() * 12); // More random events switch (randomEvent) { case 0: // Color chaos colorChaos = !colorChaos; if (colorChaos) { var randomColor = Math.floor(Math.random() * 0xFFFFFF); game.setBackgroundColor(randomColor); } break; case 1: // Spawn explosion at random location var randomExplosion = new ExplodingClickEffect(); randomExplosion.x = Math.random() * 2048; randomExplosion.y = Math.random() * 2732; game.addChild(randomExplosion); break; case 2: // Make dog go crazy if (chaoticDog) { chaoticDog.craziness = 20; chaoticDog.startChaos(); } break; case 3: // Flash random color var flashColor = Math.floor(Math.random() * 0xFFFFFF); LK.effects.flashScreen(flashColor, 300); break; case 4: // Multiply points randomly var multiplier = 1 + Math.random() * 10; points *= multiplier; break; case 5: // Teleport all upgrade buttons randomly for (var i = 0; i < upgradeButtons.length; i++) { tween(upgradeButtons[i], { x: (Math.random() - 0.5) * 800, y: upgradeButtons[i].y + (Math.random() - 0.5) * 500 }, { duration: 1000, easing: tween.bounceOut }); } break; case 6: // Make everything giant then tiny var elements = [pointsDisplay, perSecondDisplay, prestigeDisplay]; for (var i = 0; i < elements.length; i++) { var element = elements[i]; if (element && _typeof(element) === 'object') { tween(element, { scaleX: 3, scaleY: 3 }, { duration: 200, easing: tween.bounceOut, onFinish: function onFinish() { tween(element, { scaleX: 0.5, scaleY: 0.5 }, { duration: 300, easing: tween.elasticOut, onFinish: function onFinish() { tween(element, { scaleX: 1, scaleY: 1 }, { duration: 400, easing: tween.bounceOut }); } }); } }); } } break; case 7: // Spawn mega chaos portal var megaPortal = new MegaChaosPortal(); megaPortal.x = Math.random() * 2048; megaPortal.y = Math.random() * 2732; game.addChild(megaPortal); break; case 8: // Make dog spin wildly tween(summer, { rotation: summer.rotation + Math.PI * 10 }, { duration: 2000, easing: tween.elasticOut }); break; case 9: // Random tint everything var randomTint = Math.floor(Math.random() * 0xFFFFFF); summer.tint = randomTint; for (var i = 0; i < upgradeButtons.length; i++) { upgradeButtons[i].tint = Math.floor(Math.random() * 0xFFFFFF); } break; case 10: // Shake everything violently screenShakeIntensity = 50; break; case 11: // Spawn 50 explosions everywhere for (var i = 0; i < 50; i++) { var crazyExplosion = new ExplodingClickEffect(); crazyExplosion.x = Math.random() * 2048; crazyExplosion.y = Math.random() * 2732; game.addChild(crazyExplosion); } break; } } // Chaos mode effects if (chaosMode) { chaosTimer++; if (chaosTimer % 10 === 0) { // Every 6 frames - MUCH MORE FREQUENT // Spawn random explosions everywhere for (var i = 0; i < 10; i++) { var chaosExplosion = new ExplodingClickEffect(); chaosExplosion.x = Math.random() * 2048; chaosExplosion.y = Math.random() * 2732; game.addChild(chaosExplosion); } // Random screen flashes var randomColor = Math.floor(Math.random() * 0xFFFFFF); LK.effects.flashScreen(randomColor, 50); // Random background colors game.setBackgroundColor(Math.floor(Math.random() * 0xFFFFFF)); // Make everything morph constantly tween(summer, { scaleX: 0.5 + Math.random() * 2, scaleY: 0.5 + Math.random() * 2, rotation: summer.rotation + (Math.random() - 0.5) * Math.PI }, { duration: 100, easing: tween.bounceOut }); // Morph upgrade container tween(upgradeContainer, { scaleX: 0.3 + Math.random() * 1.4, scaleY: 0.3 + Math.random() * 1.4, rotation: upgradeContainer.rotation + (Math.random() - 0.5) * Math.PI * 0.5 }, { duration: 150, easing: tween.elasticOut }); // Teleport dog randomly if (Math.random() < 0.3) { tween(summer, { x: 200 + Math.random() * 1600, y: 400 + Math.random() * 1800 }, { duration: 50, easing: tween.bounceOut }); } } // NEVER RESET CHAOS MODE - PERMANENT INSANITY if (chaosTimer >= 1200) { // After 20 seconds, make it even MORE chaotic chaosTimer = 0; insanityLevel += 50; // Keep increasing insanity } } // Make everything spin when insanity is high if (insanityLevel > 50) { summer.rotation += 0.1; for (var i = 0; i < upgradeButtons.length; i++) { upgradeButtons[i].rotation += 0.05; } } // EXTREME CHAOS EFFECTS if (insanityLevel > 75) { // Make ALL UI elements spin wildly pointsDisplay.rotation += 0.2; perSecondDisplay.rotation -= 0.15; prestigeDisplay.rotation += 0.1; dogParkTitle.rotation += 0.3; insanityDisplay.rotation -= 0.25; comboDisplay.rotation += 0.18; zenMeter.rotation -= 0.12; themeIndicator.rotation += 0.22; } // CHAOTIC SCALING AND MORPHING if (chaosMode) { // Make everything pulsate and morph var chaosScale = 1 + Math.sin(LK.ticks * 0.1) * 0.3; var chaosScale2 = 1 + Math.cos(LK.ticks * 0.08) * 0.2; summer.scaleX = chaosScale; summer.scaleY = chaosScale2; // Make UI elements randomly scale if (LK.ticks % 5 === 0) { tween(pointsDisplay, { scaleX: 0.5 + Math.random() * 1.5, scaleY: 0.5 + Math.random() * 1.5 }, { duration: 200, easing: tween.bounceOut }); } // Randomly move upgrade buttons if (LK.ticks % 20 === 0) { for (var i = 0; i < upgradeButtons.length; i++) { tween(upgradeButtons[i], { x: (Math.random() - 0.5) * 200, y: upgradeButtons[i].y + (Math.random() - 0.5) * 100 }, { duration: 500, easing: tween.elasticOut }); } } } // INSANITY LEVEL EFFECTS if (insanityLevel > 80) { // Make the entire upgrade container dance tween(upgradeContainer, { rotation: upgradeContainer.rotation + Math.PI * 0.1, scaleX: 0.8 + Math.random() * 0.4, scaleY: 0.8 + Math.random() * 0.4 }, { duration: 100, easing: tween.linear }); } // ULTIMATE CHAOS AT MAX INSANITY if (insanityLevel >= 100) { // Make EVERYTHING go completely insane if (LK.ticks % 10 === 0) { var elements = [pointsDisplay, perSecondDisplay, prestigeDisplay, dogParkTitle, insanityDisplay, comboDisplay, zenMeter, themeIndicator]; for (var i = 0; i < elements.length; i++) { var element = elements[i]; if (element && _typeof(element) === 'object') { tween(element, { x: element.x + (Math.random() - 0.5) * 500, y: element.y + (Math.random() - 0.5) * 300, rotation: element.rotation + (Math.random() - 0.5) * Math.PI, scaleX: 0.3 + Math.random() * 2, scaleY: 0.3 + Math.random() * 2, alpha: 0.3 + Math.random() * 0.7 }, { duration: 300, easing: tween.bounceOut }); } } } } // FEVER DREAM EFFECTS realityDistortionLevel = Math.min(200, realityDistortionLevel + 0.5); psychedelicColorPhase += 0.15; hallucinationTimer++; // Psychedelic color shifting - make everything rainbow and trippy if (realityDistortionLevel > 50) { var rainbowR = Math.floor(127 + Math.sin(psychedelicColorPhase) * 127); var rainbowG = Math.floor(127 + Math.sin(psychedelicColorPhase + Math.PI * 2 / 3) * 127); var rainbowB = Math.floor(127 + Math.sin(psychedelicColorPhase + Math.PI * 4 / 3) * 127); var psychedelicColor = rainbowR << 16 | rainbowG << 8 | rainbowB; // Make background shift through rainbow colors game.setBackgroundColor(psychedelicColor); // Make UI elements rainbow too pointsDisplay.tint = psychedelicColor; perSecondDisplay.tint = (psychedelicColor + 0x333333) % 0xFFFFFF; prestigeDisplay.tint = (psychedelicColor + 0x666666) % 0xFFFFFF; dogParkTitle.tint = (psychedelicColor + 0x999999) % 0xFFFFFF; } // Time distortion effects - make everything feel dreamlike if (realityDistortionLevel > 75) { timeDistortion = 1 + Math.sin(LK.ticks * 0.1) * 0.8; // Make everything move in slow motion or fast forward randomly if (LK.ticks % 60 === 0) { var allElements = [summer, upgradeContainer, prestigeButton, achievementContainer, boostContainer]; for (var i = 0; i < allElements.length; i++) { var element = allElements[i]; if (element && _typeof2(element) === 'object') { var timeWarp = 0.3 + Math.random() * 2; tween(element, { scaleX: element.scaleX * timeWarp, scaleY: element.scaleY * timeWarp }, { duration: 2000 + Math.random() * 3000, easing: tween.easeInOut, onFinish: function onFinish() { tween(element, { scaleX: 1, scaleY: 1 }, { duration: 1000, easing: tween.easeOut }); } }); } } } } // Perspective warping - make things feel like they're bending reality if (realityDistortionLevel > 100) { perspectiveWarping = true; // Make the entire game world warp and bend var warpStrength = Math.sin(LK.ticks * 0.05) * 50; game.x = warpStrength; game.y = Math.cos(LK.ticks * 0.07) * 30; game.rotation = Math.sin(LK.ticks * 0.03) * 0.1; // Make individual elements float and drift summer.y += Math.sin(LK.ticks * 0.08) * 2; summer.x += Math.cos(LK.ticks * 0.06) * 1.5; upgradeContainer.rotation += Math.sin(LK.ticks * 0.04) * 0.02; upgradeContainer.y += Math.cos(LK.ticks * 0.09) * 3; } // Hallucination effects - spawn fake objects that fade away if (hallucinationTimer % 120 === 0 && realityDistortionLevel > 80) { // Create fake dogs that aren't real for (var i = 0; i < 3; i++) { var fakeDog = new DogPark(); fakeDog.x = Math.random() * 2048; fakeDog.y = Math.random() * 2732; fakeDog.alpha = 0.3 + Math.random() * 0.4; fakeDog.tint = Math.floor(Math.random() * 0xFFFFFF); fakeDog.scaleX = 0.5 + Math.random() * 1.5; fakeDog.scaleY = 0.5 + Math.random() * 1.5; game.addChild(fakeDog); // Make it fade away and move weirdly tween(fakeDog, { alpha: 0, x: fakeDog.x + (Math.random() - 0.5) * 500, y: fakeDog.y + (Math.random() - 0.5) * 500, rotation: fakeDog.rotation + Math.PI * 2, scaleX: fakeDog.scaleX * 2, scaleY: fakeDog.scaleY * 2 }, { duration: 3000 + Math.random() * 2000, easing: tween.easeOut, onFinish: function onFinish() { fakeDog.destroy(); } }); } } // Dream particle effects - floating geometric shapes if (LK.ticks % 30 === 0 && realityDistortionLevel > 60) { for (var i = 0; i < 5; i++) { var dreamParticle = new FloatingParticle(); dreamParticle.x = Math.random() * 2048; dreamParticle.y = Math.random() * 2732; dreamParticle.alpha = 0.2 + Math.random() * 0.3; dreamParticle.tint = Math.floor(Math.random() * 0xFFFFFF); dreamParticle.scaleX = 0.1 + Math.random() * 0.5; dreamParticle.scaleY = 0.1 + Math.random() * 0.5; dreamParticles.push(dreamParticle); game.addChild(dreamParticle); // Make them move in impossible ways tween(dreamParticle, { x: dreamParticle.x + (Math.random() - 0.5) * 1000, y: dreamParticle.y + (Math.random() - 0.5) * 1000, rotation: dreamParticle.rotation + Math.PI * 4, scaleX: dreamParticle.scaleX * 5, scaleY: dreamParticle.scaleY * 5, alpha: 0 }, { duration: 4000 + Math.random() * 3000, easing: tween.easeInOut, onFinish: function onFinish() { dreamParticle.destroy(); } }); } } // Reality glitches - make parts of the screen "tear" and glitch if (realityDistortionLevel > 120) { if (LK.ticks % 45 === 0) { // Create glitch strips for (var i = 0; i < 8; i++) { var glitchStrip = LK.getAsset('clickEffect', { anchorX: 0.5, anchorY: 0.5, scaleX: 20, scaleY: 0.5, alpha: 0.8 }); glitchStrip.x = Math.random() * 2048; glitchStrip.y = Math.random() * 2732; glitchStrip.tint = Math.floor(Math.random() * 0xFFFFFF); game.addChild(glitchStrip); // Make them glitch and disappear tween(glitchStrip, { x: glitchStrip.x + (Math.random() - 0.5) * 200, scaleY: glitchStrip.scaleY * 10, alpha: 0 }, { duration: 500 + Math.random() * 1000, easing: tween.easeOut, onFinish: function onFinish() { glitchStrip.destroy(); } }); } } } // Psychedelic trails - leave colorful trails behind moving objects if (realityDistortionLevel > 90) { if (LK.ticks % 10 === 0) { var trail = new FloatingParticle(); trail.x = summer.x; trail.y = summer.y; trail.alpha = 0.5; trail.tint = Math.floor(Math.random() * 0xFFFFFF); trail.scaleX = 0.8; trail.scaleY = 0.8; psychedelicTrails.push(trail); game.addChild(trail); tween(trail, { alpha: 0, scaleX: 0.3, scaleY: 0.3 }, { duration: 2000, easing: tween.easeOut, onFinish: function onFinish() { trail.destroy(); } }); } } // Make numbers and text morph and change randomly if (realityDistortionLevel > 150) { if (LK.ticks % 20 === 0) { // Make point display show weird numbers var fakePoints = points + (Math.random() - 0.5) * points * 0.5; pointsDisplay.setText('Points: ' + Math.floor(fakePoints)); // Make other text elements show surreal content var surealTexts = ['Reality is melting...', 'The dog sees everything...', 'Time flows backwards...', 'You are the click...', 'Numbers have feelings...', 'The void barks back...']; if (Math.random() < 0.3) { dogParkTitle.setText(surealTexts[Math.floor(Math.random() * surealTexts.length)]); } } } // Dream sequence activation - everything becomes ethereal if (realityDistortionLevel > 180) { if (!dreamSequenceActive) { dreamSequenceActive = true; // Make everything become transparent and floaty var allElements = [summer, upgradeContainer, prestigeButton, achievementContainer, boostContainer]; for (var i = 0; i < allElements.length; i++) { var element = allElements[i]; if (element && _typeof2(element) === 'object') { tween(element, { alpha: 0.3 + Math.random() * 0.4, scaleX: element.scaleX * (0.8 + Math.random() * 0.4), scaleY: element.scaleY * (0.8 + Math.random() * 0.4) }, { duration: 3000, easing: tween.easeInOut }); } } } // Make everything float and phase in and out of existence if (LK.ticks % 60 === 0) { var elements = [pointsDisplay, perSecondDisplay, prestigeDisplay, dogParkTitle, insanityDisplay]; for (var i = 0; i < elements.length; i++) { var element = elements[i]; if (element && _typeof2(element) === 'object') { tween(element, { alpha: 0.1 + Math.random() * 0.9, y: element.y + (Math.random() - 0.5) * 100, rotation: element.rotation + (Math.random() - 0.5) * Math.PI * 0.5 }, { duration: 2000 + Math.random() * 2000, easing: tween.easeInOut }); } } } } // Random teleportation of main dog if (Math.random() < 0.01) { // 1% chance per frame summer.x = 500 + Math.random() * 1000; summer.y = 800 + Math.random() * 800; LK.effects.flashScreen(0x00FFFF, 200); } // Save periodically if (LK.ticks % 300 === 0) { // Every 5 seconds saveGame(); } };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Achievement = Container.expand(function (achievementData) {
var self = Container.call(this);
var badgeGraphics = self.attachAsset('achievementBadge', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
});
self.achievementData = achievementData;
var nameText = new Text2(achievementData.name, {
size: 30,
fill: 0xFFFFFF
});
nameText.anchor.set(0.5, 0.5);
nameText.y = 60;
self.addChild(nameText);
var progressText = new Text2('0/' + achievementData.target, {
size: 26,
fill: 0xCCCCCC
});
progressText.anchor.set(0.5, 0.5);
progressText.y = 85;
self.addChild(progressText);
self.updateProgress = function () {
var progress = Math.min(achievementData.current, achievementData.target);
progressText.setText(progress + '/' + achievementData.target);
if (achievementData.completed && !achievementData.claimed) {
badgeGraphics.tint = 0xFFD700; // Gold when ready to claim
tween(badgeGraphics, {
rotation: badgeGraphics.rotation + Math.PI * 2
}, {
duration: 2000,
easing: tween.linear
});
} else if (achievementData.claimed) {
badgeGraphics.tint = 0x888888; // Gray when claimed
} else {
badgeGraphics.tint = 0xFFFFFF; // White when in progress
}
};
self.down = function (x, y, obj) {
if (achievementData.completed && !achievementData.claimed) {
claimAchievement(achievementData);
}
};
return self;
});
var BoostButton = Container.expand(function (boostData) {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('boostButton', {
anchorX: 0.5,
anchorY: 0.5
});
self.boostData = boostData;
var nameText = new Text2(boostData.name, {
size: 40,
fill: 0xFFFFFF
});
nameText.anchor.set(0.5, 0.5);
nameText.y = -15;
self.addChild(nameText);
var costText = new Text2('Cost: ' + boostData.cost, {
size: 30,
fill: 0xFFFF00
});
costText.anchor.set(0.5, 0.5);
costText.y = 15;
self.addChild(costText);
self.updateDisplay = function () {
if (points >= boostData.cost && !activeBoosts[boostData.type]) {
buttonGraphics.tint = 0xFFFFFF;
} else {
buttonGraphics.tint = 0x666666;
}
if (activeBoosts[boostData.type]) {
var timeLeft = Math.ceil((activeBoosts[boostData.type].endTime - Date.now()) / 1000);
costText.setText('Active: ' + timeLeft + 's');
} else {
costText.setText('Cost: ' + boostData.cost);
}
};
self.down = function (x, y, obj) {
if (points >= boostData.cost && !activeBoosts[boostData.type]) {
points -= boostData.cost;
activateBoost(boostData);
updateUI();
saveGame();
}
};
return self;
});
var BreathingGuide = Container.expand(function () {
var self = Container.call(this);
var guideGraphics = self.attachAsset('multiplierOrb', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.3,
scaleX: 2,
scaleY: 2
});
guideGraphics.tint = 0xE6E6FA; // Lavender for calming effect
var breathingText = new Text2('Breathe with the circle', {
size: 36,
fill: 0xF0F8FF
});
breathingText.anchor.set(0.5, 0.5);
breathingText.y = -150;
self.addChild(breathingText);
self.breathingCycle = 0;
self.isBreathingIn = true;
self.startBreathingGuide = function () {
// 4-7-8 breathing technique: inhale 4, hold 7, exhale 8
if (self.isBreathingIn) {
breathingText.setText('Breathe In Slowly...');
// Use seasonal colors if available
var currentTheme = seasonalThemes && seasonalThemes[seasonalThemeIndex] ? seasonalThemes[seasonalThemeIndex] : null;
breathingText.tint = currentTheme ? currentTheme.colors[0] : 0x98FB98;
guideGraphics.tint = currentTheme ? currentTheme.colors[1] : 0xE6E6FA;
tween(guideGraphics, {
scaleX: 4,
scaleY: 4,
alpha: 0.6
}, {
duration: 4000,
easing: tween.easeInOut,
onFinish: function onFinish() {
breathingText.setText('Hold...');
breathingText.tint = currentTheme ? currentTheme.colors[2] : 0xFFE4B5;
LK.setTimeout(function () {
self.isBreathingIn = false;
self.startBreathingGuide();
}, 7000);
}
});
} else {
breathingText.setText('Breathe Out Slowly...');
var currentTheme = seasonalThemes && seasonalThemes[seasonalThemeIndex] ? seasonalThemes[seasonalThemeIndex] : null;
breathingText.tint = currentTheme ? currentTheme.colors[1] : 0x87CEEB;
tween(guideGraphics, {
scaleX: 2,
scaleY: 2,
alpha: 0.2
}, {
duration: 8000,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.isBreathingIn = true;
self.breathingCycle++; // Track completed breathing cycles
// Update mindfulness achievement
if (typeof mindfulnessAchievements !== 'undefined') {
mindfulnessAchievements[0].current++;
storage.mindful_breathing = mindfulnessAchievements[0].current;
}
self.startBreathingGuide();
}
});
}
};
return self;
});
var ChaosPortal = Container.expand(function () {
var self = Container.call(this);
var portalGraphics = self.attachAsset('multiplierOrb', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.7,
scaleX: 2,
scaleY: 2
});
portalGraphics.tint = 0x800080;
self.spawnTimer = 0;
self.rotation = 0;
self.update = function () {
self.rotation += 0.1;
portalGraphics.rotation = self.rotation;
portalGraphics.scaleX = 2 + Math.sin(self.rotation * 2) * 0.5;
portalGraphics.scaleY = 2 + Math.cos(self.rotation * 2) * 0.5;
self.spawnTimer++;
if (self.spawnTimer >= 60) {
self.spawnTimer = 0;
var chaosEffect = new ExplodingClickEffect();
chaosEffect.x = self.x + (Math.random() - 0.5) * 200;
chaosEffect.y = self.y + (Math.random() - 0.5) * 200;
game.addChild(chaosEffect);
}
};
return self;
});
var ChaoticBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('gunBarrel', {
anchorX: 0.5,
anchorY: 0.5
});
bulletGraphics.tint = 0xFF0000;
self.angle = 0;
self.speed = 5;
self.life = 300;
self.bounces = 0;
self.update = function () {
self.x += Math.cos(self.angle) * self.speed;
self.y += Math.sin(self.angle) * self.speed;
self.life--;
bulletGraphics.rotation += 0.2;
if (self.x < 0 || self.x > 2048 || self.y < 0 || self.y > 2732) {
if (self.bounces < 3) {
if (self.x < 0 || self.x > 2048) {
self.angle = Math.PI - self.angle;
}
if (self.y < 0 || self.y > 2732) {
self.angle = -self.angle;
}
self.bounces++;
self.x = Math.max(0, Math.min(2048, self.x));
self.y = Math.max(0, Math.min(2732, self.y));
} else {
self.destroy();
}
}
if (self.life <= 0) {
self.destroy();
}
};
return self;
});
var ChaoticDogWithGun = Container.expand(function () {
var self = Container.call(this);
var dogGraphics = self.attachAsset('dogWithGun', {
anchorX: 0.5,
anchorY: 0.5
});
self.ammo = 100;
self.isShootingMode = false;
self.shootCooldown = 0;
self.randomMovement = 0;
self.craziness = 1;
self.startChaos = function () {
self.isShootingMode = true;
// Wild spinning animation
tween(dogGraphics, {
rotation: dogGraphics.rotation + Math.PI * 8
}, {
duration: 3000,
easing: tween.linear,
onFinish: function onFinish() {
self.startChaos();
}
});
};
self.shootBullet = function () {
if (self.ammo > 0 && self.shootCooldown <= 0) {
var bullet = new ChaoticBullet();
bullet.x = self.x;
bullet.y = self.y;
bullet.angle = Math.random() * Math.PI * 2;
bullet.speed = 3 + Math.random() * 5;
chaoticBullets.push(bullet);
game.addChild(bullet);
self.ammo--;
self.shootCooldown = 5 + Math.random() * 10;
LK.getSound('click').play();
}
};
self.update = function () {
if (self.shootCooldown > 0) {
self.shootCooldown--;
}
self.randomMovement += 0.1;
self.x += Math.sin(self.randomMovement) * self.craziness;
self.y += Math.cos(self.randomMovement * 0.7) * self.craziness;
self.craziness = Math.min(10, self.craziness + 0.01);
if (self.isShootingMode && Math.random() < 0.3) {
self.shootBullet();
}
};
self.down = function (x, y, obj) {
self.startChaos();
self.ammo = 100;
LK.effects.flashScreen(0xFF0000, 200);
};
return self;
});
var ClickEffect = Container.expand(function () {
var self = Container.call(this);
var effectGraphics = self.attachAsset('clickEffect', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.4,
scaleX: 0.3,
scaleY: 0.3
});
// Soft zen colors for click effects
var zenClickColors = [0xE6E6FA, 0xF0F8FF, 0x98FB98, 0x87CEEB, 0xDDA0DD];
effectGraphics.tint = zenClickColors[Math.floor(Math.random() * zenClickColors.length)];
self.animate = function () {
// Gentler, more peaceful click animation
tween(effectGraphics, {
scaleX: 2.2,
scaleY: 2.2,
alpha: 0
}, {
duration: 800,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
// Add gentle rotation for extra zen effect
tween(effectGraphics, {
rotation: effectGraphics.rotation + Math.PI * 0.5
}, {
duration: 800,
easing: tween.easeInOut
});
};
return self;
});
var ClickPowerUp = Container.expand(function (powerUpType) {
var self = Container.call(this);
self.powerUpType = powerUpType;
self.duration = 0;
self.multiplier = 1;
var powerUpGraphics = self.attachAsset('multiplierOrb', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.8,
scaleX: 0.6,
scaleY: 0.6
});
// Different colors for different power-ups
var powerUpColors = {
'speed': 0x00FFFF,
// Cyan for speed boost
'critical': 0xFF6B35,
// Orange for critical boost
'mega': 0xFF1493,
// Deep pink for mega clicks
'combo': 0x32CD32 // Lime green for combo extend
};
powerUpGraphics.tint = powerUpColors[powerUpType] || 0xFFFFFF;
var timerText = new Text2('', {
size: 20,
fill: 0xFFFFFF
});
timerText.anchor.set(0.5, 0.5);
timerText.y = 50;
self.addChild(timerText);
self.activate = function (duration, multiplier) {
self.duration = duration;
self.multiplier = multiplier;
// Pulsing animation
self.startPulse();
};
self.startPulse = function () {
tween(powerUpGraphics, {
scaleX: 0.8,
scaleY: 0.8,
alpha: 1
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(powerUpGraphics, {
scaleX: 0.6,
scaleY: 0.6,
alpha: 0.8
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (self.duration > 0) {
self.startPulse();
}
}
});
}
});
};
self.update = function () {
if (self.duration > 0) {
self.duration--;
var seconds = Math.ceil(self.duration / 60);
timerText.setText(seconds + 's');
if (self.duration <= 0) {
self.expire();
}
}
};
self.expire = function () {
// Fade out animation
tween(self, {
alpha: 0,
scaleX: 0.3,
scaleY: 0.3
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
};
return self;
});
var ComboDisplay = Container.expand(function () {
var self = Container.call(this);
var comboText = new Text2('', {
size: 64,
fill: 0xFFD700
});
comboText.anchor.set(0.5, 0.5);
self.addChild(comboText);
var multiplierText = new Text2('', {
size: 48,
fill: 0xFF6B35
});
multiplierText.anchor.set(0.5, 0.5);
multiplierText.y = 60;
self.addChild(multiplierText);
self.showCombo = function (combo, multiplier) {
comboText.setText('COMBO x' + combo);
multiplierText.setText(multiplier.toFixed(1) + 'x BONUS!');
// Scale up animation
comboText.scaleX = 0.5;
comboText.scaleY = 0.5;
multiplierText.scaleX = 0.5;
multiplierText.scaleY = 0.5;
tween(comboText, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(comboText, {
scaleX: 1,
scaleY: 1
}, {
duration: 100,
easing: tween.easeOut
});
}
});
tween(multiplierText, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 250,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(multiplierText, {
scaleX: 1,
scaleY: 1
}, {
duration: 150,
easing: tween.easeOut
});
}
});
// Color flash effect
if (combo >= 50) {
comboText.tint = 0xFF1493; // Mega combo - hot pink
} else if (combo >= 25) {
comboText.tint = 0xFF6B35; // Super combo - orange
} else if (combo >= 10) {
comboText.tint = 0xFFD700; // Good combo - gold
}
};
self.hide = function () {
tween(self, {
alpha: 0,
scaleX: 0.5,
scaleY: 0.5
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
};
return self;
});
var CriticalHit = Container.expand(function () {
var self = Container.call(this);
var criticalText = new Text2('CRITICAL!', {
size: 72,
fill: 0xFF1493
});
criticalText.anchor.set(0.5, 0.5);
self.addChild(criticalText);
var damageText = new Text2('', {
size: 48,
fill: 0xFFFFFF
});
damageText.anchor.set(0.5, 0.5);
damageText.y = 80;
self.addChild(damageText);
self.showCritical = function (damage) {
damageText.setText('+' + Math.floor(damage));
// Explosive scale animation
criticalText.scaleX = 0.3;
criticalText.scaleY = 0.3;
damageText.scaleX = 0.3;
damageText.scaleY = 0.3;
tween(criticalText, {
scaleX: 1.5,
scaleY: 1.5
}, {
duration: 150,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(criticalText, {
scaleX: 1,
scaleY: 1
}, {
duration: 100,
easing: tween.easeOut
});
}
});
tween(damageText, {
scaleX: 1.3,
scaleY: 1.3
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(damageText, {
scaleX: 1,
scaleY: 1
}, {
duration: 150,
easing: tween.easeOut
});
}
});
// Float up and fade
LK.setTimeout(function () {
tween(self, {
y: self.y - 100,
alpha: 0
}, {
duration: 800,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
}, 500);
};
return self;
});
var DogPark = Container.expand(function () {
var self = Container.call(this);
var dogParkGraphics = self.attachAsset('dogPark', {
anchorX: 0.5,
anchorY: 0.5
});
self.updateSkin = function () {
// Skin system exists but no visual changes needed
};
self.bounce = function () {
// Gentle, relaxing bounce instead of sharp bounce
tween(dogParkGraphics, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 400,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(dogParkGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 600,
easing: tween.easeOut
});
}
});
};
// Add gentle breathing animation to the dog
self.startGentleBreathing = function () {
tween(dogParkGraphics, {
scaleX: 1.03,
scaleY: 1.03
}, {
duration: 3000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(dogParkGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 3000,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.startGentleBreathing();
}
});
}
});
};
// Add gentle floating movement
self.startGentleFloat = function () {
tween(self, {
y: self.y - 8
}, {
duration: 4000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self, {
y: self.y + 8
}, {
duration: 4000,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.startGentleFloat();
}
});
}
});
};
self.down = function (x, y, obj) {
updateBoostMultiplier();
// Combo system
var currentTime = Date.now();
if (currentTime - lastClickTime < 1000) {
// 1 second window for combo
comboCount++;
comboTimer = 180; // 3 seconds to continue combo
} else {
comboCount = 1;
comboTimer = 180;
}
lastClickTime = currentTime;
// Update max combo
if (comboCount > maxCombo) {
maxCombo = comboCount;
storage.maxCombo = maxCombo;
}
// Calculate combo multiplier
if (comboCount >= 10) {
comboMultiplier = 1 + (comboCount - 9) * 0.1; // +10% per combo after 10
} else {
comboMultiplier = 1;
}
// Critical hit calculation
var isCritical = Math.random() < criticalChance;
var critMultiplier = isCritical ? criticalMultiplier : 1;
// Apply power-up effects
var powerUpMultiplier = 1;
for (var i = 0; i < clickPowerUps.length; i++) {
var powerUp = clickPowerUps[i];
if (powerUp.powerUpType === 'mega') {
powerUpMultiplier *= powerUp.multiplier;
} else if (powerUp.powerUpType === 'critical' && isCritical) {
critMultiplier *= powerUp.multiplier;
}
}
var clickBoost = activeBoosts.click ? activeBoosts.click.multiplier : 1;
var allBoost = activeBoosts.all ? activeBoosts.all.multiplier : 1;
var basePoints = (1 + pointsPerClick) * prestigeMultiplier * clickBoost * allBoost * comboMultiplier * critMultiplier * powerUpMultiplier;
points += basePoints;
totalPointsEarned += basePoints;
totalClicks += 1;
clicksInLastSecond++;
if (isCritical) {
totalCriticalHits++;
storage.totalCriticalHits = totalCriticalHits;
}
// Show combo display
if (comboCount >= 5 && comboCount % 5 === 0) {
var comboDisplay = new ComboDisplay();
comboDisplay.x = self.x + 200;
comboDisplay.y = self.y;
game.addChild(comboDisplay);
comboDisplay.showCombo(comboCount, comboMultiplier);
// Hide combo display after 2 seconds
LK.setTimeout(function () {
comboDisplay.hide();
}, 2000);
}
// Random power-up chance
if (Math.random() < 0.01) {
// 1% chance
createRandomPowerUp();
}
// Track click for stress level calculation
if (typeof clickHistory !== 'undefined') {
clickHistory.push(Date.now());
lastClickTime = Date.now();
}
checkSkinUnlock();
self.bounce();
LK.getSound('click').play();
// Create EXPLOSIVE effects instead of zen ripples
var explosion = new ExplodingClickEffect();
explosion.x = x;
explosion.y = y;
game.addChild(explosion);
// Random chance to spawn MORE chaos
if (Math.random() < 0.3) {
for (var i = 0; i < 5; i++) {
var chaosEffect = new ExplodingClickEffect();
chaosEffect.x = self.x + (Math.random() - 0.5) * 300;
chaosEffect.y = self.y + (Math.random() - 0.5) * 300;
game.addChild(chaosEffect);
}
}
// EXTREME CHAOS EXPLOSIONS
if (insanityLevel > 60) {
// Spawn TONS of explosions everywhere
for (var i = 0; i < 15; i++) {
var megaExplosion = new ExplodingClickEffect();
megaExplosion.x = Math.random() * 2048;
megaExplosion.y = Math.random() * 2732;
game.addChild(megaExplosion);
}
}
// FEVER DREAM CLICK EFFECTS
realityDistortionLevel += 2;
// Make click create reality ripples
if (realityDistortionLevel > 50) {
for (var i = 0; i < 8; i++) {
var realityRipple = new ZenRipple();
realityRipple.x = x + (Math.random() - 0.5) * 200;
realityRipple.y = y + (Math.random() - 0.5) * 200;
realityRipple.tint = Math.floor(Math.random() * 0xFFFFFF);
realityRipple.scaleX = 0.1 + Math.random() * 0.3;
realityRipple.scaleY = 0.1 + Math.random() * 0.3;
game.addChild(realityRipple);
realityRipple.animate();
}
}
// Make clicking warp space-time
if (realityDistortionLevel > 100) {
// Create space-time distortion
var distortionRadius = 300;
var distortionStrength = 50;
// Make everything near the click warp and bend
var nearbyElements = [summer, upgradeContainer, prestigeButton];
for (var i = 0; i < nearbyElements.length; i++) {
var element = nearbyElements[i];
if (element && _typeof2(element) === 'object') {
var distance = Math.sqrt(Math.pow(element.x - x, 2) + Math.pow(element.y - y, 2));
if (distance < distortionRadius) {
var warpStrength = (distortionRadius - distance) / distortionRadius * distortionStrength;
tween(element, {
x: element.x + (Math.random() - 0.5) * warpStrength,
y: element.y + (Math.random() - 0.5) * warpStrength,
rotation: element.rotation + (Math.random() - 0.5) * Math.PI * 0.2,
scaleX: element.scaleX * (1 + (Math.random() - 0.5) * 0.3),
scaleY: element.scaleY * (1 + (Math.random() - 0.5) * 0.3)
}, {
duration: 800 + Math.random() * 1200,
easing: tween.elasticOut
});
}
}
}
}
// Psychedelic click response - make the dog phase between dimensions
if (realityDistortionLevel > 75) {
tween(self, {
alpha: 0.3,
tint: Math.floor(Math.random() * 0xFFFFFF),
scaleX: self.scaleX * (1.5 + Math.random()),
scaleY: self.scaleY * (1.5 + Math.random())
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self, {
alpha: 1,
tint: Math.floor(Math.random() * 0xFFFFFF),
scaleX: 1,
scaleY: 1
}, {
duration: 500,
easing: tween.bounceOut
});
}
});
}
// Make clicking create impossible geometry
if (realityDistortionLevel > 120) {
for (var i = 0; i < 5; i++) {
var impossibleShape = new FloatingParticle();
impossibleShape.x = x;
impossibleShape.y = y;
impossibleShape.tint = Math.floor(Math.random() * 0xFFFFFF);
impossibleShape.alpha = 0.7;
impossibleShape.scaleX = 0.2;
impossibleShape.scaleY = 0.2;
game.addChild(impossibleShape);
// Make it move in impossible ways
tween(impossibleShape, {
x: impossibleShape.x + Math.sin(i) * 400,
y: impossibleShape.y + Math.cos(i) * 400,
rotation: impossibleShape.rotation + Math.PI * 4,
scaleX: 3,
scaleY: 3,
alpha: 0
}, {
duration: 2000 + Math.random() * 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
impossibleShape.destroy();
}
});
}
}
// CHAOTIC CLICK EFFECTS
if (chaosMode) {
// Make the dog bounce insanely
tween(self, {
scaleX: 2,
scaleY: 2,
rotation: self.rotation + Math.PI * 2
}, {
duration: 200,
easing: tween.bounceOut,
onFinish: function onFinish() {
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 300,
easing: tween.elasticOut
});
}
});
// Spawn chaotic bullets from the dog
for (var i = 0; i < 20; i++) {
var chaosBullet = new ChaoticBullet();
chaosBullet.x = self.x;
chaosBullet.y = self.y;
chaosBullet.angle = i / 20 * Math.PI * 2;
chaosBullet.speed = 8 + Math.random() * 12;
chaosBullets.push(chaosBullet);
game.addChild(chaosBullet);
}
}
// Screen shake on every click
screenShakeIntensity = 20;
// Increase insanity level
insanityLevel++;
if (insanityLevel > 100) {
chaosMode = true;
LK.effects.flashScreen(0xFF0000, 100);
}
updateAchievements();
updateUI();
saveGame();
};
return self;
});
var ExplodingClickEffect = Container.expand(function () {
var self = Container.call(this);
var explosionColors = [0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0xFF00FF, 0x00FFFF];
for (var i = 0; i < 8; i++) {
var fragment = self.attachAsset('clickEffect', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.8,
scaleX: 0.3,
scaleY: 0.3
});
fragment.tint = explosionColors[Math.floor(Math.random() * explosionColors.length)];
var angle = i / 8 * Math.PI * 2;
tween(fragment, {
x: Math.cos(angle) * 150,
y: Math.sin(angle) * 150,
alpha: 0,
scaleX: 0.1,
scaleY: 0.1
}, {
duration: 800,
easing: tween.easeOut
});
}
LK.setTimeout(function () {
self.destroy();
}, 800);
return self;
});
var FloatingParticle = Container.expand(function () {
var self = Container.call(this);
var colors = [0xff6b35, 0x00ffff, 0xffd700, 0xff69b4, 0x98fb98, 0xffa500];
var randomColor = colors[Math.floor(Math.random() * colors.length)];
var particleGraphics = self.attachAsset('multiplierOrb', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.3,
scaleX: 0.2 + Math.random() * 0.4,
scaleY: 0.2 + Math.random() * 0.4
});
particleGraphics.tint = randomColor;
self.speed = 0.5 + Math.random() * 2;
self.floatDirection = Math.random() * Math.PI * 2;
self.rotationSpeed = (Math.random() - 0.5) * 0.1;
self.pulsePhase = Math.random() * Math.PI * 2;
self.startFloat = function () {
var targetX = self.x + Math.cos(self.floatDirection) * (200 + Math.random() * 400);
var targetY = self.y + Math.sin(self.floatDirection) * (200 + Math.random() * 400);
tween(self, {
x: targetX,
y: targetY
}, {
duration: 8000 + Math.random() * 4000,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.floatDirection = Math.random() * Math.PI * 2;
self.startFloat();
}
});
};
self.update = function () {
particleGraphics.rotation += self.rotationSpeed;
self.pulsePhase += 0.05;
particleGraphics.alpha = 0.2 + Math.sin(self.pulsePhase) * 0.2;
};
return self;
});
var FloatingStar = Container.expand(function () {
var self = Container.call(this);
var starGraphics = self.attachAsset('clickEffect', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.6,
scaleX: 0.3 + Math.random() * 0.2,
scaleY: 0.3 + Math.random() * 0.2
});
starGraphics.tint = 0xFFFFFF;
self.speed = 0.2 + Math.random() * 0.8;
self.direction = Math.random() * Math.PI * 2;
self.twinklePhase = Math.random() * Math.PI * 2;
self.rotationSpeed = (Math.random() - 0.5) * 0.05;
self.startTwinkle = function () {
tween(starGraphics, {
alpha: 0.9,
scaleX: starGraphics.scaleX * 1.5,
scaleY: starGraphics.scaleY * 1.5
}, {
duration: 1000 + Math.random() * 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(starGraphics, {
alpha: 0.2,
scaleX: starGraphics.scaleX * 0.7,
scaleY: starGraphics.scaleY * 0.7
}, {
duration: 1000 + Math.random() * 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.startTwinkle();
}
});
}
});
};
self.update = function () {
self.x += Math.cos(self.direction) * self.speed;
self.y += Math.sin(self.direction) * self.speed;
starGraphics.rotation += self.rotationSpeed;
// Wrap around screen edges
if (self.x < -50) {
self.x = 2098;
}
if (self.x > 2098) {
self.x = -50;
}
if (self.y < -50) {
self.y = 2782;
}
if (self.y > 2782) {
self.y = -50;
}
};
return self;
});
var MeditationBubble = Container.expand(function () {
var self = Container.call(this);
var bubbleGraphics = self.attachAsset('multiplierOrb', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.1,
scaleX: 0.3 + Math.random() * 0.4,
scaleY: 0.3 + Math.random() * 0.4
});
// Soft meditation colors
var meditationColors = [0xE6E6FA, 0xF0F8FF, 0xFDF5E6, 0xF5FFFA, 0xFFF8DC];
bubbleGraphics.tint = meditationColors[Math.floor(Math.random() * meditationColors.length)];
self.floatSpeed = 0.3 + Math.random() * 0.5;
self.pulsePhase = Math.random() * Math.PI * 2;
self.startFloating = function () {
tween(self, {
y: self.y - 300 - Math.random() * 200
}, {
duration: 15000 + Math.random() * 10000,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.destroy();
}
});
};
self.update = function () {
self.pulsePhase += 0.02;
bubbleGraphics.alpha = 0.05 + Math.sin(self.pulsePhase) * 0.1;
bubbleGraphics.scaleX += Math.sin(self.pulsePhase * 0.7) * 0.001;
bubbleGraphics.scaleY += Math.cos(self.pulsePhase * 0.5) * 0.001;
};
return self;
});
var MegaChaosPortal = Container.expand(function () {
var self = Container.call(this);
var portalGraphics = self.attachAsset('multiplierOrb', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.9,
scaleX: 4,
scaleY: 4
});
portalGraphics.tint = 0xFF0000;
self.chaosLevel = 0;
self.spawnTimer = 0;
self.rotation = 0;
self.update = function () {
self.rotation += 0.3;
portalGraphics.rotation = self.rotation;
// Pulsating chaos portal
tween(portalGraphics, {
scaleX: 6 + Math.sin(self.rotation) * 2,
scaleY: 6 + Math.cos(self.rotation) * 2,
alpha: 0.5 + Math.sin(self.rotation * 2) * 0.4
}, {
duration: 100,
easing: tween.linear
});
self.spawnTimer++;
if (self.spawnTimer >= 30) {
// Spawn every half second
self.spawnTimer = 0;
self.chaosLevel++;
// Spawn different chaos based on level
if (self.chaosLevel % 5 === 0) {
// Spawn mega explosions
for (var i = 0; i < 10; i++) {
var megaExplosion = new ExplodingClickEffect();
megaExplosion.x = self.x + (Math.random() - 0.5) * 400;
megaExplosion.y = self.y + (Math.random() - 0.5) * 400;
game.addChild(megaExplosion);
}
}
// Spawn chaotic bullets in all directions
for (var i = 0; i < 8; i++) {
var bullet = new ChaoticBullet();
bullet.x = self.x;
bullet.y = self.y;
bullet.angle = i / 8 * Math.PI * 2;
bullet.speed = 10 + Math.random() * 15;
chaoticBullets.push(bullet);
game.addChild(bullet);
}
// Random screen effects
LK.effects.flashScreen(Math.floor(Math.random() * 0xFFFFFF), 100);
}
};
return self;
});
var MultiplierOrb = Container.expand(function () {
var self = Container.call(this);
var orbGraphics = self.attachAsset('multiplierOrb', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.8
});
self["float"] = function () {
tween(orbGraphics, {
y: orbGraphics.y - 20
}, {
duration: 1500,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(orbGraphics, {
y: orbGraphics.y + 20
}, {
duration: 1500,
easing: tween.easeInOut,
onFinish: function onFinish() {
self["float"]();
}
});
}
});
};
return self;
});
var PrestigeButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('prestigeButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.95,
scaleY: 1.0
});
var titleText = new Text2('PRESTIGE', {
size: 56,
fill: 0x000000
});
titleText.anchor.set(0.5, 0.5);
titleText.y = -25;
self.addChild(titleText);
var rewardText = new Text2('Reset for +' + calculatePrestigeReward() + 'x multiplier', {
size: 38,
fill: 0x8B0000
});
rewardText.anchor.set(0.5, 0.5);
rewardText.y = 15;
self.addChild(rewardText);
var costText = new Text2('Requires: 1M total clicks', {
size: 34,
fill: 0x444444
});
costText.anchor.set(0.5, 0.5);
costText.y = 45;
self.addChild(costText);
self.updateDisplay = function () {
var reward = calculatePrestigeReward();
rewardText.setText('Reset for +' + reward + 'x multiplier');
if (totalClicks >= 1000000) {
buttonGraphics.tint = 0xFFFFFF;
titleText.tint = 0x000000;
} else {
buttonGraphics.tint = 0x666666;
titleText.tint = 0x999999;
}
};
self.down = function (x, y, obj) {
if (totalClicks >= 1000000) {
performPrestige();
}
};
return self;
});
var PrestigeParticle = Container.expand(function () {
var self = Container.call(this);
var particleGraphics = self.attachAsset('prestigeParticle', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 1.0,
scaleX: 0.5,
scaleY: 0.5
});
self.animate = function () {
var randomX = (Math.random() - 0.5) * 800;
var randomY = -Math.random() * 400 - 200;
tween(self, {
x: self.x + randomX,
y: self.y + randomY
}, {
duration: 2000,
easing: tween.easeOut
});
tween(particleGraphics, {
scaleX: 1.5,
scaleY: 1.5,
alpha: 0
}, {
duration: 2000,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
};
return self;
});
var RelaxationMode = Container.expand(function () {
var self = Container.call(this);
var overlayGraphics = self.attachAsset('statisticsPanel', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.8,
scaleX: 4,
scaleY: 6
});
overlayGraphics.tint = 0x2E2E4F;
var titleText = new Text2('RELAXATION MODE', {
size: 72,
fill: 0xE6E6FA
});
titleText.anchor.set(0.5, 0.5);
titleText.y = -300;
self.addChild(titleText);
var instructionText = new Text2('Take deep breaths and focus on the gentle movements\nClick anywhere to exit', {
size: 40,
fill: 0xF0F8FF
});
instructionText.anchor.set(0.5, 0.5);
instructionText.y = 250;
self.addChild(instructionText);
self.breathingCycle = 0;
var breathingText = new Text2('Breathe In...', {
size: 60,
fill: 0x98FB98
});
breathingText.anchor.set(0.5, 0.5);
breathingText.y = 0;
self.addChild(breathingText);
self.startRelaxation = function () {
self.breathingCycle = 0;
self.updateBreathingText();
// Play multiple ambient sounds for deep relaxation
if (relaxationPreferences.meditationSoundEnabled) {
LK.getSound('gentleWaves').play();
LK.setTimeout(function () {
LK.getSound('windChimes').play();
}, 2000);
LK.setTimeout(function () {
LK.getSound('softRain').play();
}, 4000);
}
// Start gentle background pulse with slower, deeper breathing rhythm
tween(overlayGraphics, {
alpha: 0.95,
scaleX: 4.1,
scaleY: 6.1
}, {
duration: 6000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(overlayGraphics, {
alpha: 0.65,
scaleX: 3.9,
scaleY: 5.9
}, {
duration: 8000,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.startRelaxation();
}
});
}
});
};
self.updateBreathingText = function () {
var cycle = Math.floor(self.breathingCycle / 240); // 4 second cycles at 60fps
var phase = cycle % 2;
// Add psychedelic breathing messages
var psychedelicMessages = ['Breathe in the cosmos...', 'Exhale your reality...', 'The universe breathes through you...', 'Your breath bends space-time...', 'Feel the quantum air...', 'Breathe in impossible colors...'];
if (phase === 0) {
if (realityDistortionLevel > 80) {
breathingText.setText(psychedelicMessages[Math.floor(Math.random() * psychedelicMessages.length)]);
} else {
breathingText.setText('Breathe In...');
}
breathingText.tint = realityDistortionLevel > 50 ? Math.floor(Math.random() * 0xFFFFFF) : 0x98FB98;
} else {
if (realityDistortionLevel > 80) {
breathingText.setText(psychedelicMessages[Math.floor(Math.random() * psychedelicMessages.length)]);
} else {
breathingText.setText('Breathe Out...');
}
breathingText.tint = realityDistortionLevel > 50 ? Math.floor(Math.random() * 0xFFFFFF) : 0x87CEEB;
}
};
self.update = function () {
self.breathingCycle += 1;
if (self.breathingCycle % 240 === 0) {
self.updateBreathingText();
}
// Gentle breathing animation
var breathPhase = self.breathingCycle % 240 / 240;
var breathScale = 1 + Math.sin(breathPhase * Math.PI) * 0.1;
breathingText.scaleX = breathScale;
breathingText.scaleY = breathScale;
};
self.down = function (x, y, obj) {
exitRelaxationMode();
};
return self;
});
var RelaxingAffirmation = Container.expand(function () {
var self = Container.call(this);
var defaultAffirmations = ['You are at peace', 'Breathe and let go', 'This moment is perfect', 'You are calm and centered', 'Feel the tranquility', 'Let peace flow through you', 'You are exactly where you need to be', 'Embrace this peaceful moment'];
// Use seasonal affirmations if available, otherwise use default
var currentTheme = seasonalThemes && seasonalThemes[seasonalThemeIndex] ? seasonalThemes[seasonalThemeIndex] : null;
var affirmations = currentTheme ? currentTheme.affirmations.concat(defaultAffirmations) : defaultAffirmations;
var selectedAffirmation = affirmations[Math.floor(Math.random() * affirmations.length)];
var affirmationText = new Text2(selectedAffirmation, {
size: 48,
fill: currentTheme ? currentTheme.colors[0] : 0xE6E6FA
});
affirmationText.anchor.set(0.5, 0.5);
affirmationText.alpha = 0;
self.addChild(affirmationText);
self.showAffirmation = function () {
tween(affirmationText, {
alpha: 0.8,
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
LK.setTimeout(function () {
tween(affirmationText, {
alpha: 0,
scaleX: 1,
scaleY: 1
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.destroy();
}
});
}, 3000);
}
});
};
return self;
});
var SoothingWave = Container.expand(function () {
var self = Container.call(this);
var waveGraphics = self.attachAsset('multiplierOrb', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.1,
scaleX: 0.5,
scaleY: 0.1
});
var waveColors = [0xE0FFFF, 0xF0FFFF, 0xF5FFFA, 0xF0F8FF];
waveGraphics.tint = waveColors[Math.floor(Math.random() * waveColors.length)];
self.wavePhase = Math.random() * Math.PI * 2;
self.startWave = function () {
tween(self, {
scaleX: 8 + Math.random() * 4,
scaleY: 0.3 + Math.random() * 0.2,
alpha: 0
}, {
duration: 6000 + Math.random() * 4000,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
};
return self;
});
var StatisticsPanel = Container.expand(function () {
var self = Container.call(this);
var panelGraphics = self.attachAsset('statisticsPanel', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.9
});
var titleText = new Text2('STATISTICS', {
size: 60,
fill: 0xFFD700
});
titleText.anchor.set(0.5, 0.5);
titleText.y = -200;
self.addChild(titleText);
var statsText = new Text2('', {
size: 36,
fill: 0xFFFFFF
});
statsText.anchor.set(0, 0.5);
statsText.x = -300;
statsText.y = -50;
self.addChild(statsText);
self.updateStats = function () {
var stats = ['Total Clicks: ' + totalClicks, 'Total Points Earned: ' + Math.floor(totalPointsEarned), 'Time Played: ' + Math.floor(timePlayed / 60) + ' minutes', 'Highest CPS: ' + Math.floor(highestCPS), 'Upgrades Purchased: ' + totalUpgradesPurchased, 'Prestiges: ' + prestigeLevel, 'Achievements: ' + completedAchievements + '/' + achievements.length];
statsText.setText(stats.join('\n'));
};
return self;
});
var TutorialText = Container.expand(function () {
var self = Container.call(this);
var tutorialTips = ["Click the cute dog to earn points!", "Use points to buy upgrades on the right", "Higher upgrades give more points per click", "Auto upgrades earn points automatically", "Build combos by clicking rapidly", "Watch your zen meter - stay relaxed!", "Click RELAX button for meditation mode", "Prestige when you reach 1M clicks", "Achievements give bonus points", "Use boosts for temporary bonuses"];
var currentTipIndex = 0;
var tipCycleTimer = 0;
var tutorialBackground = self.attachAsset('statisticsPanel', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.7,
scaleX: 0.8,
scaleY: 0.4
});
tutorialBackground.tint = 0x2A2A4A;
var titleText = new Text2('HOW TO PLAY', {
size: 44,
fill: 0xFFD700
});
titleText.anchor.set(0.5, 0.5);
titleText.y = -60;
self.addChild(titleText);
var tipText = new Text2(tutorialTips[0], {
size: 32,
fill: 0xE6E6FA
});
tipText.anchor.set(0.5, 0.5);
tipText.y = -10;
self.addChild(tipText);
var progressText = new Text2('Tip 1 of ' + tutorialTips.length, {
size: 24,
fill: 0xCCCCCC
});
progressText.anchor.set(0.5, 0.5);
progressText.y = 30;
self.addChild(progressText);
var nextButton = new Text2('NEXT TIP >', {
size: 28,
fill: 0x98FB98
});
nextButton.anchor.set(0.5, 0.5);
nextButton.y = 65;
self.addChild(nextButton);
self.showNextTip = function () {
currentTipIndex = (currentTipIndex + 1) % tutorialTips.length;
// Fade out current tip
tween(tipText, {
alpha: 0,
scaleX: 0.8,
scaleY: 0.8
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
// Update text and fade in
tipText.setText(tutorialTips[currentTipIndex]);
progressText.setText('Tip ' + (currentTipIndex + 1) + ' of ' + tutorialTips.length);
tween(tipText, {
alpha: 1,
scaleX: 1,
scaleY: 1
}, {
duration: 300,
easing: tween.easeOut
});
}
});
// Add gentle glow effect to title
tween(titleText, {
tint: 0xFFFFFF
}, {
duration: 150,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(titleText, {
tint: 0xFFD700
}, {
duration: 150,
easing: tween.easeOut
});
}
});
};
self.update = function () {
// Auto-cycle tips every 8 seconds
tipCycleTimer++;
if (tipCycleTimer >= 480) {
// 8 seconds at 60fps
self.showNextTip();
tipCycleTimer = 0;
}
// Add subtle pulsing to next button
var pulsePhase = LK.ticks * 0.05 % (Math.PI * 2);
nextButton.alpha = 0.7 + Math.sin(pulsePhase) * 0.3;
};
nextButton.down = function (x, y, obj) {
self.showNextTip();
tipCycleTimer = 0; // Reset auto-cycle timer
};
return self;
});
var UpgradeButton = Container.expand(function (upgradeData) {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.9
});
self.upgradeData = upgradeData;
var nameText = new Text2(upgradeData.name, {
size: 36,
fill: 0xFFFFFF
});
nameText.anchor.set(0, 0.5);
nameText.x = -160;
nameText.y = -15;
self.addChild(nameText);
var costText = new Text2('Cost: ' + upgradeData.cost, {
size: 28,
fill: 0xFFFF00
});
costText.anchor.set(0, 0.5);
costText.x = -160;
costText.y = 8;
self.addChild(costText);
var countText = new Text2('Owned: ' + upgradeData.owned, {
size: 26,
fill: 0xCCCCCC
});
countText.anchor.set(1, 0.5);
countText.x = 160;
countText.y = 0;
self.addChild(countText);
self.updateDisplay = function () {
costText.setText('Cost: ' + upgradeData.cost);
countText.setText('Owned: ' + upgradeData.owned);
if (points >= upgradeData.cost) {
buttonGraphics.tint = 0xE6E6FA; // Soft lavender when affordable for zen feeling
// Add gentle glow for affordable upgrades
if (!self.isGlowing) {
self.isGlowing = true;
self.startGentleGlow();
}
} else {
buttonGraphics.tint = 0x888888; // Softer gray when not affordable
if (self.isGlowing) {
self.isGlowing = false;
tween.stop(buttonGraphics, {
alpha: true,
scaleX: true,
scaleY: true
});
buttonGraphics.alpha = 1;
buttonGraphics.scaleX = 0.8;
buttonGraphics.scaleY = 0.9;
}
}
};
// Add gentle glowing animation for affordable upgrades
self.startGentleGlow = function () {
tween(buttonGraphics, {
alpha: 0.7,
scaleX: 0.82,
scaleY: 0.92
}, {
duration: 1500,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (self.isGlowing) {
tween(buttonGraphics, {
alpha: 1,
scaleX: 0.8,
scaleY: 0.9
}, {
duration: 1500,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (self.isGlowing) {
self.startGentleGlow();
}
}
});
}
}
});
};
self.down = function (x, y, obj) {
if (points >= upgradeData.cost) {
points -= upgradeData.cost;
upgradeData.owned++;
totalUpgradesPurchased++;
if (upgradeData.type === 'click') {
pointsPerClick += upgradeData.power;
} else if (upgradeData.type === 'auto') {
pointsPerSecond += upgradeData.power;
}
// Exponential cost increase formula
upgradeData.cost = Math.floor(upgradeData.baseCost * Math.pow(1.15, upgradeData.owned));
// Play cash register sound
LK.getSound('cashRegister').play();
// Flash button pink
tween(buttonGraphics, {
tint: 0xFF69B4
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
updateAchievements();
updateUI();
}
});
saveGame();
}
};
return self;
});
var ZenBreathingOrb = Container.expand(function () {
var self = Container.call(this);
var orbGraphics = self.attachAsset('multiplierOrb', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.15,
scaleX: 0.8,
scaleY: 0.8
});
// Soft zen colors
var zenColors = [0x87CEEB, 0x98FB98, 0xDDA0DD, 0xF0E68C, 0xFFB6C1];
orbGraphics.tint = zenColors[Math.floor(Math.random() * zenColors.length)];
self.breathingPhase = Math.random() * Math.PI * 2;
self.baseScale = 0.6 + Math.random() * 0.4;
self.startBreathing = function () {
// Slow breathing cycle like meditation
tween(orbGraphics, {
scaleX: self.baseScale * 1.8,
scaleY: self.baseScale * 1.8,
alpha: 0.25
}, {
duration: 4000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(orbGraphics, {
scaleX: self.baseScale,
scaleY: self.baseScale,
alpha: 0.1
}, {
duration: 4000,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.startBreathing();
}
});
}
});
};
self.update = function () {
// Gentle floating movement
self.breathingPhase += 0.01;
self.y += Math.sin(self.breathingPhase) * 0.3;
self.x += Math.cos(self.breathingPhase * 0.7) * 0.2;
};
return self;
});
var ZenRipple = Container.expand(function () {
var self = Container.call(this);
var rippleGraphics = self.attachAsset('multiplierOrb', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.4,
scaleX: 0.1,
scaleY: 0.1
});
rippleGraphics.tint = 0x87CEEB; // Sky blue for peaceful ripples
self.animate = function () {
tween(rippleGraphics, {
scaleX: 8,
scaleY: 8,
alpha: 0
}, {
duration: 2500,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x8B4B9C
});
/****
* Game Code
****/
// Game state variables
function _typeof2(o) {
"@babel/helpers - typeof";
return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof2(o);
}
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
var points = 0;
var pointsPerClick = 0; // Always start at 0, will be calculated from upgrades
var pointsPerSecond = 0; // Always start at 0, will be calculated from upgrades
var totalClicks = storage.totalClicks || 0;
var currentSkin = storage.currentSkin || 0;
var skinMilestones = [0, 100, 500, 1000, 2500, 5000, 10000, 25000, 50000, 100000];
// Prestige system variables
var prestigeLevel = storage.prestigeLevel || 0;
var prestigeMultiplier = 1 + prestigeLevel * 1; // +100% per prestige level (each prestige = +1x multiplier)
var multiplierOrbs = [];
// Achievement system variables
var achievements = [];
var completedAchievements = storage.completedAchievements || 0;
var totalPointsEarned = storage.totalPointsEarned || 0;
var timePlayed = storage.timePlayed || 0;
var gameStartTime = Date.now();
var highestCPS = storage.highestCPS || 0;
var totalUpgradesPurchased = storage.totalUpgradesPurchased || 0;
// Boost system variables
var activeBoosts = {};
var boostMultiplier = 1;
// Statistics tracking
var clicksInLastSecond = 0;
var lastSecondTime = Date.now();
// Enhanced clicker features
var comboMultiplier = 1;
var comboCount = 0;
var lastClickTime = 0;
var comboTimer = 0;
var maxCombo = storage.maxCombo || 0;
var criticalChance = 0.05; // 5% base critical chance
var criticalMultiplier = 2;
var clickPowerUps = [];
var totalCriticalHits = storage.totalCriticalHits || 0;
// Achievement definitions
var achievementDefinitions = [{
id: 'first_click',
name: 'First Click',
target: 1,
type: 'clicks',
reward: 10
}, {
id: 'hundred_clicks',
name: 'Clicking Master',
target: 100,
type: 'clicks',
reward: 100
}, {
id: 'thousand_clicks',
name: 'Click Champion',
target: 1000,
type: 'clicks',
reward: 1000
}, {
id: 'first_upgrade',
name: 'First Purchase',
target: 1,
type: 'upgrades',
reward: 50
}, {
id: 'ten_upgrades',
name: 'Shopping Spree',
target: 10,
type: 'upgrades',
reward: 500
}, {
id: 'first_prestige',
name: 'Prestige Master',
target: 1,
type: 'prestiges',
reward: 10000
}, {
id: 'million_points',
name: 'Millionaire',
target: 1000000,
type: 'points',
reward: 5000
}, {
id: 'speed_demon',
name: 'Speed Demon',
target: 10,
type: 'cps',
reward: 2000
}, {
id: 'time_played',
name: 'Dedicated Player',
target: 3600,
type: 'time',
reward: 1500
}];
// Initialize achievements from definitions and load saved progress
for (var i = 0; i < achievementDefinitions.length; i++) {
var def = achievementDefinitions[i];
var keyPrefix = 'achievement_' + def.id + '_';
achievements.push({
id: def.id,
name: def.name,
target: def.target,
type: def.type,
reward: def.reward,
current: storage[keyPrefix + 'current'] || 0,
completed: storage[keyPrefix + 'completed'] || false,
claimed: storage[keyPrefix + 'claimed'] || false
});
}
;
// Boost definitions
var boostDefinitions = [{
name: '2x Click',
type: 'click',
multiplier: 2,
duration: 30000,
cost: 1000
}, {
name: '3x Auto',
type: 'auto',
multiplier: 3,
duration: 60000,
cost: 5000
}, {
name: '5x All',
type: 'all',
multiplier: 5,
duration: 15000,
cost: 10000
}];
// Floating particles system
var floatingParticles = [];
function createFloatingParticles() {
var particleCount = 15;
for (var i = 0; i < particleCount; i++) {
var particle = new FloatingParticle();
particle.x = Math.random() * 2048;
particle.y = Math.random() * 2732;
floatingParticles.push(particle);
game.addChild(particle);
particle.startFloat();
}
}
function calculatePrestigeReward() {
return Math.floor(totalClicks / 1000000) * 0.5;
}
function createPrestigeParticles(centerX, centerY) {
for (var i = 0; i < 15; i++) {
var particle = new PrestigeParticle();
particle.x = centerX + (Math.random() - 0.5) * 100;
particle.y = centerY + (Math.random() - 0.5) * 100;
game.addChild(particle);
particle.animate();
}
}
function performPrestige() {
var reward = calculatePrestigeReward();
prestigeLevel += reward;
prestigeMultiplier = 1 + prestigeLevel * 1;
// Create particle explosion
createPrestigeParticles(summer.x, summer.y);
// Flash screen gold
LK.effects.flashScreen(0xffd700, 1500);
// Reset game state but keep prestige bonuses
points = 0;
pointsPerClick = 0;
pointsPerSecond = 0;
totalClicks = 0;
currentSkin = 0;
// Reset all upgrades
for (var i = 0; i < upgrades.length; i++) {
upgrades[i].owned = 0;
upgrades[i].cost = upgrades[i].baseCost;
}
// Create multiplier orbs around dog
createMultiplierOrbs();
// Update everything
updateUI();
summer.updateSkin();
saveGame();
}
function updateAchievements() {
for (var i = 0; i < achievements.length; i++) {
var achievement = achievements[i];
if (achievement.completed) {
continue;
}
var oldCurrent = achievement.current;
switch (achievement.type) {
case 'clicks':
achievement.current = totalClicks;
break;
case 'upgrades':
achievement.current = totalUpgradesPurchased;
break;
case 'prestiges':
achievement.current = prestigeLevel;
break;
case 'points':
achievement.current = totalPointsEarned;
break;
case 'cps':
achievement.current = highestCPS;
break;
case 'time':
achievement.current = timePlayed;
break;
}
if (achievement.current >= achievement.target && !achievement.completed) {
achievement.completed = true;
LK.effects.flashScreen(0x00FF00, 1000);
// Show achievement notification
if (achievementButtons[i]) {
achievementButtons[i].updateProgress();
}
}
}
}
function claimAchievement(achievement) {
if (achievement.completed && !achievement.claimed) {
achievement.claimed = true;
points += achievement.reward;
completedAchievements++;
LK.effects.flashScreen(0xFFD700, 500);
updateUI();
saveGame();
}
}
function activateBoost(boostData) {
activeBoosts[boostData.type] = {
multiplier: boostData.multiplier,
endTime: Date.now() + boostData.duration,
type: boostData.type
};
updateBoostMultiplier();
}
function updateBoostMultiplier() {
boostMultiplier = 1;
var currentTime = Date.now();
for (var type in activeBoosts) {
var boost = activeBoosts[type];
if (boost.endTime > currentTime) {
if (type === 'all' || type === 'click' || type === 'auto') {
boostMultiplier *= boost.multiplier;
}
} else {
delete activeBoosts[type];
}
}
}
function createMultiplierOrbs() {
// Clear existing orbs
for (var i = 0; i < multiplierOrbs.length; i++) {
multiplierOrbs[i].destroy();
}
multiplierOrbs = [];
// Create new orbs based on prestige level
var orbCount = Math.min(prestigeLevel, 8);
for (var i = 0; i < orbCount; i++) {
var orb = new MultiplierOrb();
var angle = i / orbCount * Math.PI * 2;
orb.x = summer.x + Math.cos(angle) * 300;
orb.y = summer.y + Math.sin(angle) * 200;
multiplierOrbs.push(orb);
game.addChild(orb);
orb["float"]();
// Animate orb appearance
orb.alpha = 0;
orb.scaleX = 0;
orb.scaleY = 0;
tween(orb, {
alpha: 0.8,
scaleX: 1,
scaleY: 1
}, {
duration: 800,
easing: tween.elasticOut
});
}
}
function createRandomPowerUp() {
var powerUpTypes = ['speed', 'critical', 'mega', 'combo'];
var randomType = powerUpTypes[Math.floor(Math.random() * powerUpTypes.length)];
var powerUp = new ClickPowerUp(randomType);
powerUp.x = summer.x + (Math.random() - 0.5) * 400;
powerUp.y = summer.y + (Math.random() - 0.5) * 300;
var duration = 300 + Math.random() * 300; // 5-10 seconds
var multiplier = 1.5 + Math.random() * 1.5; // 1.5x to 3x
// Adjust based on power-up type
switch (randomType) {
case 'speed':
duration = 600; // 10 seconds
multiplier = 1; // Doesn't affect damage, just visual
break;
case 'critical':
duration = 420; // 7 seconds
multiplier = 1.5; // +50% critical multiplier
break;
case 'mega':
duration = 180; // 3 seconds
multiplier = 3; // 3x click damage
break;
case 'combo':
duration = 600; // 10 seconds
multiplier = 1; // Extends combo timer
break;
}
clickPowerUps.push(powerUp);
game.addChild(powerUp);
powerUp.activate(duration, multiplier);
// Flash screen with power-up color
var colors = {
'speed': 0x00FFFF,
'critical': 0xFF6B35,
'mega': 0xFF1493,
'combo': 0x32CD32
};
LK.effects.flashScreen(colors[randomType], 300);
}
function updateClickPowerUps() {
for (var i = clickPowerUps.length - 1; i >= 0; i--) {
var powerUp = clickPowerUps[i];
if (powerUp.duration <= 0) {
clickPowerUps.splice(i, 1);
} else {
powerUp.update();
}
}
}
// Upgrade definitions with exponential growth - ordered from cheapest to most expensive
var upgrades = [{
name: 'Squeaky Toy',
type: 'click',
cost: storage.squeakyToyCost || 15,
baseCost: 15,
power: 1,
owned: storage.squeakyToyOwned || 0
}, {
name: 'Dog Walker',
type: 'auto',
cost: storage.dogWalkerCost || 50,
baseCost: 50,
power: 1,
owned: storage.dogWalkerOwned || 0
}, {
name: 'Tennis Ball',
type: 'click',
cost: storage.tennisBallCost || 100,
baseCost: 100,
power: 5,
owned: storage.tennisBallOwned || 0
}, {
name: 'Poop Bag Station',
type: 'auto',
cost: storage.poopBagStationCost || 500,
baseCost: 500,
power: 8,
owned: storage.poopBagStationOwned || 0
}, {
name: 'Premium Treats',
type: 'click',
cost: storage.premiumTreatsCost || 1200,
baseCost: 1200,
power: 47,
owned: storage.premiumTreatsOwned || 0
}, {
name: 'Dog Fountain',
type: 'auto',
cost: storage.dogFountainCost || 8000,
baseCost: 8000,
power: 47,
owned: storage.dogFountainOwned || 0
}, {
name: 'Chew Bone',
type: 'click',
cost: storage.chewBoneCost || 15000,
baseCost: 15000,
power: 260,
owned: storage.chewBoneOwned || 0
}, {
name: 'Agility Course',
type: 'auto',
cost: storage.agilityCourseC || 90000,
baseCost: 90000,
power: 260,
owned: storage.agilityCourseo || 0
}, {
name: 'Diamond Collar',
type: 'click',
cost: storage.diamondCollarCost || 180000,
baseCost: 180000,
power: 1400,
owned: storage.diamondCollarOwned || 0
}, {
name: 'Dog Daycare',
type: 'auto',
cost: storage.dogDaycareCost || 900000,
baseCost: 900000,
power: 1400,
owned: storage.dogDaycareOwned || 0
}, {
name: 'Golden Leash',
type: 'click',
cost: storage.goldenLeashCost || 1800000,
baseCost: 1800000,
power: 7800,
owned: storage.goldenLeashOwned || 0
}, {
name: 'Mobile Grooming Van',
type: 'auto',
cost: storage.mobileGroomingVanCost || 9000000,
baseCost: 9000000,
power: 7800,
owned: storage.mobileGroomingVanOwned || 0
}, {
name: 'Laser Pointer',
type: 'click',
cost: storage.laserPointerCost || 27000000,
baseCost: 27000000,
power: 44000,
owned: storage.laserPointerOwned || 0
}, {
name: 'Dog Hotel',
type: 'auto',
cost: storage.dogHotelCost || 135000000,
baseCost: 135000000,
power: 44000,
owned: storage.dogHotelOwned || 0
}, {
name: 'Robotic Paw',
type: 'click',
cost: storage.roboticPawCost || 540000000,
baseCost: 540000000,
power: 260000,
owned: storage.roboticPawOwned || 0
}, {
name: 'Bark Park',
type: 'auto',
cost: storage.barkParkCost || 2700000000,
baseCost: 2700000000,
power: 260000,
owned: storage.barkParkOwned || 0
}, {
name: 'Tail Wag Generator',
type: 'click',
cost: storage.tailWagGeneratorCost || 8100000000,
baseCost: 8100000000,
power: 1600000,
owned: storage.tailWagGeneratorOwned || 0
}, {
name: 'Doggy Resort Chain',
type: 'auto',
cost: storage.doggyResortChainCost || 40500000000,
baseCost: 40500000000,
power: 1600000,
owned: storage.doggyResortChainOwned || 0
}, {
name: 'Frisbee Factory',
type: 'click',
cost: storage.frisbeeFactoryCost || 121500000000,
baseCost: 121500000000,
power: 10000000,
owned: storage.frisbeeFactoryOwned || 0
}, {
name: 'Canine Island',
type: 'auto',
cost: storage.canineIslandCost || 607500000000,
baseCost: 607500000000,
power: 10000000,
owned: storage.canineIslandOwned || 0
}, {
name: 'Doghouse Empire',
type: 'click',
cost: storage.doghouseEmpireCost || 1822500000000,
baseCost: 1822500000000,
power: 65000000,
owned: storage.doghouseEmpireOwned || 0
}, {
name: 'Puppy Planet',
type: 'auto',
cost: storage.puppyPlanetCost || 9112500000000,
baseCost: 9112500000000,
power: 65000000,
owned: storage.puppyPlanetOwned || 0
}, {
name: 'Biscuit Factory',
type: 'auto',
cost: storage.biscuitFactoryCost || 136687500000000,
baseCost: 136687500000000,
power: 430000000,
owned: storage.biscuitFactoryOwned || 0
}, {
name: 'Fetch Robot Workshop',
type: 'auto',
cost: storage.fetchRobotWorkshopCost || 2733750000000000,
baseCost: 2733750000000000,
power: 2900000000,
owned: storage.fetchRobotWorkshopOwned || 0
}, {
name: 'Treat Plantation',
type: 'auto',
cost: storage.treatPlantationCost || 41006250000000000,
baseCost: 41006250000000000,
power: 21000000000000000,
owned: storage.treatPlantationOwned || 0
}, {
name: 'Doggy Spa Chain',
type: 'auto',
cost: storage.doggySpaChainCost || 615093750000000000,
baseCost: 615093750000000000,
power: 150000000000,
owned: storage.doggySpaChainOwned || 0
}, {
name: 'Canine Universe',
type: 'auto',
cost: storage.canineUniverseCost || 9226406250000000000,
baseCost: 9226406250000000000,
power: 1100000000000,
owned: storage.canineUniverseOwned || 0
}];
// Sort upgrades from cheapest to most expensive
upgrades.sort(function (a, b) {
return a.baseCost - b.baseCost;
});
// Load saved upgrade states
for (var i = 0; i < upgrades.length; i++) {
var upgrade = upgrades[i];
if (upgrade.type === 'click') {
pointsPerClick += upgrade.owned * upgrade.power;
} else if (upgrade.type === 'auto') {
pointsPerSecond += upgrade.owned * upgrade.power;
}
}
// UI Elements - Compacted and repositioned to avoid overlap
var pointsDisplay = new Text2('Points: ' + Math.floor(points), {
size: 60,
fill: 0xFFFFFF
});
pointsDisplay.anchor.set(0.5, 0);
LK.gui.top.addChild(pointsDisplay);
var displayPerSecond = pointsPerSecond; // Track the displayed value for animation
var perSecondDisplay = new Text2('Per Second: ' + displayPerSecond, {
size: 45,
fill: 0xFFFF00
});
perSecondDisplay.anchor.set(0.5, 0);
perSecondDisplay.y = 70;
LK.gui.top.addChild(perSecondDisplay);
// Dog Park title - moved to top center to avoid overlapping with game assets
var dogParkTitle = new Text2('CHAOTIC DOG MADNESS!!!', {
size: 50,
fill: 0xFF0000
});
dogParkTitle.anchor.set(0.5, 0);
dogParkTitle.x = -100;
dogParkTitle.y = 120;
LK.gui.top.addChild(dogParkTitle);
// Insanity meter
var insanityDisplay = new Text2('INSANITY: 0%', {
size: 30,
fill: 0xFF00FF
});
insanityDisplay.anchor.set(0, 0);
insanityDisplay.x = 120;
insanityDisplay.y = 320;
LK.gui.topLeft.addChild(insanityDisplay);
// Prestige display
var prestigeDisplay = new Text2('Prestige Level: ' + prestigeLevel + ' (x' + prestigeMultiplier.toFixed(1) + ')', {
size: 40,
fill: 0xffd700
});
prestigeDisplay.anchor.set(0.5, 0);
prestigeDisplay.y = 175;
LK.gui.top.addChild(prestigeDisplay);
// Prestige button
var prestigeButton = new PrestigeButton();
prestigeButton.x = 400;
prestigeButton.y = 1700;
game.addChild(prestigeButton);
// Achievement panel
var achievementContainer = new Container();
achievementContainer.x = 50;
achievementContainer.y = 2200;
game.addChild(achievementContainer);
var achievementButtons = [];
for (var i = 0; i < achievements.length; i++) {
var achievementButton = new Achievement(achievements[i]);
achievementButton.x = i % 3 * 120;
achievementButton.y = Math.floor(i / 3) * 150;
achievementButtons.push(achievementButton);
achievementContainer.addChild(achievementButton);
achievementButton.updateProgress();
}
// Boost buttons
var boostContainer = new Container();
boostContainer.x = 100;
boostContainer.y = 1950;
game.addChild(boostContainer);
var boostButtons = [];
for (var i = 0; i < boostDefinitions.length; i++) {
var boostButton = new BoostButton(boostDefinitions[i]);
boostButton.x = i * 450;
boostButton.y = 0;
boostButtons.push(boostButton);
boostContainer.addChild(boostButton);
}
// Statistics panel (initially hidden)
var statsPanel = new StatisticsPanel();
statsPanel.x = 1024;
statsPanel.y = 1366;
statsPanel.alpha = 0;
game.addChild(statsPanel);
// Statistics button
var statsButton = new Text2('STATS', {
size: 30,
fill: 0xFFFFFF
});
statsButton.anchor.set(1, 0);
statsButton.x = -10;
statsButton.y = 220;
var showingStats = false;
LK.gui.topRight.addChild(statsButton);
// Relaxation mode button
var relaxButton = new Text2('RELAX', {
size: 30,
fill: 0xE6E6FA
});
relaxButton.anchor.set(1, 0);
relaxButton.x = -10;
relaxButton.y = 260;
LK.gui.topRight.addChild(relaxButton);
relaxButton.down = function (x, y, obj) {
if (!isInRelaxationMode) {
enterRelaxationMode();
}
};
// Stress level indicator (zen meter)
var zenMeter = new Text2('Zen: 100%', {
size: 27,
fill: 0x98FB98
});
zenMeter.anchor.set(1, 0);
zenMeter.x = -10;
zenMeter.y = 300;
LK.gui.topRight.addChild(zenMeter);
// Combo display
var comboDisplay = new Text2('Combo: 0x', {
size: 32,
fill: 0xFFD700
});
comboDisplay.anchor.set(0, 0);
comboDisplay.x = 120;
comboDisplay.y = 220;
LK.gui.topLeft.addChild(comboDisplay);
// Critical stats display
var criticalStatsDisplay = new Text2('Criticals: 0', {
size: 25,
fill: 0xFF6B35
});
criticalStatsDisplay.anchor.set(0, 0);
criticalStatsDisplay.x = 120;
criticalStatsDisplay.y = 260;
LK.gui.topLeft.addChild(criticalStatsDisplay);
// Max combo display
var maxComboDisplay = new Text2('Best Combo: 0x', {
size: 23,
fill: 0xFFFFFF
});
maxComboDisplay.anchor.set(0, 0);
maxComboDisplay.x = 120;
maxComboDisplay.y = 290;
LK.gui.topLeft.addChild(maxComboDisplay);
// Seasonal theme indicator
var themeIndicator = new Text2('Spring Awakening', {
size: 24,
fill: 0xE6E6FA
});
themeIndicator.anchor.set(0.5, 0);
themeIndicator.y = 220;
LK.gui.top.addChild(themeIndicator);
// Main summer (the dog)
var summer = game.addChild(new DogPark());
summer.x = 1024; // Center horizontally
summer.y = 1200; // Better vertical position
// Initialize current skin
summer.updateSkin();
// Start relaxing animations for the main character
summer.startGentleBreathing();
summer.startGentleFloat();
// Create scrollable upgrade container
var upgradeContainer = new Container();
upgradeContainer.x = 1650; // Move even further to the right edge
upgradeContainer.y = 350;
game.addChild(upgradeContainer);
// Upgrade buttons
var upgradeButtons = [];
for (var i = 0; i < upgrades.length; i++) {
var button = new UpgradeButton(upgrades[i]);
button.x = 0;
button.y = i * 140;
upgradeButtons.push(button);
upgradeContainer.addChild(button);
}
// Scroll variables
var scrollY = 0;
var maxScroll = Math.max(0, upgrades.length * 140 - 1600);
var lastTouchY = 0;
var isDragging = false;
// Auto-clicker timer
var autoClickTimer = 0;
function updateUI() {
pointsDisplay.setText('Points: ' + Math.floor(points));
prestigeDisplay.setText('Prestige Level: ' + prestigeLevel + ' (x' + prestigeMultiplier.toFixed(1) + ')');
// Update combo display
if (comboCount > 1) {
comboDisplay.setText('Combo: ' + comboCount + 'x (' + comboMultiplier.toFixed(1) + 'x)');
comboDisplay.tint = comboCount >= 25 ? 0xFF1493 : comboCount >= 10 ? 0xFF6B35 : 0xFFD700;
} else {
comboDisplay.setText('Combo: 0x');
comboDisplay.tint = 0xFFD700;
}
// Update critical stats
criticalStatsDisplay.setText('Criticals: ' + totalCriticalHits);
// Update max combo
maxComboDisplay.setText('Best Combo: ' + maxCombo + 'x');
// Update zen meter
var zenPercent = Math.max(0, 100 - stressLevel);
zenMeter.setText('Zen: ' + zenPercent + '%');
// Change zen meter color based on stress level
if (stressLevel < 30) {
zenMeter.tint = 0x98FB98; // Green - very zen
} else if (stressLevel < 60) {
zenMeter.tint = 0xFFE4B5; // Yellow - moderate
} else {
zenMeter.tint = 0xFFB6C1; // Pink - needs relaxation
}
// Update insanity display
insanityDisplay.setText('INSANITY: ' + Math.min(100, insanityLevel) + '%');
insanityDisplay.tint = insanityLevel > 100 ? 0xFF0000 : 0xFF00FF;
// Make title flash when in chaos mode
if (chaosMode) {
dogParkTitle.tint = Math.floor(Math.random() * 0xFFFFFF);
} else {
dogParkTitle.tint = 0xFF0000;
}
// Update seasonal theme indicator
if (seasonalThemes && seasonalThemes[seasonalThemeIndex]) {
var currentTheme = seasonalThemes[seasonalThemeIndex];
themeIndicator.setText(currentTheme.name);
themeIndicator.tint = currentTheme.colors[0];
}
// Animate per second display if value changed
var adjustedPerSecond = Math.floor(pointsPerSecond * prestigeMultiplier);
if (displayPerSecond !== adjustedPerSecond) {
tween.stop({
displayPerSecond: true
}); // Stop any existing tween
tween({
displayPerSecond: displayPerSecond
}, {
displayPerSecond: adjustedPerSecond
}, {
duration: 800,
easing: tween.easeOut,
onUpdate: function onUpdate() {
perSecondDisplay.setText('Per Second: ' + Math.floor(displayPerSecond));
},
onFinish: function onFinish() {
displayPerSecond = adjustedPerSecond;
perSecondDisplay.setText('Per Second: ' + adjustedPerSecond);
}
});
} else {
perSecondDisplay.setText('Per Second: ' + adjustedPerSecond);
}
for (var i = 0; i < upgradeButtons.length; i++) {
upgradeButtons[i].updateDisplay();
}
prestigeButton.updateDisplay();
}
function checkSkinUnlock() {
for (var i = skinMilestones.length - 1; i >= 0; i--) {
if (totalClicks >= skinMilestones[i] && currentSkin < i) {
currentSkin = i;
summer.updateSkin();
// Flash effect for skin unlock
LK.effects.flashScreen(0x00ff00, 500);
break;
}
}
}
function saveGame() {
storage.points = points;
storage.totalClicks = totalClicks;
storage.currentSkin = currentSkin;
storage.prestigeLevel = prestigeLevel;
// Save achievement data as individual keys to avoid nested objects in arrays
for (var i = 0; i < achievements.length; i++) {
var achievement = achievements[i];
var keyPrefix = 'achievement_' + achievement.id + '_';
storage[keyPrefix + 'current'] = achievement.current;
storage[keyPrefix + 'completed'] = achievement.completed;
storage[keyPrefix + 'claimed'] = achievement.claimed;
}
storage.completedAchievements = completedAchievements;
storage.totalPointsEarned = totalPointsEarned;
storage.timePlayed = timePlayed;
storage.highestCPS = highestCPS;
storage.totalUpgradesPurchased = totalUpgradesPurchased;
// Don't save pointsPerClick or pointsPerSecond - they should be calculated from upgrades
for (var i = 0; i < upgrades.length; i++) {
var upgrade = upgrades[i];
var baseName = upgrade.name.replace(/\s+/g, '');
storage[baseName.toLowerCase() + 'Cost'] = upgrade.cost;
storage[baseName.toLowerCase() + 'Owned'] = upgrade.owned;
}
// Save relaxation preferences
storage.relaxationPreferences = relaxationPreferences;
}
// Statistics button interaction
statsButton.down = function (x, y, obj) {
showingStats = !showingStats;
if (showingStats) {
statsPanel.updateStats();
tween(statsPanel, {
alpha: 1
}, {
duration: 300,
easing: tween.easeOut
});
} else {
tween(statsPanel, {
alpha: 0
}, {
duration: 300,
easing: tween.easeOut
});
}
};
// Initialize prestige orbs if player has prestige levels
if (prestigeLevel > 0) {
createMultiplierOrbs();
}
// Create floating particles for visual appeal
createFloatingParticles();
// Meditation and relaxation features
var meditationBubbles = [];
var relaxationMode = null;
var isInRelaxationMode = false;
var relaxationPreferences = storage.relaxationPreferences || {
autoRelaxationReminder: true,
bubbleIntensity: 1,
meditationSoundEnabled: true
};
// Dynamic Relaxation Intensity System
var stressLevel = 0; // 0-100, higher = more stressed
var relaxationIntensity = 1; // 1-3, higher = more calming effects
var clickHistory = [];
var lastClickTime = 0;
var seasonalThemeIndex = 0;
var seasonalTimer = 0;
// Seasonal zen themes with colors and effects
var seasonalThemes = [{
name: "Spring Awakening",
colors: [0x98FB98, 0xE6E6FA, 0xF0F8FF, 0xFFF8DC],
bgColors: [0x8FBC8F, 0x9370DB, 0x8B4B9C],
affirmations: ["New beginnings bloom within you", "Feel the fresh energy of spring", "You are growing beautifully"]
}, {
name: "Summer Serenity",
colors: [0xFFE4B5, 0x87CEEB, 0xF0F8FF, 0xFFFAF0],
bgColors: [0xDDA0DD, 0xB0C4DE, 0x8B4B9C],
affirmations: ["Bask in the warm glow of peace", "You radiate calm energy", "Feel the gentle summer breeze within"]
}, {
name: "Autumn Reflection",
colors: [0xDEB887, 0xCD853F, 0xF4A460, 0xFFE4B5],
bgColors: [0xBC8F8F, 0xCD853F, 0x8B4B9C],
affirmations: ["Let go of what no longer serves you", "Find beauty in change", "You are perfectly balanced"]
}, {
name: "Winter Stillness",
colors: [0xF0F8FF, 0xE6E6FA, 0xF5F5F5, 0xFFFAF0],
bgColors: [0x6495ED, 0x9370DB, 0x8B4B9C],
affirmations: ["Embrace the quiet within", "You are at perfect peace", "Rest in this moment of stillness"]
}];
// Mindfulness achievement definitions
var mindfulnessAchievements = [{
id: 'mindful_breathing',
name: 'Mindful Breather',
description: 'Complete 10 breathing cycles',
target: 10,
current: storage.mindful_breathing || 0,
claimed: storage.mindful_breathing_claimed || false
}, {
id: 'zen_master',
name: 'Zen Master',
description: 'Maintain low stress for 5 minutes',
target: 300,
// 5 minutes in seconds
current: storage.zen_master || 0,
claimed: storage.zen_master_claimed || false
}, {
id: 'seasonal_harmony',
name: 'Seasonal Harmony',
description: 'Experience all seasonal themes',
target: 4,
current: storage.seasonal_harmony || 0,
claimed: storage.seasonal_harmony_claimed || false
}];
function calculateStressLevel() {
var currentTime = Date.now();
// Remove old clicks (older than 10 seconds)
clickHistory = clickHistory.filter(function (clickTime) {
return currentTime - clickTime < 10000;
});
// Calculate stress based on click frequency
var clicksPerSecond = clickHistory.length / 10;
if (clicksPerSecond > 5) {
stressLevel = Math.min(100, stressLevel + 2);
} else if (clicksPerSecond < 1) {
stressLevel = Math.max(0, stressLevel - 1);
}
// Determine relaxation intensity based on stress
if (stressLevel > 70) {
relaxationIntensity = 3; // Maximum calming effects
} else if (stressLevel > 40) {
relaxationIntensity = 2; // Moderate calming effects
} else {
relaxationIntensity = 1; // Base level effects
}
}
function updateSeasonalTheme() {
seasonalTimer++;
// Change theme every 2 minutes (7200 ticks at 60fps)
if (seasonalTimer >= 7200) {
seasonalTimer = 0;
seasonalThemeIndex = (seasonalThemeIndex + 1) % seasonalThemes.length;
// Update mindfulness achievement
var uniqueThemes = storage.seasonal_themes_seen || [];
if (uniqueThemes.indexOf(seasonalThemeIndex) === -1) {
uniqueThemes.push(seasonalThemeIndex);
storage.seasonal_themes_seen = uniqueThemes;
mindfulnessAchievements[2].current = uniqueThemes.length;
}
// Show theme transition effect
var themeText = new Text2('~ ' + seasonalThemes[seasonalThemeIndex].name + ' ~', {
size: 48,
fill: seasonalThemes[seasonalThemeIndex].colors[0]
});
themeText.anchor.set(0.5, 0.5);
themeText.x = 1024;
themeText.y = 500;
themeText.alpha = 0;
game.addChild(themeText);
tween(themeText, {
alpha: 0.8,
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(themeText, {
alpha: 0,
y: themeText.y - 100
}, {
duration: 1500,
easing: tween.easeOut,
onFinish: function onFinish() {
themeText.destroy();
}
});
}
});
}
}
function createStressReliefEffect() {
if (stressLevel > 50) {
// Create extra calming bubbles when stressed
for (var i = 0; i < relaxationIntensity; i++) {
var calmingBubble = new MeditationBubble();
calmingBubble.x = summer.x + (Math.random() - 0.5) * 400;
calmingBubble.y = summer.y + (Math.random() - 0.5) * 400;
// Use current seasonal theme colors
var currentTheme = seasonalThemes[seasonalThemeIndex];
calmingBubble.children[0].tint = currentTheme.colors[Math.floor(Math.random() * currentTheme.colors.length)];
game.addChild(calmingBubble);
calmingBubble.startFloating();
}
// Play extra soothing sounds for high stress
if (relaxationPreferences.meditationSoundEnabled && Math.random() < 0.3) {
LK.getSound('windChimes').play();
}
}
}
function createMeditationBubbles() {
var bubbleCount = Math.floor(3 * relaxationPreferences.bubbleIntensity);
for (var i = 0; i < bubbleCount; i++) {
var bubble = new MeditationBubble();
bubble.x = Math.random() * 2048;
bubble.y = 2732 + Math.random() * 200;
meditationBubbles.push(bubble);
game.addChild(bubble);
bubble.startFloating();
}
}
function enterRelaxationMode() {
if (isInRelaxationMode) {
return;
}
isInRelaxationMode = true;
relaxationMode = new RelaxationMode();
relaxationMode.x = 1024;
relaxationMode.y = 1366;
game.addChild(relaxationMode);
relaxationMode.startRelaxation();
if (relaxationPreferences.meditationSoundEnabled) {
LK.getSound('meditation').play();
}
// Slow down all animations
for (var i = 0; i < zenBreathingOrbs.length; i++) {
tween.stop(zenBreathingOrbs[i]);
}
}
function exitRelaxationMode() {
if (!isInRelaxationMode) {
return;
}
isInRelaxationMode = false;
if (relaxationMode) {
relaxationMode.destroy();
relaxationMode = null;
}
// Resume normal zen breathing
for (var i = 0; i < zenBreathingOrbs.length; i++) {
zenBreathingOrbs[i].startBreathing();
}
}
// Create zen breathing orbs system with enhanced tranquility
var zenBreathingOrbs = [];
function createZenBreathingOrbs() {
var orbCount = 12; // More orbs for deeper zen atmosphere
for (var i = 0; i < orbCount; i++) {
var orb = new ZenBreathingOrb();
orb.x = 150 + Math.random() * 1748; // Wider distribution
orb.y = 350 + Math.random() * 2032; // Cover more area
zenBreathingOrbs.push(orb);
game.addChild(orb);
orb.startBreathing();
// Add gentle rotation for extra mesmerizing effect
tween(orb, {
rotation: orb.rotation + Math.PI * 2
}, {
duration: 30000 + Math.random() * 20000,
// Very slow rotation
easing: tween.linear,
onFinish: function onFinish() {
// Continue rotating indefinitely
tween(orb, {
rotation: orb.rotation + Math.PI * 2
}, {
duration: 30000,
easing: tween.linear
});
}
});
}
}
// Initialize zen breathing orbs
createZenBreathingOrbs();
// CHAOS VARIABLES
var chaoticDog = null;
var chaoticBullets = [];
var chaosPortals = [];
var chaosMode = false;
var chaosTimer = 0;
var screenShakeIntensity = 0;
var randomEventTimer = 0;
var insanityLevel = 0;
var colorChaos = false;
var explosionQueue = [];
// FEVER DREAM VARIABLES
var realityDistortionLevel = 0;
var psychedelicColorPhase = 0;
var timeDistortion = 1;
var dreamSequenceActive = false;
var hallucinationTimer = 0;
var colorShiftIntensity = 0;
var perspectiveWarping = false;
var dreamParticles = [];
var realityGlitches = [];
var psychedelicTrails = [];
// Create chaotic dog with gun
chaoticDog = new ChaoticDogWithGun();
chaoticDog.x = 300;
chaoticDog.y = 800;
game.addChild(chaoticDog);
// Create chaos portals
for (var i = 0; i < 3; i++) {
var portal = new ChaosPortal();
portal.x = 200 + i * 600;
portal.y = 400 + Math.random() * 200;
chaosPortals.push(portal);
game.addChild(portal);
}
// Create tutorial text in the empty center-left area
var tutorialPanel = new TutorialText();
tutorialPanel.x = 400; // Center-left position to avoid overlapping with other UI
tutorialPanel.y = 900; // Middle height position
game.addChild(tutorialPanel);
// Create breathing guide for ultimate relaxation
var breathingGuide = new BreathingGuide();
breathingGuide.x = 1024;
breathingGuide.y = 800;
game.addChild(breathingGuide);
breathingGuide.startBreathingGuide();
// Soothing waves system
var soothingWaves = [];
function createSoothingWave() {
var wave = new SoothingWave();
wave.x = Math.random() * 2048;
wave.y = 1200 + Math.random() * 800;
soothingWaves.push(wave);
game.addChild(wave);
wave.startWave();
}
// Relaxing affirmations system
var affirmationTimer = 0;
function showRelaxingAffirmation() {
var affirmation = new RelaxingAffirmation();
affirmation.x = 1024;
affirmation.y = 600 + Math.random() * 400;
game.addChild(affirmation);
affirmation.showAffirmation();
}
// Create floating stars system
var floatingStars = [];
function createFloatingStars() {
var starCount = 20;
for (var i = 0; i < starCount; i++) {
var star = new FloatingStar();
star.x = Math.random() * 2048;
star.y = Math.random() * 2732;
floatingStars.push(star);
game.addChild(star);
star.startTwinkle();
}
}
// Zen background color wave effect
var zenColorWave = 0;
var zenColors = [0x8B4B9C,
// Original purple
0x9370DB,
// Medium slate blue
0x7B68EE,
// Medium slate blue
0x6A5ACD,
// Slate blue
0x8A2BE2 // Blue violet
];
var currentZenColorIndex = 0;
function updateZenBackgroundWave() {
zenColorWave += 0.008; // Very slow transition for zen feeling
// Use seasonal theme colors if available
var currentTheme = seasonalThemes[seasonalThemeIndex];
var activeZenColors = currentTheme ? currentTheme.bgColors : zenColors;
// Transition between zen colors very slowly
if (zenColorWave >= Math.PI * 2) {
zenColorWave = 0;
currentZenColorIndex = (currentZenColorIndex + 1) % activeZenColors.length;
}
var nextColorIndex = (currentZenColorIndex + 1) % activeZenColors.length;
var currentColor = activeZenColors[currentZenColorIndex];
var nextColor = activeZenColors[nextColorIndex];
// Smooth transition between colors
var transition = (Math.sin(zenColorWave) + 1) * 0.5;
var currentRed = currentColor >> 16 & 0xFF;
var currentGreen = currentColor >> 8 & 0xFF;
var currentBlue = currentColor & 0xFF;
var nextRed = nextColor >> 16 & 0xFF;
var nextGreen = nextColor >> 8 & 0xFF;
var nextBlue = nextColor & 0xFF;
var red = Math.floor(currentRed + (nextRed - currentRed) * transition);
var green = Math.floor(currentGreen + (nextGreen - currentGreen) * transition);
var blue = Math.floor(currentBlue + (nextBlue - currentBlue) * transition);
var finalColor = red << 16 | green << 8 | blue;
game.setBackgroundColor(finalColor);
}
// Initialize floating stars
createFloatingStars();
// Initial UI update
updateUI();
// Start peaceful background music
LK.playMusic('peacefulBgMusic');
// Touch controls for scrolling
game.down = function (x, y, obj) {
if (x > 1550) {
// Adjust for new upgrade container position
isDragging = true;
lastTouchY = y;
}
};
game.up = function (x, y, obj) {
isDragging = false;
};
game.move = function (x, y, obj) {
if (isDragging && x > 1550) {
// Adjust for new upgrade container position
var deltaY = y - lastTouchY;
scrollY = Math.max(0, Math.min(maxScroll, scrollY - deltaY));
upgradeContainer.y = 350 - scrollY;
lastTouchY = y;
}
};
game.update = function () {
// Update time played
var currentTime = Date.now();
timePlayed += (currentTime - gameStartTime) / 1000;
gameStartTime = currentTime;
// Track clicks per second
if (currentTime - lastSecondTime >= 1000) {
var currentCPS = clicksInLastSecond;
if (currentCPS > highestCPS) {
highestCPS = currentCPS;
}
clicksInLastSecond = 0;
lastSecondTime = currentTime;
}
// Update active boosts
updateBoostMultiplier();
// Auto-clicker logic
autoClickTimer++;
if (autoClickTimer >= 60) {
// Every second at 60 FPS
var autoBoost = activeBoosts.auto ? activeBoosts.auto.multiplier : 1;
var allBoost = activeBoosts.all ? activeBoosts.all.multiplier : 1;
var autoPoints = pointsPerSecond * prestigeMultiplier * autoBoost * allBoost;
points += autoPoints;
totalPointsEarned += autoPoints;
autoClickTimer = 0;
updateAchievements();
updateUI();
if (pointsPerSecond > 0) {
saveGame();
}
}
// Update boost buttons
for (var i = 0; i < boostButtons.length; i++) {
boostButtons[i].updateDisplay();
}
// Update clicker features
updateClickPowerUps();
// Update combo timer
if (comboTimer > 0) {
comboTimer--;
if (comboTimer <= 0 && comboCount > 1) {
// Combo ended, reset
comboCount = 0;
comboMultiplier = 1;
}
}
// Increase critical chance based on upgrades and combo
criticalChance = 0.05 + totalUpgradesPurchased * 0.001 + comboCount * 0.002;
criticalChance = Math.min(criticalChance, 0.5); // Cap at 50%
// Update stress level and relaxation systems
calculateStressLevel();
updateSeasonalTheme();
// Create stress relief effects when needed
if (LK.ticks % (180 - relaxationIntensity * 30) === 0) {
// More frequent when stressed
createStressReliefEffect();
}
// Update zen master achievement (low stress for 5 minutes)
if (stressLevel < 30) {
mindfulnessAchievements[1].current++;
if (mindfulnessAchievements[1].current >= 300) {
// 5 minutes
storage.zen_master = mindfulnessAchievements[1].current;
}
} else {
mindfulnessAchievements[1].current = 0; // Reset if stress gets high
}
// Update zen background wave effect
updateZenBackgroundWave();
// Update zen breathing orbs
for (var i = 0; i < zenBreathingOrbs.length; i++) {
zenBreathingOrbs[i].update();
}
// Regenerate particles that go off screen
for (var i = floatingParticles.length - 1; i >= 0; i--) {
var particle = floatingParticles[i];
if (particle.x < -100 || particle.x > 2148 || particle.y < -100 || particle.y > 2832) {
particle.destroy();
floatingParticles.splice(i, 1);
// Create new particle to replace it
var newParticle = new FloatingParticle();
newParticle.x = Math.random() * 2048;
newParticle.y = Math.random() * 2732;
floatingParticles.push(newParticle);
game.addChild(newParticle);
newParticle.startFloat();
}
}
// Regenerate stars that drift off screen
for (var i = floatingStars.length - 1; i >= 0; i--) {
var star = floatingStars[i];
// Stars wrap around automatically in their update, so no need to recreate
}
// Create gentle zen particles around summer instead of rainbow burst
if (LK.ticks % 240 === 0) {
// Every 4 seconds - slower for more zen feeling
for (var i = 0; i < 3; i++) {
var zenParticle = new FloatingParticle();
zenParticle.x = summer.x + (Math.random() - 0.5) * 300;
zenParticle.y = summer.y + (Math.random() - 0.5) * 300;
// Apply zen colors to particles
var zenParticleColors = [0xE6E6FA, 0xF0F8FF, 0x98FB98, 0x87CEEB, 0xFFE4B5];
zenParticle.attachedGraphics = zenParticle.children[0];
if (zenParticle.attachedGraphics) {
zenParticle.attachedGraphics.tint = zenParticleColors[Math.floor(Math.random() * zenParticleColors.length)];
zenParticle.attachedGraphics.alpha = 0.2;
}
floatingParticles.push(zenParticle);
game.addChild(zenParticle);
zenParticle.startFloat();
}
}
// Add gentle sparkles around the main play area
if (LK.ticks % 120 === 0) {
// Every 2 seconds
var sparkle = new ClickEffect();
sparkle.x = 400 + Math.random() * 800;
sparkle.y = 1200 + Math.random() * 600;
game.addChild(sparkle);
sparkle.animate();
}
// Create meditation bubbles periodically
if (LK.ticks % 300 === 0) {
// Every 5 seconds
createMeditationBubbles();
}
// Create soothing waves periodically for ultimate relaxation
if (LK.ticks % 240 === 0) {
// Every 4 seconds
createSoothingWave();
}
// Show peaceful affirmations periodically
affirmationTimer++;
if (affirmationTimer >= 1800) {
// Every 30 seconds
showRelaxingAffirmation();
affirmationTimer = 0;
}
// Ambient sound cycling for deep relaxation
if (LK.ticks % 900 === 0) {
// Every 15 seconds
var ambientSounds = ['windChimes', 'gentleWaves', 'softRain'];
var randomSound = ambientSounds[Math.floor(Math.random() * ambientSounds.length)];
if (relaxationPreferences.meditationSoundEnabled) {
LK.getSound(randomSound).play();
}
}
// Switch to deeper meditation music occasionally
if (LK.ticks % 3600 === 0) {
// Every minute
if (Math.random() < 0.3) {
// 30% chance
LK.playMusic('tibetanBowls', {
fade: {
start: 0,
end: 0.2,
duration: 2000
}
});
}
}
// Update meditation bubbles
for (var i = meditationBubbles.length - 1; i >= 0; i--) {
var bubble = meditationBubbles[i];
if (bubble.y < -100) {
bubble.destroy();
meditationBubbles.splice(i, 1);
}
}
// Update relaxation mode
if (isInRelaxationMode && relaxationMode) {
relaxationMode.update();
}
// CHAOS UPDATES
if (chaoticDog) {
chaoticDog.update();
}
// Update chaotic bullets
for (var i = chaoticBullets.length - 1; i >= 0; i--) {
var bullet = chaoticBullets[i];
bullet.update();
if (bullet.life <= 0) {
chaoticBullets.splice(i, 1);
}
}
// Update chaos portals
for (var i = 0; i < chaosPortals.length; i++) {
chaosPortals[i].update();
}
// Screen shake effect
if (screenShakeIntensity > 0) {
game.x = (Math.random() - 0.5) * screenShakeIntensity;
game.y = (Math.random() - 0.5) * screenShakeIntensity;
screenShakeIntensity *= 0.9;
if (screenShakeIntensity < 0.1) {
screenShakeIntensity = 0;
game.x = 0;
game.y = 0;
}
}
// Random chaos events
randomEventTimer++;
if (randomEventTimer >= 60) {
// Every second now - MORE CHAOS
randomEventTimer = 0;
var randomEvent = Math.floor(Math.random() * 12); // More random events
switch (randomEvent) {
case 0:
// Color chaos
colorChaos = !colorChaos;
if (colorChaos) {
var randomColor = Math.floor(Math.random() * 0xFFFFFF);
game.setBackgroundColor(randomColor);
}
break;
case 1:
// Spawn explosion at random location
var randomExplosion = new ExplodingClickEffect();
randomExplosion.x = Math.random() * 2048;
randomExplosion.y = Math.random() * 2732;
game.addChild(randomExplosion);
break;
case 2:
// Make dog go crazy
if (chaoticDog) {
chaoticDog.craziness = 20;
chaoticDog.startChaos();
}
break;
case 3:
// Flash random color
var flashColor = Math.floor(Math.random() * 0xFFFFFF);
LK.effects.flashScreen(flashColor, 300);
break;
case 4:
// Multiply points randomly
var multiplier = 1 + Math.random() * 10;
points *= multiplier;
break;
case 5:
// Teleport all upgrade buttons randomly
for (var i = 0; i < upgradeButtons.length; i++) {
tween(upgradeButtons[i], {
x: (Math.random() - 0.5) * 800,
y: upgradeButtons[i].y + (Math.random() - 0.5) * 500
}, {
duration: 1000,
easing: tween.bounceOut
});
}
break;
case 6:
// Make everything giant then tiny
var elements = [pointsDisplay, perSecondDisplay, prestigeDisplay];
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
if (element && _typeof(element) === 'object') {
tween(element, {
scaleX: 3,
scaleY: 3
}, {
duration: 200,
easing: tween.bounceOut,
onFinish: function onFinish() {
tween(element, {
scaleX: 0.5,
scaleY: 0.5
}, {
duration: 300,
easing: tween.elasticOut,
onFinish: function onFinish() {
tween(element, {
scaleX: 1,
scaleY: 1
}, {
duration: 400,
easing: tween.bounceOut
});
}
});
}
});
}
}
break;
case 7:
// Spawn mega chaos portal
var megaPortal = new MegaChaosPortal();
megaPortal.x = Math.random() * 2048;
megaPortal.y = Math.random() * 2732;
game.addChild(megaPortal);
break;
case 8:
// Make dog spin wildly
tween(summer, {
rotation: summer.rotation + Math.PI * 10
}, {
duration: 2000,
easing: tween.elasticOut
});
break;
case 9:
// Random tint everything
var randomTint = Math.floor(Math.random() * 0xFFFFFF);
summer.tint = randomTint;
for (var i = 0; i < upgradeButtons.length; i++) {
upgradeButtons[i].tint = Math.floor(Math.random() * 0xFFFFFF);
}
break;
case 10:
// Shake everything violently
screenShakeIntensity = 50;
break;
case 11:
// Spawn 50 explosions everywhere
for (var i = 0; i < 50; i++) {
var crazyExplosion = new ExplodingClickEffect();
crazyExplosion.x = Math.random() * 2048;
crazyExplosion.y = Math.random() * 2732;
game.addChild(crazyExplosion);
}
break;
}
}
// Chaos mode effects
if (chaosMode) {
chaosTimer++;
if (chaosTimer % 10 === 0) {
// Every 6 frames - MUCH MORE FREQUENT
// Spawn random explosions everywhere
for (var i = 0; i < 10; i++) {
var chaosExplosion = new ExplodingClickEffect();
chaosExplosion.x = Math.random() * 2048;
chaosExplosion.y = Math.random() * 2732;
game.addChild(chaosExplosion);
}
// Random screen flashes
var randomColor = Math.floor(Math.random() * 0xFFFFFF);
LK.effects.flashScreen(randomColor, 50);
// Random background colors
game.setBackgroundColor(Math.floor(Math.random() * 0xFFFFFF));
// Make everything morph constantly
tween(summer, {
scaleX: 0.5 + Math.random() * 2,
scaleY: 0.5 + Math.random() * 2,
rotation: summer.rotation + (Math.random() - 0.5) * Math.PI
}, {
duration: 100,
easing: tween.bounceOut
});
// Morph upgrade container
tween(upgradeContainer, {
scaleX: 0.3 + Math.random() * 1.4,
scaleY: 0.3 + Math.random() * 1.4,
rotation: upgradeContainer.rotation + (Math.random() - 0.5) * Math.PI * 0.5
}, {
duration: 150,
easing: tween.elasticOut
});
// Teleport dog randomly
if (Math.random() < 0.3) {
tween(summer, {
x: 200 + Math.random() * 1600,
y: 400 + Math.random() * 1800
}, {
duration: 50,
easing: tween.bounceOut
});
}
}
// NEVER RESET CHAOS MODE - PERMANENT INSANITY
if (chaosTimer >= 1200) {
// After 20 seconds, make it even MORE chaotic
chaosTimer = 0;
insanityLevel += 50; // Keep increasing insanity
}
}
// Make everything spin when insanity is high
if (insanityLevel > 50) {
summer.rotation += 0.1;
for (var i = 0; i < upgradeButtons.length; i++) {
upgradeButtons[i].rotation += 0.05;
}
}
// EXTREME CHAOS EFFECTS
if (insanityLevel > 75) {
// Make ALL UI elements spin wildly
pointsDisplay.rotation += 0.2;
perSecondDisplay.rotation -= 0.15;
prestigeDisplay.rotation += 0.1;
dogParkTitle.rotation += 0.3;
insanityDisplay.rotation -= 0.25;
comboDisplay.rotation += 0.18;
zenMeter.rotation -= 0.12;
themeIndicator.rotation += 0.22;
}
// CHAOTIC SCALING AND MORPHING
if (chaosMode) {
// Make everything pulsate and morph
var chaosScale = 1 + Math.sin(LK.ticks * 0.1) * 0.3;
var chaosScale2 = 1 + Math.cos(LK.ticks * 0.08) * 0.2;
summer.scaleX = chaosScale;
summer.scaleY = chaosScale2;
// Make UI elements randomly scale
if (LK.ticks % 5 === 0) {
tween(pointsDisplay, {
scaleX: 0.5 + Math.random() * 1.5,
scaleY: 0.5 + Math.random() * 1.5
}, {
duration: 200,
easing: tween.bounceOut
});
}
// Randomly move upgrade buttons
if (LK.ticks % 20 === 0) {
for (var i = 0; i < upgradeButtons.length; i++) {
tween(upgradeButtons[i], {
x: (Math.random() - 0.5) * 200,
y: upgradeButtons[i].y + (Math.random() - 0.5) * 100
}, {
duration: 500,
easing: tween.elasticOut
});
}
}
}
// INSANITY LEVEL EFFECTS
if (insanityLevel > 80) {
// Make the entire upgrade container dance
tween(upgradeContainer, {
rotation: upgradeContainer.rotation + Math.PI * 0.1,
scaleX: 0.8 + Math.random() * 0.4,
scaleY: 0.8 + Math.random() * 0.4
}, {
duration: 100,
easing: tween.linear
});
}
// ULTIMATE CHAOS AT MAX INSANITY
if (insanityLevel >= 100) {
// Make EVERYTHING go completely insane
if (LK.ticks % 10 === 0) {
var elements = [pointsDisplay, perSecondDisplay, prestigeDisplay, dogParkTitle, insanityDisplay, comboDisplay, zenMeter, themeIndicator];
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
if (element && _typeof(element) === 'object') {
tween(element, {
x: element.x + (Math.random() - 0.5) * 500,
y: element.y + (Math.random() - 0.5) * 300,
rotation: element.rotation + (Math.random() - 0.5) * Math.PI,
scaleX: 0.3 + Math.random() * 2,
scaleY: 0.3 + Math.random() * 2,
alpha: 0.3 + Math.random() * 0.7
}, {
duration: 300,
easing: tween.bounceOut
});
}
}
}
}
// FEVER DREAM EFFECTS
realityDistortionLevel = Math.min(200, realityDistortionLevel + 0.5);
psychedelicColorPhase += 0.15;
hallucinationTimer++;
// Psychedelic color shifting - make everything rainbow and trippy
if (realityDistortionLevel > 50) {
var rainbowR = Math.floor(127 + Math.sin(psychedelicColorPhase) * 127);
var rainbowG = Math.floor(127 + Math.sin(psychedelicColorPhase + Math.PI * 2 / 3) * 127);
var rainbowB = Math.floor(127 + Math.sin(psychedelicColorPhase + Math.PI * 4 / 3) * 127);
var psychedelicColor = rainbowR << 16 | rainbowG << 8 | rainbowB;
// Make background shift through rainbow colors
game.setBackgroundColor(psychedelicColor);
// Make UI elements rainbow too
pointsDisplay.tint = psychedelicColor;
perSecondDisplay.tint = (psychedelicColor + 0x333333) % 0xFFFFFF;
prestigeDisplay.tint = (psychedelicColor + 0x666666) % 0xFFFFFF;
dogParkTitle.tint = (psychedelicColor + 0x999999) % 0xFFFFFF;
}
// Time distortion effects - make everything feel dreamlike
if (realityDistortionLevel > 75) {
timeDistortion = 1 + Math.sin(LK.ticks * 0.1) * 0.8;
// Make everything move in slow motion or fast forward randomly
if (LK.ticks % 60 === 0) {
var allElements = [summer, upgradeContainer, prestigeButton, achievementContainer, boostContainer];
for (var i = 0; i < allElements.length; i++) {
var element = allElements[i];
if (element && _typeof2(element) === 'object') {
var timeWarp = 0.3 + Math.random() * 2;
tween(element, {
scaleX: element.scaleX * timeWarp,
scaleY: element.scaleY * timeWarp
}, {
duration: 2000 + Math.random() * 3000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(element, {
scaleX: 1,
scaleY: 1
}, {
duration: 1000,
easing: tween.easeOut
});
}
});
}
}
}
}
// Perspective warping - make things feel like they're bending reality
if (realityDistortionLevel > 100) {
perspectiveWarping = true;
// Make the entire game world warp and bend
var warpStrength = Math.sin(LK.ticks * 0.05) * 50;
game.x = warpStrength;
game.y = Math.cos(LK.ticks * 0.07) * 30;
game.rotation = Math.sin(LK.ticks * 0.03) * 0.1;
// Make individual elements float and drift
summer.y += Math.sin(LK.ticks * 0.08) * 2;
summer.x += Math.cos(LK.ticks * 0.06) * 1.5;
upgradeContainer.rotation += Math.sin(LK.ticks * 0.04) * 0.02;
upgradeContainer.y += Math.cos(LK.ticks * 0.09) * 3;
}
// Hallucination effects - spawn fake objects that fade away
if (hallucinationTimer % 120 === 0 && realityDistortionLevel > 80) {
// Create fake dogs that aren't real
for (var i = 0; i < 3; i++) {
var fakeDog = new DogPark();
fakeDog.x = Math.random() * 2048;
fakeDog.y = Math.random() * 2732;
fakeDog.alpha = 0.3 + Math.random() * 0.4;
fakeDog.tint = Math.floor(Math.random() * 0xFFFFFF);
fakeDog.scaleX = 0.5 + Math.random() * 1.5;
fakeDog.scaleY = 0.5 + Math.random() * 1.5;
game.addChild(fakeDog);
// Make it fade away and move weirdly
tween(fakeDog, {
alpha: 0,
x: fakeDog.x + (Math.random() - 0.5) * 500,
y: fakeDog.y + (Math.random() - 0.5) * 500,
rotation: fakeDog.rotation + Math.PI * 2,
scaleX: fakeDog.scaleX * 2,
scaleY: fakeDog.scaleY * 2
}, {
duration: 3000 + Math.random() * 2000,
easing: tween.easeOut,
onFinish: function onFinish() {
fakeDog.destroy();
}
});
}
}
// Dream particle effects - floating geometric shapes
if (LK.ticks % 30 === 0 && realityDistortionLevel > 60) {
for (var i = 0; i < 5; i++) {
var dreamParticle = new FloatingParticle();
dreamParticle.x = Math.random() * 2048;
dreamParticle.y = Math.random() * 2732;
dreamParticle.alpha = 0.2 + Math.random() * 0.3;
dreamParticle.tint = Math.floor(Math.random() * 0xFFFFFF);
dreamParticle.scaleX = 0.1 + Math.random() * 0.5;
dreamParticle.scaleY = 0.1 + Math.random() * 0.5;
dreamParticles.push(dreamParticle);
game.addChild(dreamParticle);
// Make them move in impossible ways
tween(dreamParticle, {
x: dreamParticle.x + (Math.random() - 0.5) * 1000,
y: dreamParticle.y + (Math.random() - 0.5) * 1000,
rotation: dreamParticle.rotation + Math.PI * 4,
scaleX: dreamParticle.scaleX * 5,
scaleY: dreamParticle.scaleY * 5,
alpha: 0
}, {
duration: 4000 + Math.random() * 3000,
easing: tween.easeInOut,
onFinish: function onFinish() {
dreamParticle.destroy();
}
});
}
}
// Reality glitches - make parts of the screen "tear" and glitch
if (realityDistortionLevel > 120) {
if (LK.ticks % 45 === 0) {
// Create glitch strips
for (var i = 0; i < 8; i++) {
var glitchStrip = LK.getAsset('clickEffect', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 20,
scaleY: 0.5,
alpha: 0.8
});
glitchStrip.x = Math.random() * 2048;
glitchStrip.y = Math.random() * 2732;
glitchStrip.tint = Math.floor(Math.random() * 0xFFFFFF);
game.addChild(glitchStrip);
// Make them glitch and disappear
tween(glitchStrip, {
x: glitchStrip.x + (Math.random() - 0.5) * 200,
scaleY: glitchStrip.scaleY * 10,
alpha: 0
}, {
duration: 500 + Math.random() * 1000,
easing: tween.easeOut,
onFinish: function onFinish() {
glitchStrip.destroy();
}
});
}
}
}
// Psychedelic trails - leave colorful trails behind moving objects
if (realityDistortionLevel > 90) {
if (LK.ticks % 10 === 0) {
var trail = new FloatingParticle();
trail.x = summer.x;
trail.y = summer.y;
trail.alpha = 0.5;
trail.tint = Math.floor(Math.random() * 0xFFFFFF);
trail.scaleX = 0.8;
trail.scaleY = 0.8;
psychedelicTrails.push(trail);
game.addChild(trail);
tween(trail, {
alpha: 0,
scaleX: 0.3,
scaleY: 0.3
}, {
duration: 2000,
easing: tween.easeOut,
onFinish: function onFinish() {
trail.destroy();
}
});
}
}
// Make numbers and text morph and change randomly
if (realityDistortionLevel > 150) {
if (LK.ticks % 20 === 0) {
// Make point display show weird numbers
var fakePoints = points + (Math.random() - 0.5) * points * 0.5;
pointsDisplay.setText('Points: ' + Math.floor(fakePoints));
// Make other text elements show surreal content
var surealTexts = ['Reality is melting...', 'The dog sees everything...', 'Time flows backwards...', 'You are the click...', 'Numbers have feelings...', 'The void barks back...'];
if (Math.random() < 0.3) {
dogParkTitle.setText(surealTexts[Math.floor(Math.random() * surealTexts.length)]);
}
}
}
// Dream sequence activation - everything becomes ethereal
if (realityDistortionLevel > 180) {
if (!dreamSequenceActive) {
dreamSequenceActive = true;
// Make everything become transparent and floaty
var allElements = [summer, upgradeContainer, prestigeButton, achievementContainer, boostContainer];
for (var i = 0; i < allElements.length; i++) {
var element = allElements[i];
if (element && _typeof2(element) === 'object') {
tween(element, {
alpha: 0.3 + Math.random() * 0.4,
scaleX: element.scaleX * (0.8 + Math.random() * 0.4),
scaleY: element.scaleY * (0.8 + Math.random() * 0.4)
}, {
duration: 3000,
easing: tween.easeInOut
});
}
}
}
// Make everything float and phase in and out of existence
if (LK.ticks % 60 === 0) {
var elements = [pointsDisplay, perSecondDisplay, prestigeDisplay, dogParkTitle, insanityDisplay];
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
if (element && _typeof2(element) === 'object') {
tween(element, {
alpha: 0.1 + Math.random() * 0.9,
y: element.y + (Math.random() - 0.5) * 100,
rotation: element.rotation + (Math.random() - 0.5) * Math.PI * 0.5
}, {
duration: 2000 + Math.random() * 2000,
easing: tween.easeInOut
});
}
}
}
}
// Random teleportation of main dog
if (Math.random() < 0.01) {
// 1% chance per frame
summer.x = 500 + Math.random() * 1000;
summer.y = 800 + Math.random() * 800;
LK.effects.flashScreen(0x00FFFF, 200);
}
// Save periodically
if (LK.ticks % 300 === 0) {
// Every 5 seconds
saveGame();
}
};