/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var AutoButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 }); buttonGraphics.tint = 0xff9800; self.cost = 100; self.level = 0; // Create button text var buttonText = new Text2('Otomatik Buton (100)', { size: 40, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function (x, y, obj) { if (LK.getScore() >= self.cost) { // Purchase upgrade LK.setScore(LK.getScore() - self.cost); self.level += 1; autoTapLevel = self.level; autoTapInterval = Math.max(1000, 8000 - (self.level - 1) * 1000); self.cost += 30; buttonText.setText('Otomatik Buton (' + self.cost + ')'); scoreText.setText(LK.getScore()); // Scale animation tween(self, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut }); // Flash effect tween(buttonGraphics, { tint: 0x00FF00 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(buttonGraphics, { tint: 0xff9800 }, { duration: 200, easing: tween.easeIn }); } }); } }; self.up = function (x, y, obj) { tween(self, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); }; return self; }); var FallingMoney = Container.expand(function () { var self = Container.call(this); var moneyGraphics = self.attachAsset('money', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.value = 10; self.update = function () { self.y += self.speed; // Remove if off screen if (self.y > 2732 + 100) { self.destroy(); } }; self.down = function (x, y, obj) { // Collect money LK.setScore(LK.getScore() + self.value); scoreText.setText(LK.getScore()); // Create floating text var floatingText = new FloatingText(); floatingText.init(self.value, self.x, self.y); game.addChild(floatingText); // Remove money self.destroy(); }; return self; }); var FloatingText = Container.expand(function () { var self = Container.call(this); self.init = function (points, x, y) { var text = new Text2('+' + points, { size: 80, fill: 0x00FF00 }); text.anchor.set(0.5, 0.5); self.addChild(text); self.x = x; self.y = y; // Animate the text floating upward and fading out tween(self, { y: self.y - 300, alpha: 0 }, { duration: 1500, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); var Heart = Container.expand(function () { var self = Container.call(this); var heartGraphics = self.attachAsset('heart', { anchorX: 0.5, anchorY: 0.5 }); self.init = function (x, y) { self.x = x; self.y = y; // Animate the heart floating upward and fading out tween(self, { y: self.y - 200, alpha: 0 }, { duration: 1500, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); var HoldButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 }); buttonGraphics.tint = 0x9c27b0; self.cost = 300; self.isHolding = false; self.holdTimer = 0; self.holdInterval = 100; // Points every 100ms while holding self.holdPointsPerInterval = 1; // Create button text var buttonText = new Text2('Basılı Tut (300)', { size: 40, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function (x, y, obj) { if (LK.getScore() >= self.cost) { // Purchase upgrade LK.setScore(LK.getScore() - self.cost); scoreText.setText(LK.getScore()); // Remove the hold button from the game self.destroy(); // Enable hold functionality on tap button tapButton.canHold = true; } }; self.up = function (x, y, obj) { self.isHolding = false; tween(self, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); }; self.update = function () { if (self.isHolding) { self.holdTimer += 16.67; // Approximately 60 FPS if (self.holdTimer >= self.holdInterval) { self.holdTimer = 0; LK.setScore(LK.getScore() + self.holdPointsPerInterval); scoreText.setText(LK.getScore()); // Create floating text at button position var floatingText = new FloatingText(); floatingText.init(self.holdPointsPerInterval, self.x, self.y); game.addChild(floatingText); } } }; return self; }); var MusicUpgradeButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 }); buttonGraphics.tint = 0x9C27B0; self.cost = 700; // Create button text var buttonText = new Text2('Müzik (700)', { size: 40, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function (x, y, obj) { if (LK.getScore() >= self.cost) { // Purchase upgrade LK.setScore(LK.getScore() - self.cost); scoreText.setText(LK.getScore()); // Remove the music button from the game self.destroy(); // Set music as purchased musicUpgradePurchased = true; // Play the music LK.playMusic('Rahat'); // Show demo completion message var demoCompleteText = new Text2('demoyu bitirdin', { size: 100, fill: 0x00FF00 }); demoCompleteText.anchor.set(0.5, 0.5); demoCompleteText.x = 2048 / 2; demoCompleteText.y = 2732 / 2; game.addChild(demoCompleteText); // Animate demo complete text tween(demoCompleteText, { scaleX: 1.2, scaleY: 1.2, alpha: 0 }, { duration: 3000, easing: tween.easeOut, onFinish: function onFinish() { demoCompleteText.destroy(); // Create restart button after demo completion message disappears var restartButton = new RestartButton(); restartButton.x = 2048 - 200; // Right side with 200px margin (same as save button) restartButton.y = 2732 - 100; // Below save button with 100px margin from bottom game.addChild(restartButton); } }); // Scale animation tween(self, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut }); // Flash effect tween(buttonGraphics, { tint: 0x00FF00 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(buttonGraphics, { tint: 0x9C27B0 }, { duration: 200, easing: tween.easeIn }); } }); } }; self.up = function (x, y, obj) { tween(self, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); }; return self; }); var ParaGozCharacter = Container.expand(function () { var self = Container.call(this); // Create character graphics - simple colored box var characterGraphics = self.attachAsset('paragoz', { anchorX: 0.5, anchorY: 0.5 }); // Create character text var characterText = new Text2('Paragöz', { size: 30, fill: 0xFFFFFF }); characterText.anchor.set(0.5, 0.5); self.addChild(characterText); self.level = 1; self.collectInterval = 5000; // 5 seconds initially self.collectTimer = 0; self.loveCount = 0; self.down = function (x, y, obj) { // Increase love count self.loveCount += 1; // Create floating heart var heart = new Heart(); heart.init(self.x, self.y); game.addChild(heart); // Check if we reached 20 hearts milestone var milestone = Math.floor(self.loveCount / 20); var previousMilestone = Math.floor((self.loveCount - 1) / 20); if (milestone > previousMilestone && tapButton.canHold) { // Increase hold points per interval tapButton.holdPointsPerInterval += 1; // Play vihihi sound LK.getSound('vihihi').play(); // Show milestone message var milestoneText = new FloatingText(); milestoneText.init('+1 Hold Bonus!', self.x, self.y - 50); game.addChild(milestoneText); } }; self.update = function () { self.collectTimer += 16.67; // Approximately 60 FPS if (self.collectTimer >= self.collectInterval) { self.collectTimer = 0; // Find a falling money to collect for (var i = 0; i < fallingMoneyArray.length; i++) { var money = fallingMoneyArray[i]; if (money && !money.destroyed) { // Collect the money LK.setScore(LK.getScore() + money.value); scoreText.setText(LK.getScore()); // Create floating text at character position var floatingText = new FloatingText(); floatingText.init(money.value, self.x, self.y); game.addChild(floatingText); // Remove the money money.destroy(); fallingMoneyArray.splice(i, 1); break; // Only collect one money per interval } } } }; return self; }); var ParaGozUpgradeButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 }); buttonGraphics.tint = 0x4CAF50; self.cost = 500; self.level = 0; // Create button text var buttonText = new Text2('Paragöz (500)', { size: 40, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function (x, y, obj) { if (LK.getScore() >= self.cost) { // Purchase upgrade LK.setScore(LK.getScore() - self.cost); scoreText.setText(LK.getScore()); if (self.level === 0) { // First purchase - create the character paraGozCharacter = new ParaGozCharacter(); paraGozCharacter.x = 150; // Left side paraGozCharacter.y = 2732 - 150; // Bottom game.addChild(paraGozCharacter); paraGozActive = true; } else { // Upgrade - reduce collection time paraGozCharacter.collectInterval = Math.max(1000, paraGozCharacter.collectInterval - 500); paraGozCharacter.level += 1; } self.level += 1; self.cost += 200; buttonText.setText('Paragöz (' + self.cost + ')'); // Scale animation tween(self, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut }); // Flash effect tween(buttonGraphics, { tint: 0x00FF00 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(buttonGraphics, { tint: 0x4CAF50 }, { duration: 200, easing: tween.easeIn }); } }); } }; self.up = function (x, y, obj) { tween(self, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); }; return self; }); var RainUpgradeButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 }); buttonGraphics.tint = 0x2196F3; self.cost = 310; // Create button text var buttonText = new Text2('Para Yağmuru (310)', { size: 40, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function (x, y, obj) { if (LK.getScore() >= self.cost) { // Purchase upgrade LK.setScore(LK.getScore() - self.cost); scoreText.setText(LK.getScore()); // Remove the rain button from the game self.destroy(); // Enable money rain moneyRainActive = true; // Scale animation tween(self, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut }); // Flash effect tween(buttonGraphics, { tint: 0x00FF00 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(buttonGraphics, { tint: 0x2196F3 }, { duration: 200, easing: tween.easeIn }); } }); } }; self.up = function (x, y, obj) { tween(self, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); }; return self; }); var RestartButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 }); buttonGraphics.tint = 0xFF5722; // Create button text var buttonText = new Text2('Yeniden Başlat', { size: 40, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function (x, y, obj) { // Reset all game data storage.score = 0; storage.pointsPerTap = 1; storage.autoTapLevel = 0; storage.autoTapInterval = 8000; storage.canHold = false; storage.upgradeCost = 20; storage.autoCost = 100; storage.autoLevel = 0; storage.moneyRainActive = false; storage.holdCost = 300; storage.rainCost = 310; storage.paraGozActive = false; storage.paraGozCost = 500; storage.paraGozLevel = 0; storage.musicUpgradePurchased = false; storage.paraGozLoveCount = 0; storage.holdBonusFromLove = 0; // Reset score to 0 LK.setScore(0); // Show game over to trigger game reset LK.showGameOver(); }; self.up = function (x, y, obj) { tween(self, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); }; return self; }); var SaveButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 }); buttonGraphics.tint = 0x4CAF50; // Create button text var buttonText = new Text2('Kaydet', { size: 40, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function (x, y, obj) { // Save game data storage.score = LK.getScore(); storage.pointsPerTap = pointsPerTap; storage.autoTapLevel = autoTapLevel; storage.autoTapInterval = autoTapInterval; storage.canHold = tapButton.canHold; storage.upgradeCost = upgradeButton.cost; storage.autoCost = autoButton.cost; storage.autoLevel = autoButton.level; storage.moneyRainActive = moneyRainActive; storage.holdCost = holdButton ? holdButton.cost : 300; storage.rainCost = rainUpgradeButton ? rainUpgradeButton.cost : 310; storage.paraGozActive = paraGozActive; storage.paraGozCost = paraGozUpgradeButton.cost; storage.paraGozLevel = paraGozUpgradeButton.level; storage.musicUpgradePurchased = musicUpgradePurchased; // Save love system data storage.paraGozLoveCount = paraGozCharacter ? paraGozCharacter.loveCount : 0; storage.holdBonusFromLove = tapButton.canHold ? Math.max(0, tapButton.holdPointsPerInterval - 1) : 0; // Visual feedback tween(self, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut }); // Flash effect tween(buttonGraphics, { tint: 0x00FF00 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(buttonGraphics, { tint: 0x4CAF50 }, { duration: 200, easing: tween.easeIn }); } }); // Show save confirmation var saveText = new Text2('Kaydedildi!', { size: 50, fill: 0x00FF00 }); saveText.anchor.set(0.5, 0.5); saveText.x = self.x; saveText.y = self.y - 100; game.addChild(saveText); // Animate save text tween(saveText, { y: saveText.y - 100, alpha: 0 }, { duration: 1000, easing: tween.easeOut, onFinish: function onFinish() { saveText.destroy(); } }); }; self.up = function (x, y, obj) { tween(self, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); }; return self; }); var StartButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('tapButton', { anchorX: 0.5, anchorY: 0.5 }); // Create button text var buttonText = new Text2('Bana Bas', { size: 80, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); buttonText.y = -50; // Move text up by 50 pixels self.addChild(buttonText); self.down = function (x, y, obj) { // Scale down animation tween(self, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut }); // Flash effect tween(buttonGraphics, { tint: 0xFFFFFF }, { duration: 150, easing: tween.easeOut, onFinish: function onFinish() { tween(buttonGraphics, { tint: 0xFFFFFF }, { duration: 150, easing: tween.easeIn }); } }); // Remove start button and show main game self.destroy(); showMainGame(); }; self.up = function (x, y, obj) { // Scale back to normal tween(self, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); }; return self; }); var TapButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('tapButton', { anchorX: 0.5, anchorY: 0.5 }); self.originalScale = 1.0; self.pressedScale = 0.9; self.canHold = false; self.isHolding = false; self.holdTimer = 0; self.holdInterval = 100; self.holdPointsPerInterval = 1; self.down = function (x, y, obj) { // Scale down animation tween(self, { scaleX: self.pressedScale, scaleY: self.pressedScale }, { duration: 100, easing: tween.easeOut }); // Flash effect tween(buttonGraphics, { tint: 0xFFFFFF }, { duration: 150, easing: tween.easeOut, onFinish: function onFinish() { tween(buttonGraphics, { tint: 0xFFFFFF }, { duration: 150, easing: tween.easeIn }); } }); // Play tap sound LK.getSound('tapSound').play(); // Add points LK.setScore(LK.getScore() + pointsPerTap); // Update display scoreText.setText(LK.getScore()); // Create floating text at button position var floatingText = new FloatingText(); floatingText.init(pointsPerTap, self.x, self.y); game.addChild(floatingText); // Start holding if hold functionality is enabled if (self.canHold) { self.isHolding = true; self.holdTimer = 0; } }; self.up = function (x, y, obj) { // Scale back to normal tween(self, { scaleX: self.originalScale, scaleY: self.originalScale }, { duration: 100, easing: tween.easeOut }); // Stop holding self.isHolding = false; }; self.update = function () { if (self.canHold && self.isHolding) { self.holdTimer += 16.67; // Approximately 60 FPS if (self.holdTimer >= self.holdInterval) { self.holdTimer = 0; LK.setScore(LK.getScore() + self.holdPointsPerInterval); scoreText.setText(LK.getScore()); // Create floating text at button position var floatingText = new FloatingText(); floatingText.init(self.holdPointsPerInterval, self.x, self.y); game.addChild(floatingText); } } }; return self; }); var UpgradeButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 }); self.cost = 20; self.upgrade = 1; // Create button text var buttonText = new Text2('+1 gelişim (20)', { size: 40, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function (x, y, obj) { if (LK.getScore() >= self.cost) { // Purchase upgrade LK.setScore(LK.getScore() - self.cost); pointsPerTap += 1; self.cost += 30; buttonText.setText('+1 gelişim (' + self.cost + ')'); scoreText.setText(LK.getScore()); // Scale animation tween(self, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut }); // Flash effect tween(buttonGraphics, { tint: 0x00FF00 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(buttonGraphics, { tint: 0xff9800 }, { duration: 200, easing: tween.easeIn }); } }); } }; self.up = function (x, y, obj) { tween(self, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x808080 }); /**** * Game Code ****/ // Game state var gameStarted = false; // Load saved data or use defaults var pointsPerTap = storage.pointsPerTap || 1; var autoTapLevel = storage.autoTapLevel || 0; var autoTapInterval = storage.autoTapInterval || 8000; var autoTapTimer = 0; var moneyRainActive = storage.moneyRainActive || false; var moneyRainTimer = 0; var moneyRainInterval = 1000; // Spawn money every 1 second var fallingMoneyArray = []; var paraGozActive = storage.paraGozActive || false; var paraGozCharacter = null; var musicUpgradePurchased = storage.musicUpgradePurchased || false; // Load saved score if (storage.score) { LK.setScore(storage.score); } // Load love system data var paraGozLoveCount = storage.paraGozLoveCount || 0; var holdBonusFromLove = storage.holdBonusFromLove || 0; // Function to show main game elements function showMainGame() { gameStarted = true; // Create and position the main tap button tapButton = new TapButton(); tapButton.x = 2048 / 2; tapButton.y = 2732 / 2; // Apply saved hold functionality if (storage.canHold) { tapButton.canHold = true; // Apply love bonus to hold points tapButton.holdPointsPerInterval += holdBonusFromLove; } game.addChild(tapButton); // Create and position upgrade button upgradeButton = new UpgradeButton(); upgradeButton.x = 2048 / 2; upgradeButton.y = tapButton.y + 300; // Apply saved upgrade cost if (storage.upgradeCost) { upgradeButton.cost = storage.upgradeCost; // Update button text to show saved cost upgradeButton.getChildAt(1).setText('+1 gelişim (' + upgradeButton.cost + ')'); } game.addChild(upgradeButton); // Create and position auto button autoButton = new AutoButton(); autoButton.x = 2048 / 2; autoButton.y = upgradeButton.y + 120; // Apply saved auto cost and level if (storage.autoCost) { autoButton.cost = storage.autoCost; // Update button text to show saved cost autoButton.getChildAt(1).setText('Otomatik Buton (' + autoButton.cost + ')'); } if (storage.autoLevel) { autoButton.level = storage.autoLevel; } game.addChild(autoButton); // Create and position hold button (only if not purchased) if (!storage.canHold) { holdButton = new HoldButton(); holdButton.x = 2048 / 2; holdButton.y = autoButton.y + 120; // Apply saved hold cost if (storage.holdCost) { holdButton.cost = storage.holdCost; // Update button text to show saved cost holdButton.getChildAt(1).setText('Basılı Tut (' + holdButton.cost + ')'); } game.addChild(holdButton); } // Create and position rain upgrade button (only if not purchased) if (!storage.moneyRainActive) { rainUpgradeButton = new RainUpgradeButton(); rainUpgradeButton.x = 2048 / 2; rainUpgradeButton.y = holdButton ? holdButton.y + 120 : autoButton.y + 120; // Apply saved rain cost if (storage.rainCost) { rainUpgradeButton.cost = storage.rainCost; // Update button text to show saved cost rainUpgradeButton.getChildAt(1).setText('Para Yağmuru (' + rainUpgradeButton.cost + ')'); } game.addChild(rainUpgradeButton); } // Create and position ParaGoz upgrade button paraGozUpgradeButton = new ParaGozUpgradeButton(); paraGozUpgradeButton.x = 2048 / 2; paraGozUpgradeButton.y = rainUpgradeButton ? rainUpgradeButton.y + 120 : holdButton ? holdButton.y + 120 : autoButton.y + 120; // Apply saved ParaGoz cost and level if (storage.paraGozCost) { paraGozUpgradeButton.cost = storage.paraGozCost; // Update button text to show saved cost paraGozUpgradeButton.getChildAt(1).setText('Paragöz (' + paraGozUpgradeButton.cost + ')'); } if (storage.paraGozLevel) { paraGozUpgradeButton.level = storage.paraGozLevel; } game.addChild(paraGozUpgradeButton); // Create and position music upgrade button (only if not purchased) if (!musicUpgradePurchased) { musicUpgradeButton = new MusicUpgradeButton(); musicUpgradeButton.x = 2048 / 2; musicUpgradeButton.y = paraGozUpgradeButton.y + 120; game.addChild(musicUpgradeButton); } // Create and position restart button (only if music upgrade is purchased) if (musicUpgradePurchased) { restartButton = new RestartButton(); restartButton.x = 2048 - 200; // Right side with 200px margin (same as save button) restartButton.y = 2732 - 100; // Below save button with 100px margin from bottom game.addChild(restartButton); } // Create ParaGoz character if previously purchased if (paraGozActive) { paraGozCharacter = new ParaGozCharacter(); paraGozCharacter.x = 150; // Left side paraGozCharacter.y = 2732 - 150; // Bottom if (storage.paraGozLevel) { paraGozCharacter.level = storage.paraGozLevel; paraGozCharacter.collectInterval = Math.max(1000, 5000 - (storage.paraGozLevel - 1) * 500); } // Apply saved love count paraGozCharacter.loveCount = paraGozLoveCount; game.addChild(paraGozCharacter); } // Create and position save button saveButton = new SaveButton(); saveButton.x = 2048 - 200; // Right side with 200px margin saveButton.y = 2732 - 200; // Bottom with 200px margin (moved up) game.addChild(saveButton); // Create score display scoreText = new Text2('0', { size: 120, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); scoreText.setText(LK.getScore()); LK.gui.top.addChild(scoreText); // Create instruction text instructionText = new Text2('Tap the button to earn points!', { size: 60, fill: 0xFFFFFF }); instructionText.anchor.set(0.5, 0); instructionText.y = 150; LK.gui.top.addChild(instructionText); } // Declare variables for game elements var tapButton; var upgradeButton; var autoButton; var holdButton; var rainUpgradeButton; var paraGozUpgradeButton; var musicUpgradeButton; var restartButton; var saveButton; var scoreText; var instructionText; // Create start button var startButton = new StartButton(); startButton.x = 2048 / 2; startButton.y = 2732 / 2; game.addChild(startButton); game.update = function () { // Only run main game logic if game has started if (!gameStarted) return; // Auto-tap logic if (autoTapLevel > 0) { autoTapTimer += 16.67; // Approximately 60 FPS, so ~16.67ms per frame if (autoTapTimer >= autoTapInterval) { autoTapTimer = 0; // Simulate tap on main button LK.setScore(LK.getScore() + pointsPerTap); scoreText.setText(LK.getScore()); LK.getSound('tapSound').play(); // Visual feedback for auto-tap tween(tapButton, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(tapButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); } }); } } // Money rain logic if (moneyRainActive) { moneyRainTimer += 16.67; // Approximately 60 FPS if (moneyRainTimer >= moneyRainInterval) { moneyRainTimer = 0; // Create falling money at random X position var fallingMoney = new FallingMoney(); fallingMoney.x = Math.random() * (2048 - 200) + 100; // Random X within screen bounds fallingMoney.y = -50; // Start above screen fallingMoneyArray.push(fallingMoney); game.addChild(fallingMoney); } // Clean up destroyed money from array for (var i = fallingMoneyArray.length - 1; i >= 0; i--) { if (fallingMoneyArray[i].destroyed) { fallingMoneyArray.splice(i, 1); } } } // Subtle pulsing animation for the button when idle if (LK.ticks % 120 === 0 && tapButton) { tween(tapButton, { scaleX: 1.05, scaleY: 1.05 }, { duration: 600, easing: tween.easeInOut, onFinish: function onFinish() { tween(tapButton, { scaleX: 1.0, scaleY: 1.0 }, { duration: 600, easing: tween.easeInOut }); } }); } };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var AutoButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5
});
buttonGraphics.tint = 0xff9800;
self.cost = 100;
self.level = 0;
// Create button text
var buttonText = new Text2('Otomatik Buton (100)', {
size: 40,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function (x, y, obj) {
if (LK.getScore() >= self.cost) {
// Purchase upgrade
LK.setScore(LK.getScore() - self.cost);
self.level += 1;
autoTapLevel = self.level;
autoTapInterval = Math.max(1000, 8000 - (self.level - 1) * 1000);
self.cost += 30;
buttonText.setText('Otomatik Buton (' + self.cost + ')');
scoreText.setText(LK.getScore());
// Scale animation
tween(self, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
easing: tween.easeOut
});
// Flash effect
tween(buttonGraphics, {
tint: 0x00FF00
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(buttonGraphics, {
tint: 0xff9800
}, {
duration: 200,
easing: tween.easeIn
});
}
});
}
};
self.up = function (x, y, obj) {
tween(self, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeOut
});
};
return self;
});
var FallingMoney = Container.expand(function () {
var self = Container.call(this);
var moneyGraphics = self.attachAsset('money', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.value = 10;
self.update = function () {
self.y += self.speed;
// Remove if off screen
if (self.y > 2732 + 100) {
self.destroy();
}
};
self.down = function (x, y, obj) {
// Collect money
LK.setScore(LK.getScore() + self.value);
scoreText.setText(LK.getScore());
// Create floating text
var floatingText = new FloatingText();
floatingText.init(self.value, self.x, self.y);
game.addChild(floatingText);
// Remove money
self.destroy();
};
return self;
});
var FloatingText = Container.expand(function () {
var self = Container.call(this);
self.init = function (points, x, y) {
var text = new Text2('+' + points, {
size: 80,
fill: 0x00FF00
});
text.anchor.set(0.5, 0.5);
self.addChild(text);
self.x = x;
self.y = y;
// Animate the text floating upward and fading out
tween(self, {
y: self.y - 300,
alpha: 0
}, {
duration: 1500,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
};
return self;
});
var Heart = Container.expand(function () {
var self = Container.call(this);
var heartGraphics = self.attachAsset('heart', {
anchorX: 0.5,
anchorY: 0.5
});
self.init = function (x, y) {
self.x = x;
self.y = y;
// Animate the heart floating upward and fading out
tween(self, {
y: self.y - 200,
alpha: 0
}, {
duration: 1500,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
};
return self;
});
var HoldButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5
});
buttonGraphics.tint = 0x9c27b0;
self.cost = 300;
self.isHolding = false;
self.holdTimer = 0;
self.holdInterval = 100; // Points every 100ms while holding
self.holdPointsPerInterval = 1;
// Create button text
var buttonText = new Text2('Basılı Tut (300)', {
size: 40,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function (x, y, obj) {
if (LK.getScore() >= self.cost) {
// Purchase upgrade
LK.setScore(LK.getScore() - self.cost);
scoreText.setText(LK.getScore());
// Remove the hold button from the game
self.destroy();
// Enable hold functionality on tap button
tapButton.canHold = true;
}
};
self.up = function (x, y, obj) {
self.isHolding = false;
tween(self, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeOut
});
};
self.update = function () {
if (self.isHolding) {
self.holdTimer += 16.67; // Approximately 60 FPS
if (self.holdTimer >= self.holdInterval) {
self.holdTimer = 0;
LK.setScore(LK.getScore() + self.holdPointsPerInterval);
scoreText.setText(LK.getScore());
// Create floating text at button position
var floatingText = new FloatingText();
floatingText.init(self.holdPointsPerInterval, self.x, self.y);
game.addChild(floatingText);
}
}
};
return self;
});
var MusicUpgradeButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5
});
buttonGraphics.tint = 0x9C27B0;
self.cost = 700;
// Create button text
var buttonText = new Text2('Müzik (700)', {
size: 40,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function (x, y, obj) {
if (LK.getScore() >= self.cost) {
// Purchase upgrade
LK.setScore(LK.getScore() - self.cost);
scoreText.setText(LK.getScore());
// Remove the music button from the game
self.destroy();
// Set music as purchased
musicUpgradePurchased = true;
// Play the music
LK.playMusic('Rahat');
// Show demo completion message
var demoCompleteText = new Text2('demoyu bitirdin', {
size: 100,
fill: 0x00FF00
});
demoCompleteText.anchor.set(0.5, 0.5);
demoCompleteText.x = 2048 / 2;
demoCompleteText.y = 2732 / 2;
game.addChild(demoCompleteText);
// Animate demo complete text
tween(demoCompleteText, {
scaleX: 1.2,
scaleY: 1.2,
alpha: 0
}, {
duration: 3000,
easing: tween.easeOut,
onFinish: function onFinish() {
demoCompleteText.destroy();
// Create restart button after demo completion message disappears
var restartButton = new RestartButton();
restartButton.x = 2048 - 200; // Right side with 200px margin (same as save button)
restartButton.y = 2732 - 100; // Below save button with 100px margin from bottom
game.addChild(restartButton);
}
});
// Scale animation
tween(self, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
easing: tween.easeOut
});
// Flash effect
tween(buttonGraphics, {
tint: 0x00FF00
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(buttonGraphics, {
tint: 0x9C27B0
}, {
duration: 200,
easing: tween.easeIn
});
}
});
}
};
self.up = function (x, y, obj) {
tween(self, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeOut
});
};
return self;
});
var ParaGozCharacter = Container.expand(function () {
var self = Container.call(this);
// Create character graphics - simple colored box
var characterGraphics = self.attachAsset('paragoz', {
anchorX: 0.5,
anchorY: 0.5
});
// Create character text
var characterText = new Text2('Paragöz', {
size: 30,
fill: 0xFFFFFF
});
characterText.anchor.set(0.5, 0.5);
self.addChild(characterText);
self.level = 1;
self.collectInterval = 5000; // 5 seconds initially
self.collectTimer = 0;
self.loveCount = 0;
self.down = function (x, y, obj) {
// Increase love count
self.loveCount += 1;
// Create floating heart
var heart = new Heart();
heart.init(self.x, self.y);
game.addChild(heart);
// Check if we reached 20 hearts milestone
var milestone = Math.floor(self.loveCount / 20);
var previousMilestone = Math.floor((self.loveCount - 1) / 20);
if (milestone > previousMilestone && tapButton.canHold) {
// Increase hold points per interval
tapButton.holdPointsPerInterval += 1;
// Play vihihi sound
LK.getSound('vihihi').play();
// Show milestone message
var milestoneText = new FloatingText();
milestoneText.init('+1 Hold Bonus!', self.x, self.y - 50);
game.addChild(milestoneText);
}
};
self.update = function () {
self.collectTimer += 16.67; // Approximately 60 FPS
if (self.collectTimer >= self.collectInterval) {
self.collectTimer = 0;
// Find a falling money to collect
for (var i = 0; i < fallingMoneyArray.length; i++) {
var money = fallingMoneyArray[i];
if (money && !money.destroyed) {
// Collect the money
LK.setScore(LK.getScore() + money.value);
scoreText.setText(LK.getScore());
// Create floating text at character position
var floatingText = new FloatingText();
floatingText.init(money.value, self.x, self.y);
game.addChild(floatingText);
// Remove the money
money.destroy();
fallingMoneyArray.splice(i, 1);
break; // Only collect one money per interval
}
}
}
};
return self;
});
var ParaGozUpgradeButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5
});
buttonGraphics.tint = 0x4CAF50;
self.cost = 500;
self.level = 0;
// Create button text
var buttonText = new Text2('Paragöz (500)', {
size: 40,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function (x, y, obj) {
if (LK.getScore() >= self.cost) {
// Purchase upgrade
LK.setScore(LK.getScore() - self.cost);
scoreText.setText(LK.getScore());
if (self.level === 0) {
// First purchase - create the character
paraGozCharacter = new ParaGozCharacter();
paraGozCharacter.x = 150; // Left side
paraGozCharacter.y = 2732 - 150; // Bottom
game.addChild(paraGozCharacter);
paraGozActive = true;
} else {
// Upgrade - reduce collection time
paraGozCharacter.collectInterval = Math.max(1000, paraGozCharacter.collectInterval - 500);
paraGozCharacter.level += 1;
}
self.level += 1;
self.cost += 200;
buttonText.setText('Paragöz (' + self.cost + ')');
// Scale animation
tween(self, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
easing: tween.easeOut
});
// Flash effect
tween(buttonGraphics, {
tint: 0x00FF00
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(buttonGraphics, {
tint: 0x4CAF50
}, {
duration: 200,
easing: tween.easeIn
});
}
});
}
};
self.up = function (x, y, obj) {
tween(self, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeOut
});
};
return self;
});
var RainUpgradeButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5
});
buttonGraphics.tint = 0x2196F3;
self.cost = 310;
// Create button text
var buttonText = new Text2('Para Yağmuru (310)', {
size: 40,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function (x, y, obj) {
if (LK.getScore() >= self.cost) {
// Purchase upgrade
LK.setScore(LK.getScore() - self.cost);
scoreText.setText(LK.getScore());
// Remove the rain button from the game
self.destroy();
// Enable money rain
moneyRainActive = true;
// Scale animation
tween(self, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
easing: tween.easeOut
});
// Flash effect
tween(buttonGraphics, {
tint: 0x00FF00
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(buttonGraphics, {
tint: 0x2196F3
}, {
duration: 200,
easing: tween.easeIn
});
}
});
}
};
self.up = function (x, y, obj) {
tween(self, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeOut
});
};
return self;
});
var RestartButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5
});
buttonGraphics.tint = 0xFF5722;
// Create button text
var buttonText = new Text2('Yeniden Başlat', {
size: 40,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function (x, y, obj) {
// Reset all game data
storage.score = 0;
storage.pointsPerTap = 1;
storage.autoTapLevel = 0;
storage.autoTapInterval = 8000;
storage.canHold = false;
storage.upgradeCost = 20;
storage.autoCost = 100;
storage.autoLevel = 0;
storage.moneyRainActive = false;
storage.holdCost = 300;
storage.rainCost = 310;
storage.paraGozActive = false;
storage.paraGozCost = 500;
storage.paraGozLevel = 0;
storage.musicUpgradePurchased = false;
storage.paraGozLoveCount = 0;
storage.holdBonusFromLove = 0;
// Reset score to 0
LK.setScore(0);
// Show game over to trigger game reset
LK.showGameOver();
};
self.up = function (x, y, obj) {
tween(self, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeOut
});
};
return self;
});
var SaveButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5
});
buttonGraphics.tint = 0x4CAF50;
// Create button text
var buttonText = new Text2('Kaydet', {
size: 40,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function (x, y, obj) {
// Save game data
storage.score = LK.getScore();
storage.pointsPerTap = pointsPerTap;
storage.autoTapLevel = autoTapLevel;
storage.autoTapInterval = autoTapInterval;
storage.canHold = tapButton.canHold;
storage.upgradeCost = upgradeButton.cost;
storage.autoCost = autoButton.cost;
storage.autoLevel = autoButton.level;
storage.moneyRainActive = moneyRainActive;
storage.holdCost = holdButton ? holdButton.cost : 300;
storage.rainCost = rainUpgradeButton ? rainUpgradeButton.cost : 310;
storage.paraGozActive = paraGozActive;
storage.paraGozCost = paraGozUpgradeButton.cost;
storage.paraGozLevel = paraGozUpgradeButton.level;
storage.musicUpgradePurchased = musicUpgradePurchased;
// Save love system data
storage.paraGozLoveCount = paraGozCharacter ? paraGozCharacter.loveCount : 0;
storage.holdBonusFromLove = tapButton.canHold ? Math.max(0, tapButton.holdPointsPerInterval - 1) : 0;
// Visual feedback
tween(self, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
easing: tween.easeOut
});
// Flash effect
tween(buttonGraphics, {
tint: 0x00FF00
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(buttonGraphics, {
tint: 0x4CAF50
}, {
duration: 200,
easing: tween.easeIn
});
}
});
// Show save confirmation
var saveText = new Text2('Kaydedildi!', {
size: 50,
fill: 0x00FF00
});
saveText.anchor.set(0.5, 0.5);
saveText.x = self.x;
saveText.y = self.y - 100;
game.addChild(saveText);
// Animate save text
tween(saveText, {
y: saveText.y - 100,
alpha: 0
}, {
duration: 1000,
easing: tween.easeOut,
onFinish: function onFinish() {
saveText.destroy();
}
});
};
self.up = function (x, y, obj) {
tween(self, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeOut
});
};
return self;
});
var StartButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('tapButton', {
anchorX: 0.5,
anchorY: 0.5
});
// Create button text
var buttonText = new Text2('Bana Bas', {
size: 80,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
buttonText.y = -50; // Move text up by 50 pixels
self.addChild(buttonText);
self.down = function (x, y, obj) {
// Scale down animation
tween(self, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
easing: tween.easeOut
});
// Flash effect
tween(buttonGraphics, {
tint: 0xFFFFFF
}, {
duration: 150,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(buttonGraphics, {
tint: 0xFFFFFF
}, {
duration: 150,
easing: tween.easeIn
});
}
});
// Remove start button and show main game
self.destroy();
showMainGame();
};
self.up = function (x, y, obj) {
// Scale back to normal
tween(self, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeOut
});
};
return self;
});
var TapButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('tapButton', {
anchorX: 0.5,
anchorY: 0.5
});
self.originalScale = 1.0;
self.pressedScale = 0.9;
self.canHold = false;
self.isHolding = false;
self.holdTimer = 0;
self.holdInterval = 100;
self.holdPointsPerInterval = 1;
self.down = function (x, y, obj) {
// Scale down animation
tween(self, {
scaleX: self.pressedScale,
scaleY: self.pressedScale
}, {
duration: 100,
easing: tween.easeOut
});
// Flash effect
tween(buttonGraphics, {
tint: 0xFFFFFF
}, {
duration: 150,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(buttonGraphics, {
tint: 0xFFFFFF
}, {
duration: 150,
easing: tween.easeIn
});
}
});
// Play tap sound
LK.getSound('tapSound').play();
// Add points
LK.setScore(LK.getScore() + pointsPerTap);
// Update display
scoreText.setText(LK.getScore());
// Create floating text at button position
var floatingText = new FloatingText();
floatingText.init(pointsPerTap, self.x, self.y);
game.addChild(floatingText);
// Start holding if hold functionality is enabled
if (self.canHold) {
self.isHolding = true;
self.holdTimer = 0;
}
};
self.up = function (x, y, obj) {
// Scale back to normal
tween(self, {
scaleX: self.originalScale,
scaleY: self.originalScale
}, {
duration: 100,
easing: tween.easeOut
});
// Stop holding
self.isHolding = false;
};
self.update = function () {
if (self.canHold && self.isHolding) {
self.holdTimer += 16.67; // Approximately 60 FPS
if (self.holdTimer >= self.holdInterval) {
self.holdTimer = 0;
LK.setScore(LK.getScore() + self.holdPointsPerInterval);
scoreText.setText(LK.getScore());
// Create floating text at button position
var floatingText = new FloatingText();
floatingText.init(self.holdPointsPerInterval, self.x, self.y);
game.addChild(floatingText);
}
}
};
return self;
});
var UpgradeButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5
});
self.cost = 20;
self.upgrade = 1;
// Create button text
var buttonText = new Text2('+1 gelişim (20)', {
size: 40,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function (x, y, obj) {
if (LK.getScore() >= self.cost) {
// Purchase upgrade
LK.setScore(LK.getScore() - self.cost);
pointsPerTap += 1;
self.cost += 30;
buttonText.setText('+1 gelişim (' + self.cost + ')');
scoreText.setText(LK.getScore());
// Scale animation
tween(self, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
easing: tween.easeOut
});
// Flash effect
tween(buttonGraphics, {
tint: 0x00FF00
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(buttonGraphics, {
tint: 0xff9800
}, {
duration: 200,
easing: tween.easeIn
});
}
});
}
};
self.up = function (x, y, obj) {
tween(self, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeOut
});
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x808080
});
/****
* Game Code
****/
// Game state
var gameStarted = false;
// Load saved data or use defaults
var pointsPerTap = storage.pointsPerTap || 1;
var autoTapLevel = storage.autoTapLevel || 0;
var autoTapInterval = storage.autoTapInterval || 8000;
var autoTapTimer = 0;
var moneyRainActive = storage.moneyRainActive || false;
var moneyRainTimer = 0;
var moneyRainInterval = 1000; // Spawn money every 1 second
var fallingMoneyArray = [];
var paraGozActive = storage.paraGozActive || false;
var paraGozCharacter = null;
var musicUpgradePurchased = storage.musicUpgradePurchased || false;
// Load saved score
if (storage.score) {
LK.setScore(storage.score);
}
// Load love system data
var paraGozLoveCount = storage.paraGozLoveCount || 0;
var holdBonusFromLove = storage.holdBonusFromLove || 0;
// Function to show main game elements
function showMainGame() {
gameStarted = true;
// Create and position the main tap button
tapButton = new TapButton();
tapButton.x = 2048 / 2;
tapButton.y = 2732 / 2;
// Apply saved hold functionality
if (storage.canHold) {
tapButton.canHold = true;
// Apply love bonus to hold points
tapButton.holdPointsPerInterval += holdBonusFromLove;
}
game.addChild(tapButton);
// Create and position upgrade button
upgradeButton = new UpgradeButton();
upgradeButton.x = 2048 / 2;
upgradeButton.y = tapButton.y + 300;
// Apply saved upgrade cost
if (storage.upgradeCost) {
upgradeButton.cost = storage.upgradeCost;
// Update button text to show saved cost
upgradeButton.getChildAt(1).setText('+1 gelişim (' + upgradeButton.cost + ')');
}
game.addChild(upgradeButton);
// Create and position auto button
autoButton = new AutoButton();
autoButton.x = 2048 / 2;
autoButton.y = upgradeButton.y + 120;
// Apply saved auto cost and level
if (storage.autoCost) {
autoButton.cost = storage.autoCost;
// Update button text to show saved cost
autoButton.getChildAt(1).setText('Otomatik Buton (' + autoButton.cost + ')');
}
if (storage.autoLevel) {
autoButton.level = storage.autoLevel;
}
game.addChild(autoButton);
// Create and position hold button (only if not purchased)
if (!storage.canHold) {
holdButton = new HoldButton();
holdButton.x = 2048 / 2;
holdButton.y = autoButton.y + 120;
// Apply saved hold cost
if (storage.holdCost) {
holdButton.cost = storage.holdCost;
// Update button text to show saved cost
holdButton.getChildAt(1).setText('Basılı Tut (' + holdButton.cost + ')');
}
game.addChild(holdButton);
}
// Create and position rain upgrade button (only if not purchased)
if (!storage.moneyRainActive) {
rainUpgradeButton = new RainUpgradeButton();
rainUpgradeButton.x = 2048 / 2;
rainUpgradeButton.y = holdButton ? holdButton.y + 120 : autoButton.y + 120;
// Apply saved rain cost
if (storage.rainCost) {
rainUpgradeButton.cost = storage.rainCost;
// Update button text to show saved cost
rainUpgradeButton.getChildAt(1).setText('Para Yağmuru (' + rainUpgradeButton.cost + ')');
}
game.addChild(rainUpgradeButton);
}
// Create and position ParaGoz upgrade button
paraGozUpgradeButton = new ParaGozUpgradeButton();
paraGozUpgradeButton.x = 2048 / 2;
paraGozUpgradeButton.y = rainUpgradeButton ? rainUpgradeButton.y + 120 : holdButton ? holdButton.y + 120 : autoButton.y + 120;
// Apply saved ParaGoz cost and level
if (storage.paraGozCost) {
paraGozUpgradeButton.cost = storage.paraGozCost;
// Update button text to show saved cost
paraGozUpgradeButton.getChildAt(1).setText('Paragöz (' + paraGozUpgradeButton.cost + ')');
}
if (storage.paraGozLevel) {
paraGozUpgradeButton.level = storage.paraGozLevel;
}
game.addChild(paraGozUpgradeButton);
// Create and position music upgrade button (only if not purchased)
if (!musicUpgradePurchased) {
musicUpgradeButton = new MusicUpgradeButton();
musicUpgradeButton.x = 2048 / 2;
musicUpgradeButton.y = paraGozUpgradeButton.y + 120;
game.addChild(musicUpgradeButton);
}
// Create and position restart button (only if music upgrade is purchased)
if (musicUpgradePurchased) {
restartButton = new RestartButton();
restartButton.x = 2048 - 200; // Right side with 200px margin (same as save button)
restartButton.y = 2732 - 100; // Below save button with 100px margin from bottom
game.addChild(restartButton);
}
// Create ParaGoz character if previously purchased
if (paraGozActive) {
paraGozCharacter = new ParaGozCharacter();
paraGozCharacter.x = 150; // Left side
paraGozCharacter.y = 2732 - 150; // Bottom
if (storage.paraGozLevel) {
paraGozCharacter.level = storage.paraGozLevel;
paraGozCharacter.collectInterval = Math.max(1000, 5000 - (storage.paraGozLevel - 1) * 500);
}
// Apply saved love count
paraGozCharacter.loveCount = paraGozLoveCount;
game.addChild(paraGozCharacter);
}
// Create and position save button
saveButton = new SaveButton();
saveButton.x = 2048 - 200; // Right side with 200px margin
saveButton.y = 2732 - 200; // Bottom with 200px margin (moved up)
game.addChild(saveButton);
// Create score display
scoreText = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
scoreText.setText(LK.getScore());
LK.gui.top.addChild(scoreText);
// Create instruction text
instructionText = new Text2('Tap the button to earn points!', {
size: 60,
fill: 0xFFFFFF
});
instructionText.anchor.set(0.5, 0);
instructionText.y = 150;
LK.gui.top.addChild(instructionText);
}
// Declare variables for game elements
var tapButton;
var upgradeButton;
var autoButton;
var holdButton;
var rainUpgradeButton;
var paraGozUpgradeButton;
var musicUpgradeButton;
var restartButton;
var saveButton;
var scoreText;
var instructionText;
// Create start button
var startButton = new StartButton();
startButton.x = 2048 / 2;
startButton.y = 2732 / 2;
game.addChild(startButton);
game.update = function () {
// Only run main game logic if game has started
if (!gameStarted) return;
// Auto-tap logic
if (autoTapLevel > 0) {
autoTapTimer += 16.67; // Approximately 60 FPS, so ~16.67ms per frame
if (autoTapTimer >= autoTapInterval) {
autoTapTimer = 0;
// Simulate tap on main button
LK.setScore(LK.getScore() + pointsPerTap);
scoreText.setText(LK.getScore());
LK.getSound('tapSound').play();
// Visual feedback for auto-tap
tween(tapButton, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(tapButton, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeOut
});
}
});
}
}
// Money rain logic
if (moneyRainActive) {
moneyRainTimer += 16.67; // Approximately 60 FPS
if (moneyRainTimer >= moneyRainInterval) {
moneyRainTimer = 0;
// Create falling money at random X position
var fallingMoney = new FallingMoney();
fallingMoney.x = Math.random() * (2048 - 200) + 100; // Random X within screen bounds
fallingMoney.y = -50; // Start above screen
fallingMoneyArray.push(fallingMoney);
game.addChild(fallingMoney);
}
// Clean up destroyed money from array
for (var i = fallingMoneyArray.length - 1; i >= 0; i--) {
if (fallingMoneyArray[i].destroyed) {
fallingMoneyArray.splice(i, 1);
}
}
}
// Subtle pulsing animation for the button when idle
if (LK.ticks % 120 === 0 && tapButton) {
tween(tapButton, {
scaleX: 1.05,
scaleY: 1.05
}, {
duration: 600,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(tapButton, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 600,
easing: tween.easeInOut
});
}
});
}
};
A red button. In-Game asset. 2d. High contrast. No shadows
gold money. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Super Mario'daki Wario karakteri ama madenci kılığında. In-Game asset. 2d. High contrast. No shadows
pembe kalp. In-Game asset. 2d. High contrast. No shadows