User prompt
Pets butonu pets ekranında gözükmeye devam ediyor
User prompt
Pet sistemi ekle skill butonunun altına pets butonu ekle burada 5 farklı pet bulunucak oyuncu sadece 1 pet kullanabilicek bu petlerin fiyatları farklı olacak ve tıklama basına elde edilen geliri belirli oranlarda artırıcak ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
2 katına cıkıyor fakat halen tıklama gelirinin 1 olduğu yazıyor üstteki yazıda ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Tıklayınca tıklama geliri 10 saniyeliğine 2 katına cıksın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Hala aynı görev butonlarının sağ alt köşesine take butonu ekle görev bitince bu butona basılarak ödül elde edilicek
User prompt
Görev bitiyor fakat odül gelmiyor görev butonlarının sol alt köşesine take butonu ekle
User prompt
Tasks butonunda ki görevlerin odüllerjni "her görev kazanıldığında Tıklamalardan gelen gelir 15 saniyeliğine 2 katına cıkar" ile değiştir ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Ekstra olarak sonradan eklenen meyve sebzelerin isimleri hala alt kısımda duruyor
User prompt
Quantity butonu ve buy sell butonlarını kaldır
User prompt
- yi sola + yı sağa yaklaştır
User prompt
Asagı al - ve + butonunu
User prompt
Quantity butonunda bulunan - butonu ve + butonu quantity butonunun üstünde olmasın
User prompt
Back butonunu büyüt ve aşagi taşı
User prompt
Buy ve sell butonları arasına boşluk koy
User prompt
Buy ve sell butonları işlev görmüyor Özelliği kaldır ve tekrar ekle
User prompt
Tiklama başina elde edilen gelir ile ilgili bütün mekanikleri sil ve en baştan yeni bir kodlama yap her tıklama başina 1 para bu para miktarı her artırılan 1 level için 2 katına çıkıcak
User prompt
Farm kismında bulunan ekranın alt tarafına bir mekanizma ekle bu mekanizmaya göre alt tarafta tüm meyve ve sebzelerin butonları bulunucak oyuncu kaç tane satın olmak istiyorsa orada bulunan mekanizmaya kaç adet istediğini yazacak ve buy butonuna basıcak kaç adet satmak istiyorsa oradaki bölüme yazacak sell butonuna bascak
User prompt
Tiklama başina elde edilen gelir ile ilgili bütün mekanikleri sil ve en baştan yeni bir kodlama yap her tıklama başina 1 para bu para miktarı her artırılan 1 level için 2 katına çıkıcak
User prompt
Bazı tıklamalar sonrası anormal bir şekilde örnek olarak 340 tan 380 e atlıyor her tıklamayı 1 dolar olarak ayarla bu skill kullanılarak artırılabilir
User prompt
Reset game butonunu oyundan kaldır
User prompt
Cost ? Yazısını çok çok az bir miktar yukarı taşı
User prompt
Employees menüsünde +?/sec yazısını hire butonunun altına koy
User prompt
Hala onuncu tıklayışta 9 dan 30 a atlıyor
User prompt
Oyuna yeni basladıktan hemen sonra onuncu tıklayışta para miktarı 9 dan 30 a çıkıyor
User prompt
Game Paused yazısını biraz daha yukari taşı
/****
* Plugins
****/
var storage = LK.import("@upit/storage.v1");
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Employee = Container.expand(function (name, cost, income) {
var self = Container.call(this);
self.name = name;
self.cost = cost;
self.income = income;
self.hired = false;
self.hiredCount = 0;
self.maxCount = 5;
// Initialize count for this employee type if not exists
if (!employeeTypeCounts[name]) {
employeeTypeCounts[name] = 0;
}
var nameText = new Text2(name, {
size: 90,
fill: 0x000000
});
nameText.anchor.set(0.5, 0.5);
nameText.x = 0;
nameText.y = -40;
self.addChild(nameText);
var incomeText = new Text2('+$' + income + '/sec', {
size: 80,
fill: 0x4CAF50
});
incomeText.anchor.set(0.5, 0.5);
incomeText.x = 0;
incomeText.y = 160;
self.addChild(incomeText);
var costText = new Text2('Cost: $' + cost, {
size: 80,
fill: 0x666666
});
costText.anchor.set(0.5, 0.5);
costText.x = 0;
costText.y = 35;
self.addChild(costText);
self.hireBtn = self.attachAsset('hireButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 100
});
self.statusText = new Text2('HIRE (0/' + self.maxCount + ')', {
size: 80,
fill: 0xFFFFFF
});
self.statusText.anchor.set(0.5, 0.5);
self.statusText.x = 0;
self.statusText.y = 100;
self.addChild(self.statusText);
self.hireBtn.down = function (x, y, obj) {
if (employeeTypeCounts[self.name] < self.maxCount && money >= self.cost) {
money -= self.cost;
employeeTypeCounts[self.name]++;
self.hiredCount = employeeTypeCounts[self.name];
passiveIncome += self.income;
totalEmployeesHired++;
self.statusText.setText('HIRED (' + self.hiredCount + '/' + self.maxCount + ')');
if (employeeTypeCounts[self.name] >= self.maxCount) {
self.hireBtn.tint = 0x888888;
}
updateMoneyDisplay();
LK.getSound('purchase').play();
}
};
return self;
});
var FarmItem = Container.expand(function (name, buyPrice, sellPrice, color) {
var self = Container.call(this);
self.name = name;
self.buyPrice = buyPrice;
self.sellPrice = sellPrice;
self.quantity = 0;
var icon = self.attachAsset('itemIcon', {
anchorX: 0.5,
anchorY: 0.5
});
icon.tint = color;
var nameText = new Text2(name, {
size: 90,
fill: 0x000000
});
nameText.anchor.set(0.5, 0.5);
nameText.x = 0;
nameText.y = 100;
self.addChild(nameText);
self.quantityText = new Text2('Own: 0', {
size: 80,
fill: 0x333333
});
self.quantityText.anchor.set(0.5, 0.5);
self.quantityText.x = 0;
self.quantityText.y = 200;
self.addChild(self.quantityText);
var buyBtn = self.attachAsset('buyButton', {
anchorX: 0.5,
anchorY: 0.5,
x: -100,
y: 270
});
var sellBtn = self.attachAsset('sellButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 100,
y: 270
});
var buyText = new Text2('BUY', {
size: 80,
fill: 0xFFFFFF
});
buyText.anchor.set(0.5, 0.5);
buyText.x = -100;
buyText.y = 270;
self.addChild(buyText);
var sellText = new Text2('SELL', {
size: 80,
fill: 0xFFFFFF
});
sellText.anchor.set(0.5, 0.5);
sellText.x = 100;
sellText.y = 270;
self.addChild(sellText);
buyBtn.down = function (x, y, obj) {
if (money >= self.buyPrice) {
money -= self.buyPrice;
self.quantity++;
totalItemsBought++;
self.quantityText.setText('Own: ' + self.quantity);
updateMoneyDisplay();
LK.getSound('purchase').play();
}
};
sellBtn.down = function (x, y, obj) {
if (self.quantity > 0) {
money += self.sellPrice;
self.quantity--;
self.quantityText.setText('Own: ' + self.quantity);
updateMoneyDisplay();
LK.getSound('purchase').play();
}
};
return self;
});
var Pet = Container.expand(function (name, cost, multiplier, color) {
var self = Container.call(this);
self.name = name;
self.cost = cost;
self.multiplier = multiplier; // Click earning multiplier (e.g., 1.5 = 50% increase)
self.owned = false;
var petSlot = self.attachAsset('petSlot', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0
});
var petIcon = self.attachAsset('petIcon', {
anchorX: 0.5,
anchorY: 0.5,
x: -200,
y: 0,
scaleX: 0.8,
scaleY: 0.8
});
petIcon.tint = color;
var nameText = new Text2(name, {
size: 70,
fill: 0x000000
});
nameText.anchor.set(0.5, 0.5);
nameText.x = -50;
nameText.y = -20;
self.addChild(nameText);
var multiplierText = new Text2('+' + Math.round((multiplier - 1) * 100) + '% click', {
size: 55,
fill: 0x4CAF50
});
multiplierText.anchor.set(0.5, 0.5);
multiplierText.x = -50;
multiplierText.y = 20;
self.addChild(multiplierText);
self.costText = new Text2('$' + cost, {
size: 60,
fill: 0xff5722
});
self.costText.anchor.set(0.5, 0.5);
self.costText.x = 150;
self.costText.y = 0;
self.addChild(self.costText);
petSlot.down = function (x, y, obj) {
if (!self.owned && money >= self.cost) {
// Deactivate current pet if any
if (activePet) {
activePet.owned = false;
activePet.costText.setText('$' + activePet.cost);
activePet.costText.tint = 0xff5722;
}
// Activate this pet
money -= self.cost;
self.owned = true;
activePet = self;
self.costText.setText('ACTIVE');
self.costText.tint = 0x4CAF50;
updateMoneyDisplay();
LK.getSound('purchase').play();
}
};
return self;
});
var Task = Container.expand(function (title, description, target, reward, type) {
var self = Container.call(this);
self.title = title;
self.description = description;
self.target = target;
self.reward = reward;
self.type = type; // 'money', 'clicks', 'items', 'employees'
self.progress = 0;
self.completed = false;
// Task background - 3x larger
var taskBg = self.attachAsset('taskButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0
});
var titleText = new Text2(title, {
size: 150,
fill: 0x000000
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 0;
titleText.y = -120;
self.addChild(titleText);
var descText = new Text2(description, {
size: 105,
fill: 0x333333
});
descText.anchor.set(0.5, 0.5);
descText.x = 0;
descText.y = -30;
self.addChild(descText);
self.progressText = new Text2('0/' + target, {
size: 120,
fill: 0x666666
});
self.progressText.anchor.set(0.5, 0.5);
self.progressText.x = 0;
self.progressText.y = 60;
self.addChild(self.progressText);
var rewardText = new Text2('Reward: $' + reward, {
size: 105,
fill: 0x4CAF50
});
rewardText.anchor.set(0.5, 0.5);
rewardText.x = 0;
rewardText.y = 150;
self.addChild(rewardText);
self.updateProgress = function (newProgress) {
self.progress = Math.min(newProgress, self.target);
self.progressText.setText(self.progress + '/' + self.target);
if (self.progress >= self.target && !self.completed) {
self.completed = true;
money += self.reward;
updateMoneyDisplay();
taskBg.tint = 0x4CAF50;
titleText.setText(title + ' - COMPLETED!');
LK.getSound('purchase').play();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xE8F5E8
});
/****
* Game Code
****/
var money = storage.money || 0;
var passiveIncome = storage.passiveIncome || 0;
var musicEnabled = storage.musicEnabled !== undefined ? storage.musicEnabled : true; // Default music enabled
var currentScreen = 'menu'; // Start with menu screen
var gameStarted = false;
// Start menu music if music is enabled
if (musicEnabled) {
LK.playMusic('menuMusic');
}
var farmItems = [];
var employees = [];
var totalClicks = 0;
var totalMoneyEarned = 0;
var totalItemsBought = 0;
var totalEmployeesHired = 0;
var employeeTypeCounts = {}; // Track count for each employee type
var timingBonusButton = null;
var gameStartTime = 0;
var timingBonusTimes = [60000, 180000, 600000, 1800000]; // 1min, 3min, 10min, 30min in milliseconds
var timingBonusActive = false;
var timingBonusIndex = 0;
// Skill system variables - click earning doubles with each level
var skillUpgradeCost = 100; // Starting cost for skill upgrade
var skillLevel = 1; // Current skill level
// Pet system variables
var pets = [];
var activePet = null;
// Calculate click earning based on skill level and active pet (starts at $1, doubles each level)
function getClickEarning() {
var baseEarning = Math.pow(2, skillLevel - 1); // Level 1 = $1, Level 2 = $2, Level 3 = $4, etc.
if (activePet) {
return Math.floor(baseEarning * activePet.multiplier);
}
return baseEarning;
}
// Timing bonus screen container
var timingBonusContainer = new Container();
timingBonusContainer.visible = false;
game.addChild(timingBonusContainer);
// Pause menu container
var pauseMenuContainer = new Container();
pauseMenuContainer.visible = false;
game.addChild(pauseMenuContainer);
// Pause menu background
var pauseMenuBg = pauseMenuContainer.attachAsset('pauseMenuBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
});
// Pause menu title
var pauseMenuTitle = new Text2('GAME PAUSED', {
size: 80,
fill: 0xFFFFFF
});
pauseMenuTitle.anchor.set(0.5, 0.5);
pauseMenuTitle.x = 1024;
pauseMenuTitle.y = 1000;
pauseMenuContainer.addChild(pauseMenuTitle);
// Back to Game button in pause menu
var pauseBackToGameBtn = pauseMenuContainer.attachAsset('menuItemButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1200
});
var pauseBackToGameText = new Text2('BACK TO GAME', {
size: 60,
fill: 0xFFFFFF
});
pauseBackToGameText.anchor.set(0.5, 0.5);
pauseBackToGameText.x = 1024;
pauseBackToGameText.y = 1200;
pauseMenuContainer.addChild(pauseBackToGameText);
// Music toggle button in pause menu
var pauseMusicToggleBtn = pauseMenuContainer.attachAsset('menuItemButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1350
});
var pauseMusicToggleText = new Text2(musicEnabled ? 'MUSIC: ON' : 'MUSIC: OFF', {
size: 60,
fill: 0xFFFFFF
});
pauseMusicToggleText.anchor.set(0.5, 0.5);
pauseMusicToggleText.x = 1024;
pauseMusicToggleText.y = 1350;
pauseMenuContainer.addChild(pauseMusicToggleText);
// Main menu button in pause menu
var pauseMainMenuBtn = pauseMenuContainer.attachAsset('menuItemButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1500
});
var pauseMainMenuText = new Text2('MAIN MENU', {
size: 60,
fill: 0xFFFFFF
});
pauseMainMenuText.anchor.set(0.5, 0.5);
pauseMainMenuText.x = 1024;
pauseMainMenuText.y = 1500;
pauseMenuContainer.addChild(pauseMainMenuText);
// Pause button (bottom left corner)
var pauseButton = game.addChild(LK.getAsset('pauseButton', {
anchorX: 0,
anchorY: 1,
x: 20,
y: 2712
}));
pauseButton.visible = false; // Hide initially
var pauseButtonText = new Text2('| |', {
size: 60,
fill: 0xFFFFFF
});
pauseButtonText.anchor.set(0.5, 0.5);
pauseButtonText.x = 80;
pauseButtonText.y = 2652;
pauseButtonText.visible = false; // Hide initially
game.addChild(pauseButtonText);
// Track if timing bonus has been claimed
var timingBonusClaimed = false;
function updateMoneyDisplay() {
// Cap money at 250 million
if (money > 250000000) {
money = 250000000;
}
if (money >= 250000000) {
moneyText.setText('$' + money + ' Max.');
} else {
moneyText.setText('$' + money);
}
storage.money = money;
storage.passiveIncome = passiveIncome;
}
// Main Menu Elements
var menuContainer = new Container();
game.addChild(menuContainer);
// Game title - normal text
var gameTitle = new Text2('FARMING TIME!', {
size: 120,
fill: 0x2E7D32
});
gameTitle.anchor.set(0.5, 0.5);
gameTitle.x = 1024;
gameTitle.y = 600;
menuContainer.addChild(gameTitle);
// Start button
var startBtn = menuContainer.addChild(LK.getAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1200
}));
var startBtnText = new Text2('START', {
size: 85,
fill: 0xFFFFFF
});
startBtnText.anchor.set(0.5, 0.5);
startBtnText.x = 1024;
startBtnText.y = 1200;
menuContainer.addChild(startBtnText);
// Options button
var optionsBtn = menuContainer.addChild(LK.getAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1350
}));
var optionsBtnText = new Text2('OPTIONS', {
size: 85,
fill: 0xFFFFFF
});
optionsBtnText.anchor.set(0.5, 0.5);
optionsBtnText.x = 1024;
optionsBtnText.y = 1350;
menuContainer.addChild(optionsBtnText);
// How to Play button
var howToPlayBtn = menuContainer.addChild(LK.getAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1500
}));
var howToPlayBtnText = new Text2('HOW TO PLAY', {
size: 85,
fill: 0xFFFFFF
});
howToPlayBtnText.anchor.set(0.5, 0.5);
howToPlayBtnText.x = 1024;
howToPlayBtnText.y = 1500;
menuContainer.addChild(howToPlayBtnText);
// Made by text in bottom left
var madeByText = new Text2('Made By MAVUS DONDURMA', {
size: 100,
fill: 0x2E7D32
});
madeByText.anchor.set(0, 1);
madeByText.x = 50;
madeByText.y = 2650;
menuContainer.addChild(madeByText);
// Version text below made by text
var versionText = new Text2('version 1.0', {
size: 90,
fill: 0x666666
});
versionText.anchor.set(0, 1);
versionText.x = 50;
versionText.y = 2750;
menuContainer.addChild(versionText);
// Main screen elements
var tomato = game.addChild(LK.getAsset('tomato', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1200
}));
tomato.visible = false; // Hide initially
var moneyText = new Text2('$' + money, {
size: 80,
fill: 0x2E7D32
});
moneyText.anchor.set(1, 0);
moneyText.visible = false; // Hide initially
LK.gui.topRight.addChild(moneyText);
var passiveText = new Text2('+$' + passiveIncome + '/sec', {
size: 50,
fill: 0x4CAF50
});
passiveText.anchor.set(1, 0);
passiveText.y = 100;
passiveText.visible = false; // Hide initially
LK.gui.topRight.addChild(passiveText);
// Chronometer display
var chronometerText = new Text2('00:00', {
size: 60,
fill: 0x2E7D32
});
chronometerText.anchor.set(0.5, 0);
chronometerText.x = 0;
chronometerText.y = 0;
chronometerText.visible = false; // Hide initially
LK.gui.top.addChild(chronometerText);
// Money per click display
var clickEarningText = new Text2('+$' + getClickEarning() + ' per click', {
size: 50,
fill: 0x4CAF50
});
clickEarningText.anchor.set(0.5, 0);
clickEarningText.x = 0;
clickEarningText.y = 80;
clickEarningText.visible = false; // Hide initially
LK.gui.top.addChild(clickEarningText);
var farmBtn = game.addChild(LK.getAsset('farmButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1750
}));
farmBtn.visible = false; // Hide initially
var farmBtnText = new Text2('FARM', {
size: 100,
fill: 0xFFFFFF
});
farmBtnText.anchor.set(0.5, 0.5);
farmBtnText.x = 1024;
farmBtnText.y = 1750;
farmBtnText.visible = false; // Hide initially
game.addChild(farmBtnText);
var employeeBtn = game.addChild(LK.getAsset('employeeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1950
}));
employeeBtn.visible = false; // Hide initially
var employeeBtnText = new Text2('EMPLOYEES', {
size: 100,
fill: 0xFFFFFF
});
employeeBtnText.anchor.set(0.5, 0.5);
employeeBtnText.x = 1024;
employeeBtnText.y = 1950;
employeeBtnText.visible = false; // Hide initially
game.addChild(employeeBtnText);
var tasksBtn = game.addChild(LK.getAsset('tasksButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 2150
}));
tasksBtn.visible = false; // Hide initially
var tasksBtnText = new Text2('TASKS', {
size: 100,
fill: 0xFFFFFF
});
tasksBtnText.anchor.set(0.5, 0.5);
tasksBtnText.x = 1024;
tasksBtnText.y = 2150;
tasksBtnText.visible = false; // Hide initially
game.addChild(tasksBtnText);
// Timing bonus button (appears at specific times in top-left)
timingBonusButton = game.addChild(LK.getAsset('timingBonus', {
anchorX: 0,
anchorY: 0,
x: 150,
y: 150
}));
timingBonusButton.visible = false; // Hide initially
var timingBonusText = new Text2('1M$!', {
size: 90,
fill: 0x000000
});
timingBonusText.anchor.set(0.5, 0.5);
timingBonusText.x = 250;
timingBonusText.y = 200;
timingBonusText.visible = false; // Hide initially
game.addChild(timingBonusText);
// Skill button
var skillBtn = game.addChild(LK.getAsset('skillButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 2350
}));
skillBtn.visible = false; // Hide initially
var skillBtnText = new Text2('SKILL LV.' + skillLevel, {
size: 65,
fill: 0xFFFFFF
});
skillBtnText.anchor.set(0.5, 0.5);
skillBtnText.x = 1024;
skillBtnText.y = 2350;
skillBtnText.visible = false; // Hide initially
game.addChild(skillBtnText);
// Skill level display text
var skillLevelText = new Text2('$' + skillUpgradeCost, {
size: 55,
fill: 0x333333
});
skillLevelText.anchor.set(0, 0.5);
skillLevelText.x = 1400;
skillLevelText.y = 2350;
skillLevelText.visible = false; // Hide initially
game.addChild(skillLevelText);
// Pets button
var petsBtn = game.addChild(LK.getAsset('petButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 2550
}));
petsBtn.visible = false; // Hide initially
var petsBtnText = new Text2('PETS', {
size: 100,
fill: 0xFFFFFF
});
petsBtnText.anchor.set(0.5, 0.5);
petsBtnText.x = 1024;
petsBtnText.y = 2550;
petsBtnText.visible = false; // Hide initially
game.addChild(petsBtnText);
// Farm screen elements
var farmContainer = new Container();
farmContainer.visible = false;
game.addChild(farmContainer);
var farmTitle = new Text2('FARM MARKET', {
size: 70,
fill: 0x2E7D32
});
farmTitle.anchor.set(0.5, 0.5);
farmTitle.x = 1024;
farmTitle.y = 200;
farmContainer.addChild(farmTitle);
// Create farm items
var apple = new FarmItem('Apple', 5, 8, 0xff0000);
apple.x = 400;
apple.y = 500;
farmContainer.addChild(apple);
farmItems.push(apple);
var banana = new FarmItem('Banana', 3, 5, 0xffff00);
banana.x = 1024;
banana.y = 500;
farmContainer.addChild(banana);
farmItems.push(banana);
var carrot = new FarmItem('Carrot', 7, 12, 0xff8800);
carrot.x = 1648;
carrot.y = 500;
farmContainer.addChild(carrot);
farmItems.push(carrot);
var lettuce = new FarmItem('Lettuce', 4, 7, 0x00ff00);
lettuce.x = 400;
lettuce.y = 900;
farmContainer.addChild(lettuce);
farmItems.push(lettuce);
var potato = new FarmItem('Potato', 6, 10, 0x8b4513);
potato.x = 1024;
potato.y = 900;
farmContainer.addChild(potato);
farmItems.push(potato);
var corn = new FarmItem('Corn', 8, 15, 0xffd700);
corn.x = 1648;
corn.y = 900;
farmContainer.addChild(corn);
farmItems.push(corn);
// Price list button in farm screen
var farmPriceListBtn = farmContainer.addChild(LK.getAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1300
}));
var farmPriceListBtnText = new Text2('PRICE LIST', {
size: 60,
fill: 0xFFFFFF
});
farmPriceListBtnText.anchor.set(0.5, 0.5);
farmPriceListBtnText.x = 1024;
farmPriceListBtnText.y = 1300;
farmContainer.addChild(farmPriceListBtnText);
// Bulk trading mechanism at bottom of farm screen
var bulkTradingContainer = new Container();
bulkTradingContainer.y = 1450;
farmContainer.addChild(bulkTradingContainer);
// Item buttons row
var itemButtonsContainer = new Container();
itemButtonsContainer.y = 0;
bulkTradingContainer.addChild(itemButtonsContainer);
// Bulk trading section cleaned up - no item names displayed
var farmBackBtn = farmContainer.addChild(LK.getAsset('backButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1900,
scaleX: 1.5,
scaleY: 1.5
}));
var farmBackText = new Text2('BACK', {
size: 90,
fill: 0xFFFFFF
});
farmBackText.anchor.set(0.5, 0.5);
farmBackText.x = 1024;
farmBackText.y = 1900;
farmContainer.addChild(farmBackText);
// Pets screen elements
var petsContainer = new Container();
petsContainer.visible = false;
game.addChild(petsContainer);
var petsTitle = new Text2('PET COMPANIONS', {
size: 70,
fill: 0x2E7D32
});
petsTitle.anchor.set(0.5, 0.5);
petsTitle.x = 1024;
petsTitle.y = 200;
petsContainer.addChild(petsTitle);
var petsSubtitle = new Text2('Choose one pet to boost your clicks!', {
size: 50,
fill: 0x666666
});
petsSubtitle.anchor.set(0.5, 0.5);
petsSubtitle.x = 1024;
petsSubtitle.y = 280;
petsContainer.addChild(petsSubtitle);
// Create pets
var bunny = new Pet('Lucky Bunny', 100, 1.2, 0xffc0cb);
bunny.x = 1024;
bunny.y = 450;
petsContainer.addChild(bunny);
pets.push(bunny);
var cat = new Pet('Magic Cat', 500, 1.5, 0x9c27b0);
cat.x = 1024;
cat.y = 600;
petsContainer.addChild(cat);
pets.push(cat);
var dragon = new Pet('Mini Dragon', 2000, 2.0, 0xf44336);
dragon.x = 1024;
dragon.y = 750;
petsContainer.addChild(dragon);
pets.push(dragon);
var phoenix = new Pet('Fire Phoenix', 10000, 3.0, 0xff9800);
phoenix.x = 1024;
phoenix.y = 900;
petsContainer.addChild(phoenix);
pets.push(phoenix);
var unicorn = new Pet('Golden Unicorn', 50000, 5.0, 0xffd700);
unicorn.x = 1024;
unicorn.y = 1050;
petsContainer.addChild(unicorn);
pets.push(unicorn);
var petsBackBtn = petsContainer.addChild(LK.getAsset('backButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1300
}));
var petsBackText = new Text2('BACK', {
size: 60,
fill: 0xFFFFFF
});
petsBackText.anchor.set(0.5, 0.5);
petsBackText.x = 1024;
petsBackText.y = 1300;
petsContainer.addChild(petsBackText);
// Employee screen elements
var employeeContainer = new Container();
employeeContainer.visible = false;
game.addChild(employeeContainer);
var employeeTitle = new Text2('HIRE EMPLOYEES', {
size: 70,
fill: 0x2E7D32
});
employeeTitle.anchor.set(0.5, 0.5);
employeeTitle.x = 1024;
employeeTitle.y = 200;
employeeContainer.addChild(employeeTitle);
// Create employees
var farmWorker = new Employee('Farm Worker', 50, 1);
farmWorker.x = 512;
farmWorker.y = 500;
employeeContainer.addChild(farmWorker);
employees.push(farmWorker);
var supervisor = new Employee('Supervisor', 200, 5);
supervisor.x = 1536;
supervisor.y = 500;
employeeContainer.addChild(supervisor);
employees.push(supervisor);
var manager = new Employee('Manager', 1000, 25);
manager.x = 512;
manager.y = 800;
employeeContainer.addChild(manager);
employees.push(manager);
var ceo = new Employee('CEO', 5000, 100);
ceo.x = 1536;
ceo.y = 800;
employeeContainer.addChild(ceo);
employees.push(ceo);
var employeeBackBtn = employeeContainer.addChild(LK.getAsset('backButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1200
}));
var employeeBackText = new Text2('BACK', {
size: 60,
fill: 0xFFFFFF
});
employeeBackText.anchor.set(0.5, 0.5);
employeeBackText.x = 1024;
employeeBackText.y = 1200;
employeeContainer.addChild(employeeBackText);
// Tasks screen elements
var tasksContainer = new Container();
tasksContainer.visible = false;
game.addChild(tasksContainer);
var tasksTitle = new Text2('TASKS & MISSIONS', {
size: 70,
fill: 0x2E7D32
});
tasksTitle.anchor.set(0.5, 0.5);
tasksTitle.x = 1024;
tasksTitle.y = 200;
tasksContainer.addChild(tasksTitle);
// Create tasks
var tasks = [];
var clickTask = new Task('First Clicks', 'Click tomato 10 times', 10, 20, 'clicks');
clickTask.x = 1024;
clickTask.y = 450;
tasksContainer.addChild(clickTask);
tasks.push(clickTask);
var moneyTask = new Task('Money Maker', 'Earn $100 total', 100, 50, 'money');
moneyTask.x = 1024;
moneyTask.y = 850;
tasksContainer.addChild(moneyTask);
tasks.push(moneyTask);
var farmTask = new Task('Farmer', 'Buy 5 items from farm', 5, 100, 'items');
farmTask.x = 1024;
farmTask.y = 1250;
tasksContainer.addChild(farmTask);
tasks.push(farmTask);
var employeeTask = new Task('Boss', 'Hire your first employee', 1, 150, 'employees');
employeeTask.x = 1024;
employeeTask.y = 1650;
tasksContainer.addChild(employeeTask);
tasks.push(employeeTask);
var bigMoneyTask = new Task('Rich', 'Earn $1000 total', 1000, 500, 'money');
bigMoneyTask.x = 1024;
bigMoneyTask.y = 2050;
tasksContainer.addChild(bigMoneyTask);
tasks.push(bigMoneyTask);
var tasksBackBtn = tasksContainer.addChild(LK.getAsset('backButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 2450
}));
var tasksBackText = new Text2('BACK', {
size: 60,
fill: 0xFFFFFF
});
tasksBackText.anchor.set(0.5, 0.5);
tasksBackText.x = 1024;
tasksBackText.y = 2450;
tasksContainer.addChild(tasksBackText);
// How to Play screen elements
var howToPlayContainer = new Container();
howToPlayContainer.visible = false;
game.addChild(howToPlayContainer);
var howToPlayTitle = new Text2('HOW TO PLAY', {
size: 70,
fill: 0x2E7D32
});
howToPlayTitle.anchor.set(0.5, 0.5);
howToPlayTitle.x = 1024;
howToPlayTitle.y = 300;
howToPlayContainer.addChild(howToPlayTitle);
var instruction1 = new Text2('🍅 Click the tomato to earn money', {
size: 55,
fill: 0x333333
});
instruction1.anchor.set(0.5, 0.5);
instruction1.x = 1024;
instruction1.y = 500;
howToPlayContainer.addChild(instruction1);
var instruction2 = new Text2('🛒 Use FARM to buy and sell fruits/vegetables', {
size: 55,
fill: 0x333333
});
instruction2.anchor.set(0.5, 0.5);
instruction2.x = 1024;
instruction2.y = 600;
howToPlayContainer.addChild(instruction2);
var instruction3 = new Text2('👥 Hire EMPLOYEES for passive income', {
size: 55,
fill: 0x333333
});
instruction3.anchor.set(0.5, 0.5);
instruction3.x = 1024;
instruction3.y = 700;
howToPlayContainer.addChild(instruction3);
var instruction4 = new Text2('📋 Complete TASKS for bonus rewards', {
size: 55,
fill: 0x333333
});
instruction4.anchor.set(0.5, 0.5);
instruction4.x = 1024;
instruction4.y = 800;
howToPlayContainer.addChild(instruction4);
var instruction5 = new Text2('💰 Farm requires $10, Employees require $25', {
size: 50,
fill: 0x666666
});
instruction5.anchor.set(0.5, 0.5);
instruction5.x = 1024;
instruction5.y = 950;
howToPlayContainer.addChild(instruction5);
var instruction6 = new Text2('🎯 Goal: Build your farming empire!', {
size: 55,
fill: 0x4CAF50
});
instruction6.anchor.set(0.5, 0.5);
instruction6.x = 1024;
instruction6.y = 1100;
howToPlayContainer.addChild(instruction6);
// Price List button removed from How to Play screen
// How to Play back button
var howToPlayBackBtn = howToPlayContainer.addChild(LK.getAsset('backButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1350
}));
var howToPlayBackText = new Text2('BACK', {
size: 60,
fill: 0xFFFFFF
});
howToPlayBackText.anchor.set(0.5, 0.5);
howToPlayBackText.x = 1024;
howToPlayBackText.y = 1350;
howToPlayContainer.addChild(howToPlayBackText);
// Price List screen elements
var priceListContainer = new Container();
priceListContainer.visible = false;
game.addChild(priceListContainer);
var priceListTitle = new Text2('PRICE LIST - FRUITS & VEGETABLES', {
size: 80,
fill: 0x2E7D32
});
priceListTitle.anchor.set(0.5, 0.5);
priceListTitle.x = 1024;
priceListTitle.y = 250;
priceListContainer.addChild(priceListTitle);
// Fruits section header
var fruitsHeader = new Text2('FRUITS', {
size: 70,
fill: 0xff6b6b
});
fruitsHeader.anchor.set(0.5, 0.5);
fruitsHeader.x = 512;
fruitsHeader.y = 400;
priceListContainer.addChild(fruitsHeader);
// Vegetables section header
var vegetablesHeader = new Text2('VEGETABLES', {
size: 70,
fill: 0x4ecdc4
});
vegetablesHeader.anchor.set(0.5, 0.5);
vegetablesHeader.x = 1536;
vegetablesHeader.y = 400;
priceListContainer.addChild(vegetablesHeader);
// Apple price info
var applePrice = new Text2('Apple\nBuy: $5 Sell: $8\nProfit: $3', {
size: 60,
fill: 0x333333
});
applePrice.anchor.set(0.5, 0.5);
applePrice.x = 512;
applePrice.y = 550;
priceListContainer.addChild(applePrice);
// Banana price info
var bananaPrice = new Text2('Banana\nBuy: $3 Sell: $5\nProfit: $2', {
size: 60,
fill: 0x333333
});
bananaPrice.anchor.set(0.5, 0.5);
bananaPrice.x = 512;
bananaPrice.y = 750;
priceListContainer.addChild(bananaPrice);
// Carrot price info
var carrotPrice = new Text2('Carrot\nBuy: $7 Sell: $12\nProfit: $5', {
size: 60,
fill: 0x333333
});
carrotPrice.anchor.set(0.5, 0.5);
carrotPrice.x = 1536;
carrotPrice.y = 550;
priceListContainer.addChild(carrotPrice);
// Lettuce price info
var lettucePrice = new Text2('Lettuce\nBuy: $4 Sell: $7\nProfit: $3', {
size: 60,
fill: 0x333333
});
lettucePrice.anchor.set(0.5, 0.5);
lettucePrice.x = 1536;
lettucePrice.y = 750;
priceListContainer.addChild(lettucePrice);
// Potato price info
var potatoPrice = new Text2('Potato\nBuy: $6 Sell: $10\nProfit: $4', {
size: 60,
fill: 0x333333
});
potatoPrice.anchor.set(0.5, 0.5);
potatoPrice.x = 512;
potatoPrice.y = 950;
priceListContainer.addChild(potatoPrice);
// Corn price info
var cornPrice = new Text2('Corn\nBuy: $8 Sell: $15\nProfit: $7', {
size: 60,
fill: 0x333333
});
cornPrice.anchor.set(0.5, 0.5);
cornPrice.x = 1536;
cornPrice.y = 950;
priceListContainer.addChild(cornPrice);
// Best profit tip
var profitTip = new Text2('TIP: Corn has the highest profit margin!', {
size: 65,
fill: 0x4CAF50
});
profitTip.anchor.set(0.5, 0.5);
profitTip.x = 1024;
profitTip.y = 1150;
priceListContainer.addChild(profitTip);
// Price List back button
var priceListBackBtn = priceListContainer.addChild(LK.getAsset('backButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1350
}));
var priceListBackText = new Text2('BACK', {
size: 60,
fill: 0xFFFFFF
});
priceListBackText.anchor.set(0.5, 0.5);
priceListBackText.x = 1024;
priceListBackText.y = 1350;
priceListContainer.addChild(priceListBackText);
// Options screen elements
var optionsContainer = new Container();
optionsContainer.visible = false;
game.addChild(optionsContainer);
var optionsTitle = new Text2('OPTIONS', {
size: 70,
fill: 0x2E7D32
});
optionsTitle.anchor.set(0.5, 0.5);
optionsTitle.x = 1024;
optionsTitle.y = 400;
optionsContainer.addChild(optionsTitle);
// Music toggle button
var musicToggleBtn = optionsContainer.addChild(LK.getAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 800
}));
var musicToggleText = new Text2(musicEnabled ? 'MUSIC: ON' : 'MUSIC: OFF', {
size: 60,
fill: 0xFFFFFF
});
musicToggleText.anchor.set(0.5, 0.5);
musicToggleText.x = 1024;
musicToggleText.y = 800;
optionsContainer.addChild(musicToggleText);
// Options back button
var optionsBackBtn = optionsContainer.addChild(LK.getAsset('backButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1200
}));
var optionsBackText = new Text2('BACK', {
size: 60,
fill: 0xFFFFFF
});
optionsBackText.anchor.set(0.5, 0.5);
optionsBackText.x = 1024;
optionsBackText.y = 1200;
optionsContainer.addChild(optionsBackText);
// Menu Event handlers
startBtn.down = function (x, y, obj) {
currentScreen = 'main';
gameStarted = true;
gameStartTime = Date.now(); // Initialize game start time
timingBonusIndex = 0; // Reset timing bonus index
timingBonusClaimed = false; // Reset timing bonus claimed flag
menuContainer.visible = false;
tomato.visible = true;
farmBtn.visible = true;
farmBtnText.visible = true;
employeeBtn.visible = true;
employeeBtnText.visible = true;
tasksBtn.visible = true;
tasksBtnText.visible = true;
skillBtn.visible = true;
skillBtnText.visible = true;
skillLevelText.visible = true;
petsBtn.visible = true;
petsBtnText.visible = true;
pauseButton.visible = true;
pauseButtonText.visible = true;
// Show UI elements only in main game screen
moneyText.visible = true;
passiveText.visible = true;
chronometerText.visible = true;
clickEarningText.visible = true;
if (musicEnabled) {
LK.playMusic('gameMusic');
}
LK.getSound('click').play();
};
optionsBtn.down = function (x, y, obj) {
currentScreen = 'options';
menuContainer.visible = false;
optionsContainer.visible = true;
LK.getSound('click').play();
};
howToPlayBtn.down = function (x, y, obj) {
currentScreen = 'howtoplay';
menuContainer.visible = false;
howToPlayContainer.visible = true;
LK.getSound('click').play();
};
// Options screen event handlers
musicToggleBtn.down = function (x, y, obj) {
musicEnabled = !musicEnabled;
musicToggleText.setText(musicEnabled ? 'MUSIC: ON' : 'MUSIC: OFF');
storage.musicEnabled = musicEnabled;
if (musicEnabled) {
// Start appropriate music based on current screen
if (currentScreen === 'menu' || currentScreen === 'options') {
LK.playMusic('menuMusic');
} else {
LK.playMusic('gameMusic');
}
} else {
LK.stopMusic();
}
LK.getSound('click').play();
};
// Price List button event handler removed
// Farm Price List button event handler
farmPriceListBtn.down = function (x, y, obj) {
priceListPreviousScreen = 'farm';
currentScreen = 'pricelist';
farmContainer.visible = false;
priceListContainer.visible = true;
LK.getSound('click').play();
};
// Variable to track where we came from when entering price list
var priceListPreviousScreen = 'howtoplay';
// Price List back button event handler
priceListBackBtn.down = function (x, y, obj) {
if (currentScreen === 'pricelist') {
if (priceListPreviousScreen === 'farm') {
currentScreen = 'farm';
priceListContainer.visible = false;
farmContainer.visible = true;
} else {
currentScreen = 'howtoplay';
priceListContainer.visible = false;
howToPlayContainer.visible = true;
}
LK.getSound('click').play();
} //{6b}
};
howToPlayBackBtn.down = function (x, y, obj) {
currentScreen = 'menu';
howToPlayContainer.visible = false;
menuContainer.visible = true;
if (musicEnabled) {
LK.playMusic('menuMusic');
}
LK.getSound('click').play();
};
optionsBackBtn.down = function (x, y, obj) {
currentScreen = 'menu';
optionsContainer.visible = false;
menuContainer.visible = true;
if (musicEnabled) {
LK.playMusic('menuMusic');
}
LK.getSound('click').play();
};
// Event handlers
tomato.down = function (x, y, obj) {
// Get current click earning based on skill level
var earnAmount = getClickEarning();
// Check if adding click earning would exceed 250 million limit
if (money + earnAmount <= 250000000) {
money += earnAmount;
totalClicks++;
totalMoneyEarned += earnAmount;
} else {
// Only add the amount that would reach exactly 250 million
var remainingAmount = 250000000 - money;
if (remainingAmount > 0) {
money += remainingAmount;
totalClicks++;
totalMoneyEarned += remainingAmount;
}
}
updateMoneyDisplay();
LK.getSound('click').play();
// Create and display money earned text
var moneyEarnedText = new Text2('+$' + earnAmount, {
size: 80,
fill: 0x4CAF50
});
moneyEarnedText.anchor.set(0.5, 0.5);
moneyEarnedText.x = tomato.x;
moneyEarnedText.y = tomato.y - 100;
game.addChild(moneyEarnedText);
// Animate money earned text - move up and fade out
tween(moneyEarnedText, {
y: moneyEarnedText.y - 150,
alpha: 0
}, {
duration: 1500,
easing: tween.easeOut,
onFinish: function onFinish() {
moneyEarnedText.destroy();
}
});
// Animate tomato scale - grow then shrink back
tween(tomato, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 150,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(tomato, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 150,
easing: tween.easeOut
});
}
});
// Create tomato juice particles at right, left, top, bottom and diagonal points
var positions = [{
angle: 0,
name: 'right'
},
// Right
{
angle: Math.PI,
name: 'left'
},
// Left
{
angle: -Math.PI / 2,
name: 'top'
},
// Top
{
angle: Math.PI / 2,
name: 'bottom'
},
// Bottom
{
angle: -Math.PI / 4,
name: 'top-right'
},
// Top-right diagonal
{
angle: -3 * Math.PI / 4,
name: 'top-left'
},
// Top-left diagonal
{
angle: Math.PI / 4,
name: 'bottom-right'
},
// Bottom-right diagonal
{
angle: 3 * Math.PI / 4,
name: 'bottom-left'
} // Bottom-left diagonal
];
for (var i = 0; i < positions.length; i++) {
var angle = positions[i].angle;
var startDistance = 300; // Start particles further from tomato center
var startX = tomato.x + Math.cos(angle) * startDistance;
var startY = tomato.y + Math.sin(angle) * startDistance;
var juice = game.addChild(LK.getAsset('tomatoJuice', {
anchorX: 0.5,
anchorY: 0.5,
x: startX,
y: startY
}));
var endDistance = 450; // End particles even further away
var targetX = tomato.x + Math.cos(angle) * endDistance;
var targetY = tomato.y + Math.sin(angle) * endDistance;
tween(juice, {
x: targetX,
y: targetY,
alpha: 0,
scaleX: 0.5,
scaleY: 0.5
}, {
duration: 2000,
easing: tween.easeOut,
onFinish: function onFinish() {
juice.destroy();
}
});
}
};
farmBtn.down = function (x, y, obj) {
currentScreen = 'farm';
tomato.visible = false;
farmBtn.visible = false;
farmBtnText.visible = false;
employeeBtn.visible = false;
employeeBtnText.visible = false;
tasksBtn.visible = false;
tasksBtnText.visible = false;
petsBtn.visible = false;
petsBtnText.visible = false;
// Hide UI elements when leaving main screen
moneyText.visible = false;
passiveText.visible = false;
chronometerText.visible = false;
clickEarningText.visible = false;
farmContainer.visible = true;
};
skillBtn.down = function (x, y, obj) {
if (money >= skillUpgradeCost && skillLevel < 10) {
money -= skillUpgradeCost;
skillLevel++;
skillUpgradeCost = Math.floor(skillUpgradeCost * 1.5); // Increase cost by 50%
if (skillLevel >= 10) {
skillBtnText.setText('SKILL LV.' + skillLevel + ' - MAX.');
} else {
skillBtnText.setText('SKILL LV.' + skillLevel);
}
skillLevelText.setText('$' + skillUpgradeCost);
// Update click earning display text to show new earning amount
clickEarningText.setText('+$' + getClickEarning() + ' per click');
updateMoneyDisplay();
LK.getSound('purchase').play();
}
};
petsBtn.down = function (x, y, obj) {
currentScreen = 'pets';
tomato.visible = false;
farmBtn.visible = false;
farmBtnText.visible = false;
employeeBtn.visible = false;
employeeBtnText.visible = false;
tasksBtn.visible = false;
tasksBtnText.visible = false;
skillBtn.visible = false;
skillBtnText.visible = false;
skillLevelText.visible = false;
petsBtn.visible = false;
petsBtnText.visible = false;
// Hide UI elements when leaving main screen
moneyText.visible = false;
passiveText.visible = false;
chronometerText.visible = false;
clickEarningText.visible = false;
petsContainer.visible = true;
};
employeeBtn.down = function (x, y, obj) {
currentScreen = 'employee';
tomato.visible = false;
farmBtn.visible = false;
farmBtnText.visible = false;
employeeBtn.visible = false;
employeeBtnText.visible = false;
tasksBtn.visible = false;
tasksBtnText.visible = false;
skillBtn.visible = false;
skillBtnText.visible = false;
skillLevelText.visible = false;
// Hide UI elements when leaving main screen
moneyText.visible = false;
passiveText.visible = false;
chronometerText.visible = false;
clickEarningText.visible = false;
employeeContainer.visible = true;
};
farmBackBtn.down = function (x, y, obj) {
currentScreen = 'main';
tomato.visible = true;
farmBtn.visible = true;
farmBtnText.visible = true;
employeeBtn.visible = true;
employeeBtnText.visible = true;
tasksBtn.visible = true;
tasksBtnText.visible = true;
skillBtn.visible = true;
skillBtnText.visible = true;
skillLevelText.visible = true;
petsBtn.visible = true;
petsBtnText.visible = true;
// Show UI elements when returning to main screen
moneyText.visible = true;
passiveText.visible = true;
chronometerText.visible = true;
clickEarningText.visible = true;
farmContainer.visible = false;
};
employeeBackBtn.down = function (x, y, obj) {
currentScreen = 'main';
tomato.visible = true;
farmBtn.visible = true;
farmBtnText.visible = true;
employeeBtn.visible = true;
employeeBtnText.visible = true;
tasksBtn.visible = true;
tasksBtnText.visible = true;
skillBtn.visible = true;
skillBtnText.visible = true;
skillLevelText.visible = true;
// Show UI elements when returning to main screen
moneyText.visible = true;
passiveText.visible = true;
chronometerText.visible = true;
clickEarningText.visible = true;
employeeContainer.visible = false;
};
tasksBtn.down = function (x, y, obj) {
currentScreen = 'tasks';
tomato.visible = false;
farmBtn.visible = false;
farmBtnText.visible = false;
employeeBtn.visible = false;
employeeBtnText.visible = false;
tasksBtn.visible = false;
tasksBtnText.visible = false;
skillBtn.visible = false;
skillBtnText.visible = false;
skillLevelText.visible = false;
petsBtn.visible = false;
petsBtnText.visible = false;
// Hide UI elements when leaving main screen
moneyText.visible = false;
passiveText.visible = false;
chronometerText.visible = false;
clickEarningText.visible = false;
tasksContainer.visible = true;
};
tasksBackBtn.down = function (x, y, obj) {
currentScreen = 'main';
tomato.visible = true;
farmBtn.visible = true;
farmBtnText.visible = true;
employeeBtn.visible = true;
employeeBtnText.visible = true;
tasksBtn.visible = true;
tasksBtnText.visible = true;
skillBtn.visible = true;
skillBtnText.visible = true;
skillLevelText.visible = true;
petsBtn.visible = true;
petsBtnText.visible = true;
// Show UI elements when returning to main screen
moneyText.visible = true;
passiveText.visible = true;
chronometerText.visible = true;
clickEarningText.visible = true;
tasksContainer.visible = false;
};
petsBackBtn.down = function (x, y, obj) {
currentScreen = 'main';
tomato.visible = true;
farmBtn.visible = true;
farmBtnText.visible = true;
employeeBtn.visible = true;
employeeBtnText.visible = true;
tasksBtn.visible = true;
tasksBtnText.visible = true;
skillBtn.visible = true;
skillBtnText.visible = true;
skillLevelText.visible = true;
petsBtn.visible = true;
petsBtnText.visible = true;
// Show UI elements when returning to main screen
moneyText.visible = true;
passiveText.visible = true;
chronometerText.visible = true;
clickEarningText.visible = true;
petsContainer.visible = false;
};
// Timing bonus screen elements
var timingBonusTitle = new Text2('TIME BONUS!', {
size: 90,
fill: 0xffd700
});
timingBonusTitle.anchor.set(0.5, 0.5);
timingBonusTitle.x = 1024;
timingBonusTitle.y = 400;
timingBonusContainer.addChild(timingBonusTitle);
var timingBonusDescription = new Text2('Perfect timing! Claim your 1 million bonus!', {
size: 60,
fill: 0x333333
});
timingBonusDescription.anchor.set(0.5, 0.5);
timingBonusDescription.x = 1024;
timingBonusDescription.y = 600;
timingBonusContainer.addChild(timingBonusDescription);
var timingBonusAmountText = new Text2('Bonus: $1,000,000', {
size: 80,
fill: 0x4CAF50
});
timingBonusAmountText.anchor.set(0.5, 0.5);
timingBonusAmountText.x = 1024;
timingBonusAmountText.y = 800;
timingBonusContainer.addChild(timingBonusAmountText);
var timingBonusClaimBtn = timingBonusContainer.addChild(LK.getAsset('backButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1000
}));
var timingBonusClaimText = new Text2('CLAIM', {
size: 60,
fill: 0xFFFFFF
});
timingBonusClaimText.anchor.set(0.5, 0.5);
timingBonusClaimText.x = 1024;
timingBonusClaimText.y = 1000;
timingBonusContainer.addChild(timingBonusClaimText);
// Timing bonus button event handler
timingBonusButton.down = function (x, y, obj) {
if (timingBonusActive && currentScreen === 'main' && !timingBonusClaimed) {
// Show timing bonus screen
currentScreen = 'timingBonus';
timingBonusContainer.visible = true;
// Hide main screen elements
tomato.visible = false;
farmBtn.visible = false;
farmBtnText.visible = false;
employeeBtn.visible = false;
employeeBtnText.visible = false;
tasksBtn.visible = false;
tasksBtnText.visible = false;
timingBonusButton.visible = false;
timingBonusText.visible = false;
skillBtn.visible = false;
skillBtnText.visible = false;
skillLevelText.visible = false;
petsBtn.visible = false;
petsBtnText.visible = false;
// Hide UI elements when entering timing bonus screen
moneyText.visible = false;
passiveText.visible = false;
chronometerText.visible = false;
clickEarningText.visible = false;
LK.getSound('click').play();
}
};
// Timing bonus claim button event handler
timingBonusClaimBtn.down = function (x, y, obj) {
if (currentScreen === 'timingBonus' && !timingBonusClaimed) {
// Add 1 million money only once, but respect the 250 million limit
if (money + 1000000 <= 250000000) {
money += 1000000;
} else {
// Only add the amount that would reach exactly 250 million
var remainingAmount = 250000000 - money;
if (remainingAmount > 0) {
money += remainingAmount;
}
}
timingBonusClaimed = true;
updateMoneyDisplay();
// Return to main screen
currentScreen = 'main';
timingBonusContainer.visible = false;
tomato.visible = true;
farmBtn.visible = true;
farmBtnText.visible = true;
employeeBtn.visible = true;
employeeBtnText.visible = true;
tasksBtn.visible = true;
tasksBtnText.visible = true;
skillBtn.visible = true;
skillBtnText.visible = true;
skillLevelText.visible = true;
petsBtn.visible = true;
petsBtnText.visible = true;
// Show UI elements when returning to main screen
moneyText.visible = true;
passiveText.visible = true;
chronometerText.visible = true;
clickEarningText.visible = true;
timingBonusActive = false;
timingBonusIndex++;
LK.getSound('purchase').play();
}
};
// Pause button event handler
pauseButton.down = function (x, y, obj) {
if (currentScreen === 'main') {
currentScreen = 'pause';
pauseMenuContainer.visible = true;
// Hide main screen elements
tomato.visible = false;
farmBtn.visible = false;
farmBtnText.visible = false;
employeeBtn.visible = false;
employeeBtnText.visible = false;
tasksBtn.visible = false;
tasksBtnText.visible = false;
skillBtn.visible = false;
skillBtnText.visible = false;
skillLevelText.visible = false;
petsBtn.visible = false;
petsBtnText.visible = false;
pauseButton.visible = false;
pauseButtonText.visible = false;
// Hide UI elements
moneyText.visible = false;
passiveText.visible = false;
chronometerText.visible = false;
clickEarningText.visible = false;
LK.getSound('click').play();
}
};
// Back to Game button event handler
pauseBackToGameBtn.down = function (x, y, obj) {
currentScreen = 'main';
pauseMenuContainer.visible = false;
// Show main screen elements
tomato.visible = true;
farmBtn.visible = true;
farmBtnText.visible = true;
employeeBtn.visible = true;
employeeBtnText.visible = true;
tasksBtn.visible = true;
tasksBtnText.visible = true;
skillBtn.visible = true;
skillBtnText.visible = true;
skillLevelText.visible = true;
petsBtn.visible = true;
petsBtnText.visible = true;
pauseButton.visible = true;
pauseButtonText.visible = true;
// Show UI elements
moneyText.visible = true;
passiveText.visible = true;
chronometerText.visible = true;
clickEarningText.visible = true;
LK.getSound('click').play();
};
// Pause menu music toggle event handler
pauseMusicToggleBtn.down = function (x, y, obj) {
musicEnabled = !musicEnabled;
pauseMusicToggleText.setText(musicEnabled ? 'MUSIC: ON' : 'MUSIC: OFF');
// Also update the main options screen text
musicToggleText.setText(musicEnabled ? 'MUSIC: ON' : 'MUSIC: OFF');
storage.musicEnabled = musicEnabled;
if (musicEnabled) {
LK.playMusic('gameMusic');
} else {
LK.stopMusic();
}
LK.getSound('click').play();
};
// Pause menu main menu button event handler
pauseMainMenuBtn.down = function (x, y, obj) {
currentScreen = 'menu';
pauseMenuContainer.visible = false;
menuContainer.visible = true;
// Hide all game elements
tomato.visible = false;
farmBtn.visible = false;
farmBtnText.visible = false;
employeeBtn.visible = false;
employeeBtnText.visible = false;
tasksBtn.visible = false;
tasksBtnText.visible = false;
skillBtn.visible = false;
skillBtnText.visible = false;
skillLevelText.visible = false;
petsBtn.visible = false;
petsBtnText.visible = false;
pauseButton.visible = false;
pauseButtonText.visible = false;
// Hide UI elements
moneyText.visible = false;
passiveText.visible = false;
chronometerText.visible = false;
clickEarningText.visible = false;
// Reset game state
gameStarted = false;
if (musicEnabled) {
LK.playMusic('menuMusic');
}
LK.getSound('click').play();
};
// Passive income timer
var passiveTimer = LK.setInterval(function () {
if (passiveIncome > 0 && gameStarted && currentScreen !== 'menu' && currentScreen === 'main') {
// Only apply passive income if game has been running for at least 1 second
var gameRunTime = Date.now() - gameStartTime;
if (gameRunTime >= 1000) {
// Check if adding passive income would exceed 250 million limit
if (money + passiveIncome <= 250000000) {
money += passiveIncome;
totalMoneyEarned += passiveIncome;
} else {
// Only add the amount that would reach exactly 250 million
var remainingAmount = 250000000 - money;
if (remainingAmount > 0) {
money += remainingAmount;
totalMoneyEarned += remainingAmount;
}
}
updateMoneyDisplay();
}
}
}, 1000);
game.update = function () {
// Update chronometer display
if (gameStarted) {
var currentTime = Date.now();
var elapsedSeconds = Math.floor((currentTime - gameStartTime) / 1000);
var minutes = Math.floor(elapsedSeconds / 60);
var seconds = elapsedSeconds % 60;
var timeString = (minutes < 10 ? '0' : '') + minutes + ':' + (seconds < 10 ? '0' : '') + seconds;
chronometerText.setText(timeString);
}
// Only update game logic if game has started
if (gameStarted && currentScreen !== 'menu') {
// Update button visibility based on money
if (money >= 10) {
farmBtn.alpha = 1;
farmBtnText.alpha = 1;
} else {
farmBtn.alpha = 0.5;
farmBtnText.alpha = 0.5;
}
if (money >= 25) {
employeeBtn.alpha = 1;
employeeBtnText.alpha = 1;
} else {
employeeBtn.alpha = 0.5;
employeeBtnText.alpha = 0.5;
}
// Update skill button visibility based on money and max level
if (skillLevel >= 10) {
skillBtn.alpha = 0.5;
skillBtnText.alpha = 0.5;
skillLevelText.alpha = 0.5;
} else if (money >= skillUpgradeCost) {
skillBtn.alpha = 1;
skillBtnText.alpha = 1;
skillLevelText.alpha = 1;
} else {
skillBtn.alpha = 0.5;
skillBtnText.alpha = 0.5;
skillLevelText.alpha = 0.5;
}
// Update passive income display
passiveText.setText('+$' + passiveIncome + '/sec');
// Update click earning display to ensure it shows current amount
clickEarningText.setText('+$' + getClickEarning() + ' per click');
// Update task progress
if (tasks.length > 0) {
tasks[0].updateProgress(totalClicks); // Click task
tasks[1].updateProgress(totalMoneyEarned); // Money task
tasks[2].updateProgress(totalItemsBought); // Farm items task
tasks[3].updateProgress(totalEmployeesHired); // Employee task
tasks[4].updateProgress(totalMoneyEarned); // Big money task
}
// Timing bonus button logic (appears at 1min, 3min, 10min, 30min for 3 seconds)
if (gameStarted && currentScreen === 'main' && timingBonusIndex < timingBonusTimes.length) {
var gameElapsed = currentTime - gameStartTime;
var nextBonusTime = timingBonusTimes[timingBonusIndex];
if (!timingBonusActive && gameElapsed >= nextBonusTime) {
timingBonusActive = true;
timingBonusButton.visible = true;
timingBonusText.visible = true;
timingBonusButton.alpha = 0;
timingBonusText.alpha = 0;
timingBonusButton.scaleX = 0;
timingBonusButton.scaleY = 0;
timingBonusText.scaleX = 0;
timingBonusText.scaleY = 0;
// Animate button appearance
tween(timingBonusButton, {
alpha: 1,
scaleX: 1,
scaleY: 1
}, {
duration: 300,
easing: tween.bounceOut
});
tween(timingBonusText, {
alpha: 1,
scaleX: 1,
scaleY: 1
}, {
duration: 300,
easing: tween.bounceOut
});
// Hide button after 3 seconds
LK.setTimeout(function () {
if (timingBonusActive) {
timingBonusActive = false;
timingBonusButton.visible = false;
timingBonusText.visible = false;
timingBonusIndex++;
}
}, 3000);
}
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -1395,8 +1395,13 @@
employeeBtn.visible = false;
employeeBtnText.visible = false;
tasksBtn.visible = false;
tasksBtnText.visible = false;
+ skillBtn.visible = false;
+ skillBtnText.visible = false;
+ skillLevelText.visible = false;
+ petsBtn.visible = false;
+ petsBtnText.visible = false;
// Hide UI elements when leaving main screen
moneyText.visible = false;
passiveText.visible = false;
chronometerText.visible = false;