User prompt
meyve sebzelerin ne kadar olduğunu gösteren yazı diğer yazılar ile iç içe geçiyor bunu düzelt
User prompt
yazılar halen pek iyi görünmüyor butonlara dounmadan yazıları büyüt
User prompt
farm ve employees butonlarına basılınca açılan sayfadaki butonların üzerindeki yazılar pek okunmuyor 5x satın alma ve 5x satma butonlarını kaldır kalan buton ve görüntülerı daha iyibir okunabilirlik icin minumu oranda büyüt
User prompt
tasks butonunuda büyüt
User prompt
farm ve employees butonunun içindeki yazılar pek okunmuyor butonları yazıların daha iyi okunabilmesi iin minumm oranda büyüt
User prompt
far butonunun içindeki tüm butonları sil ve en baştan tasarla
User prompt
buy ve sell butonları arasındak boşluk miktarını artır birbirlerine yapışık kalmasınlar
User prompt
buy ve sell butonları arasındak boşluk miktarını artır birbirlerine yapışık kalmasınlar
User prompt
far butonndaki bütün butonları sil sadece satın al sat ve meyve sebzelerin görüntüsü kalsın
User prompt
aralarındaki boşluk mesafesini 50 yap
User prompt
farm butonunun içindeki butonların arasındaki boşluk miktarını minumum 4 yap
User prompt
butonları eskı halıne getır aralarındakı boşluk mesafesini doğru orantı kullanarak ayarla ve butonların boyutunu 2 katına çıkararak yazıların daha iyi okunabilmesini sağla
User prompt
farm ve employees butonlarının ıcıde bulunan butonların boyutunu 3 katına çıkar
User prompt
ana menüde iken para miktarı artmasın
User prompt
ana menü ve oyun ekranına müzik ekle ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
options butonuna basılınca sekme açılsın ve bu sekmede oyun müziğini aç kapa yapmaya yarayan buton bulunsun ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
oyunun adını sil ve normal bir şekilde yaz
User prompt
aynı dogrultuda olucaklar
User prompt
oyunun adını sil ve hilal şeklinde tekrar yaz
User prompt
oyuna basit bir ana menü ekle ana menüde start optıons ve how to play olmak üzere 3 adet buton bulunucak ve oyunun adı olan MANAV TİME! 180 derece açıyla yazılmış olucak ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
her personelden maksimum 5 adet bulundurulabilsin
User prompt
çarpraz bölümlerdede gözükebisin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
biraz daha sağ sol üst ve akt bölüme yaaştır soslar domatesin üzerinde gözükmüyor ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
domatesin sağ sol üst ve alt noktalarında gözüksün bu sos ve daha kırmızı hale getir ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
domatese her tıklamada ekstra olaarak etrafta2 saniyeliğine domates suyu gözüksün ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/**** * 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; var nameText = new Text2(name, { size: 60, 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: 50, fill: 0x4CAF50 }); incomeText.anchor.set(0.5, 0.5); incomeText.x = 0; incomeText.y = 0; self.addChild(incomeText); var costText = new Text2('Cost: $' + cost, { size: 50, fill: 0x666666 }); costText.anchor.set(0.5, 0.5); costText.x = 0; costText.y = 40; self.addChild(costText); self.hireBtn = self.attachAsset('hireButton', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 100 }); self.statusText = new Text2('HIRE', { size: 50, 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 (!self.hired && money >= self.cost) { money -= self.cost; self.hired = true; passiveIncome += self.income; totalEmployeesHired++; self.statusText.setText('HIRED'); 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: 55, fill: 0x000000 }); nameText.anchor.set(0.5, 0.5); nameText.x = 0; nameText.y = 100; self.addChild(nameText); var priceText = new Text2('B:$' + buyPrice + ' S:$' + sellPrice, { size: 45, fill: 0x666666 }); priceText.anchor.set(0.5, 0.5); priceText.x = 0; priceText.y = 140; self.addChild(priceText); self.quantityText = new Text2('Own: 0', { size: 50, fill: 0x333333 }); self.quantityText.anchor.set(0.5, 0.5); self.quantityText.x = 0; self.quantityText.y = 180; self.addChild(self.quantityText); var buyBtn = self.attachAsset('buyButton', { anchorX: 0.5, anchorY: 0.5, x: -80, y: 220 }); var sellBtn = self.attachAsset('sellButton', { anchorX: 0.5, anchorY: 0.5, x: 80, y: 220 }); var buy5Btn = self.attachAsset('buyButton', { anchorX: 0.5, anchorY: 0.5, x: -80, y: 310 }); var sell5Btn = self.attachAsset('sellButton', { anchorX: 0.5, anchorY: 0.5, x: 80, y: 310 }); var buyText = new Text2('BUY', { size: 45, fill: 0xFFFFFF }); buyText.anchor.set(0.5, 0.5); buyText.x = -80; buyText.y = 220; self.addChild(buyText); var sellText = new Text2('SELL', { size: 45, fill: 0xFFFFFF }); sellText.anchor.set(0.5, 0.5); sellText.x = 80; sellText.y = 220; self.addChild(sellText); var buy5Text = new Text2('BUY x5', { size: 40, fill: 0xFFFFFF }); buy5Text.anchor.set(0.5, 0.5); buy5Text.x = -80; buy5Text.y = 310; self.addChild(buy5Text); var sell5Text = new Text2('SELL x5', { size: 40, fill: 0xFFFFFF }); sell5Text.anchor.set(0.5, 0.5); sell5Text.x = 80; sell5Text.y = 310; self.addChild(sell5Text); 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(); } }; buy5Btn.down = function (x, y, obj) { var totalCost = self.buyPrice * 5; if (money >= totalCost) { money -= totalCost; self.quantity += 5; totalItemsBought += 5; self.quantityText.setText('Own: ' + self.quantity); updateMoneyDisplay(); LK.getSound('purchase').play(); } }; sell5Btn.down = function (x, y, obj) { if (self.quantity >= 5) { money += self.sellPrice * 5; self.quantity -= 5; self.quantityText.setText('Own: ' + self.quantity); 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 currentScreen = 'main'; var farmItems = []; var employees = []; var totalClicks = 0; var totalMoneyEarned = 0; var totalItemsBought = 0; var totalEmployeesHired = 0; function updateMoneyDisplay() { moneyText.setText('$' + money); storage.money = money; storage.passiveIncome = passiveIncome; } // Main screen elements var tomato = game.addChild(LK.getAsset('tomato', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1200 })); var moneyText = new Text2('$' + money, { size: 80, fill: 0x2E7D32 }); moneyText.anchor.set(1, 0); LK.gui.topRight.addChild(moneyText); var passiveText = new Text2('+$' + passiveIncome + '/sec', { size: 50, fill: 0x4CAF50 }); passiveText.anchor.set(1, 0); passiveText.y = 100; LK.gui.topRight.addChild(passiveText); var farmBtn = game.addChild(LK.getAsset('farmButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1800 })); var farmBtnText = new Text2('FARM', { size: 70, fill: 0xFFFFFF }); farmBtnText.anchor.set(0.5, 0.5); farmBtnText.x = 1024; farmBtnText.y = 1800; game.addChild(farmBtnText); var employeeBtn = game.addChild(LK.getAsset('employeeButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1920 })); var employeeBtnText = new Text2('EMPLOYEES', { size: 70, fill: 0xFFFFFF }); employeeBtnText.anchor.set(0.5, 0.5); employeeBtnText.x = 1024; employeeBtnText.y = 1920; game.addChild(employeeBtnText); var tasksBtn = game.addChild(LK.getAsset('tasksButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2040 })); var tasksBtnText = new Text2('TASKS', { size: 70, fill: 0xFFFFFF }); tasksBtnText.anchor.set(0.5, 0.5); tasksBtnText.x = 1024; tasksBtnText.y = 2040; game.addChild(tasksBtnText); // 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); var farmBackBtn = farmContainer.addChild(LK.getAsset('backButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1400 })); var farmBackText = new Text2('BACK', { size: 60, fill: 0xFFFFFF }); farmBackText.anchor.set(0.5, 0.5); farmBackText.x = 1024; farmBackText.y = 1400; farmContainer.addChild(farmBackText); // 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); // Event handlers tomato.down = function (x, y, obj) { money += 1; totalClicks++; totalMoneyEarned++; updateMoneyDisplay(); LK.getSound('click').play(); // 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 around the tomato for (var i = 0; i < 8; i++) { var juice = game.addChild(LK.getAsset('tomatoJuice', { anchorX: 0.5, anchorY: 0.5, x: tomato.x, y: tomato.y })); var angle = i / 8 * Math.PI * 2; var distance = 150 + Math.random() * 100; var targetX = tomato.x + Math.cos(angle) * distance; var targetY = tomato.y + Math.sin(angle) * distance; 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) { if (money >= 10) { currentScreen = 'farm'; tomato.visible = false; farmBtn.visible = false; farmBtnText.visible = false; employeeBtn.visible = false; employeeBtnText.visible = false; tasksBtn.visible = false; tasksBtnText.visible = false; farmContainer.visible = true; } }; employeeBtn.down = function (x, y, obj) { if (money >= 25) { currentScreen = 'employee'; tomato.visible = false; farmBtn.visible = false; farmBtnText.visible = false; employeeBtn.visible = false; employeeBtnText.visible = false; tasksBtn.visible = false; tasksBtnText.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; 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; 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; 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; tasksContainer.visible = false; }; // Passive income timer var passiveTimer = LK.setInterval(function () { if (passiveIncome > 0) { money += passiveIncome; totalMoneyEarned += passiveIncome; updateMoneyDisplay(); } }, 1000); game.update = function () { // 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 passive income display passiveText.setText('+$' + passiveIncome + '/sec'); // 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 } };
/****
* 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;
var nameText = new Text2(name, {
size: 60,
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: 50,
fill: 0x4CAF50
});
incomeText.anchor.set(0.5, 0.5);
incomeText.x = 0;
incomeText.y = 0;
self.addChild(incomeText);
var costText = new Text2('Cost: $' + cost, {
size: 50,
fill: 0x666666
});
costText.anchor.set(0.5, 0.5);
costText.x = 0;
costText.y = 40;
self.addChild(costText);
self.hireBtn = self.attachAsset('hireButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 100
});
self.statusText = new Text2('HIRE', {
size: 50,
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 (!self.hired && money >= self.cost) {
money -= self.cost;
self.hired = true;
passiveIncome += self.income;
totalEmployeesHired++;
self.statusText.setText('HIRED');
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: 55,
fill: 0x000000
});
nameText.anchor.set(0.5, 0.5);
nameText.x = 0;
nameText.y = 100;
self.addChild(nameText);
var priceText = new Text2('B:$' + buyPrice + ' S:$' + sellPrice, {
size: 45,
fill: 0x666666
});
priceText.anchor.set(0.5, 0.5);
priceText.x = 0;
priceText.y = 140;
self.addChild(priceText);
self.quantityText = new Text2('Own: 0', {
size: 50,
fill: 0x333333
});
self.quantityText.anchor.set(0.5, 0.5);
self.quantityText.x = 0;
self.quantityText.y = 180;
self.addChild(self.quantityText);
var buyBtn = self.attachAsset('buyButton', {
anchorX: 0.5,
anchorY: 0.5,
x: -80,
y: 220
});
var sellBtn = self.attachAsset('sellButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 80,
y: 220
});
var buy5Btn = self.attachAsset('buyButton', {
anchorX: 0.5,
anchorY: 0.5,
x: -80,
y: 310
});
var sell5Btn = self.attachAsset('sellButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 80,
y: 310
});
var buyText = new Text2('BUY', {
size: 45,
fill: 0xFFFFFF
});
buyText.anchor.set(0.5, 0.5);
buyText.x = -80;
buyText.y = 220;
self.addChild(buyText);
var sellText = new Text2('SELL', {
size: 45,
fill: 0xFFFFFF
});
sellText.anchor.set(0.5, 0.5);
sellText.x = 80;
sellText.y = 220;
self.addChild(sellText);
var buy5Text = new Text2('BUY x5', {
size: 40,
fill: 0xFFFFFF
});
buy5Text.anchor.set(0.5, 0.5);
buy5Text.x = -80;
buy5Text.y = 310;
self.addChild(buy5Text);
var sell5Text = new Text2('SELL x5', {
size: 40,
fill: 0xFFFFFF
});
sell5Text.anchor.set(0.5, 0.5);
sell5Text.x = 80;
sell5Text.y = 310;
self.addChild(sell5Text);
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();
}
};
buy5Btn.down = function (x, y, obj) {
var totalCost = self.buyPrice * 5;
if (money >= totalCost) {
money -= totalCost;
self.quantity += 5;
totalItemsBought += 5;
self.quantityText.setText('Own: ' + self.quantity);
updateMoneyDisplay();
LK.getSound('purchase').play();
}
};
sell5Btn.down = function (x, y, obj) {
if (self.quantity >= 5) {
money += self.sellPrice * 5;
self.quantity -= 5;
self.quantityText.setText('Own: ' + self.quantity);
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 currentScreen = 'main';
var farmItems = [];
var employees = [];
var totalClicks = 0;
var totalMoneyEarned = 0;
var totalItemsBought = 0;
var totalEmployeesHired = 0;
function updateMoneyDisplay() {
moneyText.setText('$' + money);
storage.money = money;
storage.passiveIncome = passiveIncome;
}
// Main screen elements
var tomato = game.addChild(LK.getAsset('tomato', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1200
}));
var moneyText = new Text2('$' + money, {
size: 80,
fill: 0x2E7D32
});
moneyText.anchor.set(1, 0);
LK.gui.topRight.addChild(moneyText);
var passiveText = new Text2('+$' + passiveIncome + '/sec', {
size: 50,
fill: 0x4CAF50
});
passiveText.anchor.set(1, 0);
passiveText.y = 100;
LK.gui.topRight.addChild(passiveText);
var farmBtn = game.addChild(LK.getAsset('farmButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1800
}));
var farmBtnText = new Text2('FARM', {
size: 70,
fill: 0xFFFFFF
});
farmBtnText.anchor.set(0.5, 0.5);
farmBtnText.x = 1024;
farmBtnText.y = 1800;
game.addChild(farmBtnText);
var employeeBtn = game.addChild(LK.getAsset('employeeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1920
}));
var employeeBtnText = new Text2('EMPLOYEES', {
size: 70,
fill: 0xFFFFFF
});
employeeBtnText.anchor.set(0.5, 0.5);
employeeBtnText.x = 1024;
employeeBtnText.y = 1920;
game.addChild(employeeBtnText);
var tasksBtn = game.addChild(LK.getAsset('tasksButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 2040
}));
var tasksBtnText = new Text2('TASKS', {
size: 70,
fill: 0xFFFFFF
});
tasksBtnText.anchor.set(0.5, 0.5);
tasksBtnText.x = 1024;
tasksBtnText.y = 2040;
game.addChild(tasksBtnText);
// 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);
var farmBackBtn = farmContainer.addChild(LK.getAsset('backButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1400
}));
var farmBackText = new Text2('BACK', {
size: 60,
fill: 0xFFFFFF
});
farmBackText.anchor.set(0.5, 0.5);
farmBackText.x = 1024;
farmBackText.y = 1400;
farmContainer.addChild(farmBackText);
// 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);
// Event handlers
tomato.down = function (x, y, obj) {
money += 1;
totalClicks++;
totalMoneyEarned++;
updateMoneyDisplay();
LK.getSound('click').play();
// 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 around the tomato
for (var i = 0; i < 8; i++) {
var juice = game.addChild(LK.getAsset('tomatoJuice', {
anchorX: 0.5,
anchorY: 0.5,
x: tomato.x,
y: tomato.y
}));
var angle = i / 8 * Math.PI * 2;
var distance = 150 + Math.random() * 100;
var targetX = tomato.x + Math.cos(angle) * distance;
var targetY = tomato.y + Math.sin(angle) * distance;
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) {
if (money >= 10) {
currentScreen = 'farm';
tomato.visible = false;
farmBtn.visible = false;
farmBtnText.visible = false;
employeeBtn.visible = false;
employeeBtnText.visible = false;
tasksBtn.visible = false;
tasksBtnText.visible = false;
farmContainer.visible = true;
}
};
employeeBtn.down = function (x, y, obj) {
if (money >= 25) {
currentScreen = 'employee';
tomato.visible = false;
farmBtn.visible = false;
farmBtnText.visible = false;
employeeBtn.visible = false;
employeeBtnText.visible = false;
tasksBtn.visible = false;
tasksBtnText.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;
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;
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;
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;
tasksContainer.visible = false;
};
// Passive income timer
var passiveTimer = LK.setInterval(function () {
if (passiveIncome > 0) {
money += passiveIncome;
totalMoneyEarned += passiveIncome;
updateMoneyDisplay();
}
}, 1000);
game.update = function () {
// 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 passive income display
passiveText.setText('+$' + passiveIncome + '/sec');
// 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
}
};