User prompt
Müşteriler daha yavaş hareket etsinler.
User prompt
Fabrikalar bütün panelini biraz aşağı indir.
User prompt
Madenlerin üret yazısını biraz yukarı çıkar.
User prompt
Madenlerin üret butonunu biraz alta indir.
User prompt
Madenlerin üret butonunu biraz alta indir.
User prompt
Madenlerin üret butonunu biraz alta indir.
User prompt
Madenin Yükseltme Fiyatının yanına üret butonu ekle.
User prompt
Yükselt ve Aç yazılarını biraz büyüt.
User prompt
Yükselt ve Aç yazılarını biraz alta indir
User prompt
Bütün yazı boyutunu biraz küçült.
User prompt
Açma ve yükseltme yazılarını büyüt.
User prompt
Maden, Fabrikaların ve mağazanın olduğu Yazıların boyutunu biraz büyüt.
User prompt
Üretilmeyen ürünün müşterisi gelmesin.
User prompt
CPU fabrikası hariç diğer fabrikaları üretime açmak için belli ücret ödeyelim.
User prompt
MB, CASE, FAN, HDD, COOLER fabrikalarını biraz aşağı indir.
User prompt
MB, CASE, FAN, HDD, COOLER fabrikalarını biraz aşağı indir.
User prompt
Fabrika boşluklarını alta doğru biraz aç.
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'length')' in or related to this line: 'for (var i = 0; i < partTypes.length; i++) {' Line Number: 220
User prompt
Her ürünün farklı fabrikası olsun.
Code edit (1 edits merged)
Please save this source code
User prompt
Bilgisayar Parçası Otomasyon: Mağaza ve Fabrika Yönetimi
Initial prompt
Idle otomasyon üretim ve mağaza yönetim oyunu. 10 bilgisayar parçası olan bir otomasyon oyunu. Müşteriler mağazadan ürün almak için geliyorlar. Her şeyin yükseltme maliyeti olacak. Fabrikada üret butonu olsun. Ek olarak 3 adet maden olsun. Bu ürünleri üretmek için 3 madenden ürün üretelim.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Customer class: comes to store and buys a part var Customer = Container.expand(function () { var self = Container.call(this); self.partType = null; self.attachAsset('customer', { anchorX: 0.5, anchorY: 0.5 }); var partIcon = null; self.setPart = function (type) { self.partType = type; if (partIcon) partIcon.destroy(); partIcon = self.attachAsset('part_' + type, { anchorX: 0.5, anchorY: 0.5, y: 60, scaleX: 0.5, scaleY: 0.5 }); }; return self; }); // Factory class: produces computer parts from raw materials var Factory = Container.expand(function () { var self = Container.call(this); self.level = 1; self.production = 1; // per click self.upgradeCost = 100; self.attachAsset('factory', { anchorX: 0.5, anchorY: 0.5 }); // Level text var levelTxt = new Text2('Lv.' + self.level, { size: 40, fill: '#fff' }); levelTxt.anchor.set(0.5, 0); levelTxt.y = 90; self.addChild(levelTxt); self.upgrade = function () { if (money >= self.upgradeCost) { money -= self.upgradeCost; self.level += 1; self.production += 1; self.upgradeCost = Math.floor(self.upgradeCost * 2); levelTxt.setText('Lv.' + self.level); updateMoneyText(); } }; return self; }); // Mine class: produces raw materials over time var Mine = Container.expand(function () { var self = Container.call(this); self.level = 1; self.type = 'copper'; // 'copper', 'silicon', 'iron' self.production = 1; // per tick self.timer = 0; self.upgradeCost = 50; self.attachAsset('mine', { anchorX: 0.5, anchorY: 0.5 }); // Ore icon var oreIcon = self.attachAsset('ore_' + self.type, { anchorX: 0.5, anchorY: 0.5, y: 60, scaleX: 0.7, scaleY: 0.7 }); // Level text var levelTxt = new Text2('Lv.' + self.level, { size: 40, fill: '#fff' }); levelTxt.anchor.set(0.5, 0); levelTxt.y = 90; self.addChild(levelTxt); self.setType = function (type) { self.type = type; oreIcon.destroy(); var newOre = self.attachAsset('ore_' + type, { anchorX: 0.5, anchorY: 0.5, y: 60, scaleX: 0.7, scaleY: 0.7 }); }; self.upgrade = function () { if (money >= self.upgradeCost) { money -= self.upgradeCost; self.level += 1; self.production += 1; self.upgradeCost = Math.floor(self.upgradeCost * 1.7); levelTxt.setText('Lv.' + self.level); updateMoneyText(); } }; self.update = function () { self.timer++; if (self.timer >= 60) { // produce every second self.timer = 0; rawMaterials[self.type] += self.production; updateRawText(); } }; return self; }); // Store class: sells computer parts to customers var Store = Container.expand(function () { var self = Container.call(this); self.level = 1; self.sellSpeed = 1; // customers per 2s self.upgradeCost = 120; self.attachAsset('store', { anchorX: 0.5, anchorY: 0.5 }); // Level text var levelTxt = new Text2('Lv.' + self.level, { size: 40, fill: '#fff' }); levelTxt.anchor.set(0.5, 0); levelTxt.y = 90; self.addChild(levelTxt); self.upgrade = function () { if (money >= self.upgradeCost) { money -= self.upgradeCost; self.level += 1; self.sellSpeed += 1; self.upgradeCost = Math.floor(self.upgradeCost * 2.2); levelTxt.setText('Lv.' + self.level); updateMoneyText(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x181818 }); /**** * Game Code ****/ // Button // Customer // Factory, Store, Mine icons // Raw materials (3 types) // Computer parts (10 types) // --- Global State --- var partTypes = ['cpu', 'gpu', 'ram', 'ssd', 'psu', 'mb', 'case', 'fan', 'hdd', 'cooler']; var oreTypes = ['copper', 'silicon', 'iron']; // Inventory var rawMaterials = { copper: 10, silicon: 10, iron: 10 }; var parts = {}; for (var i = 0; i < partTypes.length; i++) parts[partTypes[i]] = 0; // Money var money = 100; // UI Texts var moneyTxt = new Text2('₺' + money, { size: 70, fill: '#fff' }); moneyTxt.anchor.set(0.5, 0); LK.gui.top.addChild(moneyTxt); function updateMoneyText() { moneyTxt.setText('₺' + money); } var rawTxt = new Text2('', { size: 40, fill: '#ffb' }); rawTxt.anchor.set(0.5, 0); rawTxt.y = 80; LK.gui.top.addChild(rawTxt); function updateRawText() { rawTxt.setText('Bakır: ' + rawMaterials.copper + ' Silikon: ' + rawMaterials.silicon + ' Demir: ' + rawMaterials.iron); } updateRawText(); var partsTxt = new Text2('', { size: 40, fill: '#bff' }); partsTxt.anchor.set(0.5, 0); partsTxt.y = 140; LK.gui.top.addChild(partsTxt); function updatePartsText() { var s = ''; for (var i = 0; i < partTypes.length; i++) { s += partTypes[i].toUpperCase() + ':' + parts[partTypes[i]] + ' '; } partsTxt.setText(s); } updatePartsText(); // --- Mines --- var mines = []; for (var i = 0; i < 3; i++) { var mine = new Mine(); mine.x = 300 + i * 350; mine.y = 600; mine.setType(oreTypes[i]); game.addChild(mine); mines.push(mine); } // --- Factory --- var factory = new Factory(); factory.x = 1024; factory.y = 1200; game.addChild(factory); // --- Store --- var store = new Store(); store.x = 1700; store.y = 600; game.addChild(store); // --- Upgrade Buttons --- var mineBtns = []; for (var i = 0; i < 3; i++) { var btn = LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5 }); btn.x = mines[i].x; btn.y = mines[i].y + 200; game.addChild(btn); var txt = new Text2('Maden Yükselt\n₺' + mines[i].upgradeCost, { size: 32, fill: '#fff' }); txt.anchor.set(0.5, 0.5); txt.y = btn.y - 30; txt.x = btn.x; game.addChild(txt); btn.mineIndex = i; btn.txt = txt; btn.down = function (x, y, obj) { var idx = this.mineIndex; var m = mines[idx]; if (money >= m.upgradeCost) { m.upgrade(); this.txt.setText('Maden Yükselt\n₺' + m.upgradeCost); } }; mineBtns.push(btn); } // Factory upgrade button var factoryBtn = LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5 }); factoryBtn.x = factory.x; factoryBtn.y = factory.y + 200; game.addChild(factoryBtn); var factoryBtnTxt = new Text2('Fabrika Yükselt\n₺' + factory.upgradeCost, { size: 32, fill: '#fff' }); factoryBtnTxt.anchor.set(0.5, 0.5); factoryBtnTxt.x = factoryBtn.x; factoryBtnTxt.y = factoryBtn.y - 30; game.addChild(factoryBtnTxt); factoryBtn.down = function (x, y, obj) { if (money >= factory.upgradeCost) { factory.upgrade(); factoryBtnTxt.setText('Fabrika Yükselt\n₺' + factory.upgradeCost); } }; // Store upgrade button var storeBtn = LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5 }); storeBtn.x = store.x; storeBtn.y = store.y + 200; game.addChild(storeBtn); var storeBtnTxt = new Text2('Mağaza Yükselt\n₺' + store.upgradeCost, { size: 32, fill: '#fff' }); storeBtnTxt.anchor.set(0.5, 0.5); storeBtnTxt.x = storeBtn.x; storeBtnTxt.y = storeBtn.y - 30; game.addChild(storeBtnTxt); storeBtn.down = function (x, y, obj) { if (money >= store.upgradeCost) { store.upgrade(); storeBtnTxt.setText('Mağaza Yükselt\n₺' + store.upgradeCost); } }; // --- Production Button --- var prodBtn = LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5 }); prodBtn.x = factory.x; prodBtn.y = factory.y + 350; game.addChild(prodBtn); var prodBtnTxt = new Text2('ÜRET', { size: 50, fill: '#fff' }); prodBtnTxt.anchor.set(0.5, 0.5); prodBtnTxt.x = prodBtn.x; prodBtnTxt.y = prodBtn.y; game.addChild(prodBtnTxt); // --- Production Logic --- prodBtn.down = function (x, y, obj) { // Try to produce as many as possible (one per click per level) var produced = 0; for (var i = 0; i < factory.production; i++) { // Pick a random part type var idx = Math.floor(Math.random() * partTypes.length); var part = partTypes[idx]; // Each part needs: copper:2, silicon:1, iron:1 if (rawMaterials.copper >= 2 && rawMaterials.silicon >= 1 && rawMaterials.iron >= 1) { rawMaterials.copper -= 2; rawMaterials.silicon -= 1; rawMaterials.iron -= 1; parts[part] += 1; produced++; } } if (produced > 0) { updateRawText(); updatePartsText(); // Animate factory tween(factory, { scaleX: 1.1, scaleY: 1.1 }, { duration: 120, easing: tween.easeOut, onFinish: function onFinish() { tween(factory, { scaleX: 1, scaleY: 1 }, { duration: 120 }); } }); } }; // --- Customer/Store Logic --- var customers = []; var customerTimer = 0; var customerInterval = 120; // 2s function spawnCustomer() { var c = new Customer(); c.x = store.x - 300; c.y = store.y + 120; // Pick a random part type to buy var idx = Math.floor(Math.random() * partTypes.length); var part = partTypes[idx]; c.setPart(part); c.partType = part; game.addChild(c); customers.push(c); // Animate customer moving to store tween(c, { x: store.x }, { duration: 600, easing: tween.cubicOut }); } function processCustomers() { for (var i = customers.length - 1; i >= 0; i--) { var c = customers[i]; // If at store, try to sell if (Math.abs(c.x - store.x) < 10) { var part = c.partType; if (parts[part] > 0) { parts[part] -= 1; var price = 30 + Math.floor(Math.random() * 20); money += price; updateMoneyText(); updatePartsText(); // Animate customer leaving tween(c, { x: store.x + 300 }, { duration: 400, onFinish: function onFinish() { c.destroy(); } }); customers.splice(i, 1); } } } } // --- Game Update --- game.update = function () { // Update mines for (var i = 0; i < mines.length; i++) { mines[i].update(); } // Customer spawn logic customerTimer++; if (customerTimer >= customerInterval / store.sellSpeed) { customerTimer = 0; spawnCustomer(); } processCustomers(); }; // --- Dragging (for fun, not required) --- var dragNode = null; game.down = function (x, y, obj) { // No drag for now }; game.move = function (x, y, obj) { // No drag for now }; game.up = function (x, y, obj) { // No drag for now };
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,437 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+// Customer class: comes to store and buys a part
+var Customer = Container.expand(function () {
+ var self = Container.call(this);
+ self.partType = null;
+ self.attachAsset('customer', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var partIcon = null;
+ self.setPart = function (type) {
+ self.partType = type;
+ if (partIcon) partIcon.destroy();
+ partIcon = self.attachAsset('part_' + type, {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ y: 60,
+ scaleX: 0.5,
+ scaleY: 0.5
+ });
+ };
+ return self;
+});
+// Factory class: produces computer parts from raw materials
+var Factory = Container.expand(function () {
+ var self = Container.call(this);
+ self.level = 1;
+ self.production = 1; // per click
+ self.upgradeCost = 100;
+ self.attachAsset('factory', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Level text
+ var levelTxt = new Text2('Lv.' + self.level, {
+ size: 40,
+ fill: '#fff'
+ });
+ levelTxt.anchor.set(0.5, 0);
+ levelTxt.y = 90;
+ self.addChild(levelTxt);
+ self.upgrade = function () {
+ if (money >= self.upgradeCost) {
+ money -= self.upgradeCost;
+ self.level += 1;
+ self.production += 1;
+ self.upgradeCost = Math.floor(self.upgradeCost * 2);
+ levelTxt.setText('Lv.' + self.level);
+ updateMoneyText();
+ }
+ };
+ return self;
+});
+// Mine class: produces raw materials over time
+var Mine = Container.expand(function () {
+ var self = Container.call(this);
+ self.level = 1;
+ self.type = 'copper'; // 'copper', 'silicon', 'iron'
+ self.production = 1; // per tick
+ self.timer = 0;
+ self.upgradeCost = 50;
+ self.attachAsset('mine', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Ore icon
+ var oreIcon = self.attachAsset('ore_' + self.type, {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ y: 60,
+ scaleX: 0.7,
+ scaleY: 0.7
+ });
+ // Level text
+ var levelTxt = new Text2('Lv.' + self.level, {
+ size: 40,
+ fill: '#fff'
+ });
+ levelTxt.anchor.set(0.5, 0);
+ levelTxt.y = 90;
+ self.addChild(levelTxt);
+ self.setType = function (type) {
+ self.type = type;
+ oreIcon.destroy();
+ var newOre = self.attachAsset('ore_' + type, {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ y: 60,
+ scaleX: 0.7,
+ scaleY: 0.7
+ });
+ };
+ self.upgrade = function () {
+ if (money >= self.upgradeCost) {
+ money -= self.upgradeCost;
+ self.level += 1;
+ self.production += 1;
+ self.upgradeCost = Math.floor(self.upgradeCost * 1.7);
+ levelTxt.setText('Lv.' + self.level);
+ updateMoneyText();
+ }
+ };
+ self.update = function () {
+ self.timer++;
+ if (self.timer >= 60) {
+ // produce every second
+ self.timer = 0;
+ rawMaterials[self.type] += self.production;
+ updateRawText();
+ }
+ };
+ return self;
+});
+// Store class: sells computer parts to customers
+var Store = Container.expand(function () {
+ var self = Container.call(this);
+ self.level = 1;
+ self.sellSpeed = 1; // customers per 2s
+ self.upgradeCost = 120;
+ self.attachAsset('store', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Level text
+ var levelTxt = new Text2('Lv.' + self.level, {
+ size: 40,
+ fill: '#fff'
+ });
+ levelTxt.anchor.set(0.5, 0);
+ levelTxt.y = 90;
+ self.addChild(levelTxt);
+ self.upgrade = function () {
+ if (money >= self.upgradeCost) {
+ money -= self.upgradeCost;
+ self.level += 1;
+ self.sellSpeed += 1;
+ self.upgradeCost = Math.floor(self.upgradeCost * 2.2);
+ levelTxt.setText('Lv.' + self.level);
+ updateMoneyText();
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x181818
+});
+
+/****
+* Game Code
+****/
+// Button
+// Customer
+// Factory, Store, Mine icons
+// Raw materials (3 types)
+// Computer parts (10 types)
+// --- Global State ---
+var partTypes = ['cpu', 'gpu', 'ram', 'ssd', 'psu', 'mb', 'case', 'fan', 'hdd', 'cooler'];
+var oreTypes = ['copper', 'silicon', 'iron'];
+// Inventory
+var rawMaterials = {
+ copper: 10,
+ silicon: 10,
+ iron: 10
+};
+var parts = {};
+for (var i = 0; i < partTypes.length; i++) parts[partTypes[i]] = 0;
+// Money
+var money = 100;
+// UI Texts
+var moneyTxt = new Text2('₺' + money, {
+ size: 70,
+ fill: '#fff'
+});
+moneyTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(moneyTxt);
+function updateMoneyText() {
+ moneyTxt.setText('₺' + money);
+}
+var rawTxt = new Text2('', {
+ size: 40,
+ fill: '#ffb'
+});
+rawTxt.anchor.set(0.5, 0);
+rawTxt.y = 80;
+LK.gui.top.addChild(rawTxt);
+function updateRawText() {
+ rawTxt.setText('Bakır: ' + rawMaterials.copper + ' Silikon: ' + rawMaterials.silicon + ' Demir: ' + rawMaterials.iron);
+}
+updateRawText();
+var partsTxt = new Text2('', {
+ size: 40,
+ fill: '#bff'
+});
+partsTxt.anchor.set(0.5, 0);
+partsTxt.y = 140;
+LK.gui.top.addChild(partsTxt);
+function updatePartsText() {
+ var s = '';
+ for (var i = 0; i < partTypes.length; i++) {
+ s += partTypes[i].toUpperCase() + ':' + parts[partTypes[i]] + ' ';
+ }
+ partsTxt.setText(s);
+}
+updatePartsText();
+// --- Mines ---
+var mines = [];
+for (var i = 0; i < 3; i++) {
+ var mine = new Mine();
+ mine.x = 300 + i * 350;
+ mine.y = 600;
+ mine.setType(oreTypes[i]);
+ game.addChild(mine);
+ mines.push(mine);
+}
+// --- Factory ---
+var factory = new Factory();
+factory.x = 1024;
+factory.y = 1200;
+game.addChild(factory);
+// --- Store ---
+var store = new Store();
+store.x = 1700;
+store.y = 600;
+game.addChild(store);
+// --- Upgrade Buttons ---
+var mineBtns = [];
+for (var i = 0; i < 3; i++) {
+ var btn = LK.getAsset('button', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ btn.x = mines[i].x;
+ btn.y = mines[i].y + 200;
+ game.addChild(btn);
+ var txt = new Text2('Maden Yükselt\n₺' + mines[i].upgradeCost, {
+ size: 32,
+ fill: '#fff'
+ });
+ txt.anchor.set(0.5, 0.5);
+ txt.y = btn.y - 30;
+ txt.x = btn.x;
+ game.addChild(txt);
+ btn.mineIndex = i;
+ btn.txt = txt;
+ btn.down = function (x, y, obj) {
+ var idx = this.mineIndex;
+ var m = mines[idx];
+ if (money >= m.upgradeCost) {
+ m.upgrade();
+ this.txt.setText('Maden Yükselt\n₺' + m.upgradeCost);
+ }
+ };
+ mineBtns.push(btn);
+}
+// Factory upgrade button
+var factoryBtn = LK.getAsset('button', {
+ anchorX: 0.5,
+ anchorY: 0.5
+});
+factoryBtn.x = factory.x;
+factoryBtn.y = factory.y + 200;
+game.addChild(factoryBtn);
+var factoryBtnTxt = new Text2('Fabrika Yükselt\n₺' + factory.upgradeCost, {
+ size: 32,
+ fill: '#fff'
+});
+factoryBtnTxt.anchor.set(0.5, 0.5);
+factoryBtnTxt.x = factoryBtn.x;
+factoryBtnTxt.y = factoryBtn.y - 30;
+game.addChild(factoryBtnTxt);
+factoryBtn.down = function (x, y, obj) {
+ if (money >= factory.upgradeCost) {
+ factory.upgrade();
+ factoryBtnTxt.setText('Fabrika Yükselt\n₺' + factory.upgradeCost);
+ }
+};
+// Store upgrade button
+var storeBtn = LK.getAsset('button', {
+ anchorX: 0.5,
+ anchorY: 0.5
+});
+storeBtn.x = store.x;
+storeBtn.y = store.y + 200;
+game.addChild(storeBtn);
+var storeBtnTxt = new Text2('Mağaza Yükselt\n₺' + store.upgradeCost, {
+ size: 32,
+ fill: '#fff'
+});
+storeBtnTxt.anchor.set(0.5, 0.5);
+storeBtnTxt.x = storeBtn.x;
+storeBtnTxt.y = storeBtn.y - 30;
+game.addChild(storeBtnTxt);
+storeBtn.down = function (x, y, obj) {
+ if (money >= store.upgradeCost) {
+ store.upgrade();
+ storeBtnTxt.setText('Mağaza Yükselt\n₺' + store.upgradeCost);
+ }
+};
+// --- Production Button ---
+var prodBtn = LK.getAsset('button', {
+ anchorX: 0.5,
+ anchorY: 0.5
+});
+prodBtn.x = factory.x;
+prodBtn.y = factory.y + 350;
+game.addChild(prodBtn);
+var prodBtnTxt = new Text2('ÜRET', {
+ size: 50,
+ fill: '#fff'
+});
+prodBtnTxt.anchor.set(0.5, 0.5);
+prodBtnTxt.x = prodBtn.x;
+prodBtnTxt.y = prodBtn.y;
+game.addChild(prodBtnTxt);
+// --- Production Logic ---
+prodBtn.down = function (x, y, obj) {
+ // Try to produce as many as possible (one per click per level)
+ var produced = 0;
+ for (var i = 0; i < factory.production; i++) {
+ // Pick a random part type
+ var idx = Math.floor(Math.random() * partTypes.length);
+ var part = partTypes[idx];
+ // Each part needs: copper:2, silicon:1, iron:1
+ if (rawMaterials.copper >= 2 && rawMaterials.silicon >= 1 && rawMaterials.iron >= 1) {
+ rawMaterials.copper -= 2;
+ rawMaterials.silicon -= 1;
+ rawMaterials.iron -= 1;
+ parts[part] += 1;
+ produced++;
+ }
+ }
+ if (produced > 0) {
+ updateRawText();
+ updatePartsText();
+ // Animate factory
+ tween(factory, {
+ scaleX: 1.1,
+ scaleY: 1.1
+ }, {
+ duration: 120,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(factory, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 120
+ });
+ }
+ });
+ }
+};
+// --- Customer/Store Logic ---
+var customers = [];
+var customerTimer = 0;
+var customerInterval = 120; // 2s
+function spawnCustomer() {
+ var c = new Customer();
+ c.x = store.x - 300;
+ c.y = store.y + 120;
+ // Pick a random part type to buy
+ var idx = Math.floor(Math.random() * partTypes.length);
+ var part = partTypes[idx];
+ c.setPart(part);
+ c.partType = part;
+ game.addChild(c);
+ customers.push(c);
+ // Animate customer moving to store
+ tween(c, {
+ x: store.x
+ }, {
+ duration: 600,
+ easing: tween.cubicOut
+ });
+}
+function processCustomers() {
+ for (var i = customers.length - 1; i >= 0; i--) {
+ var c = customers[i];
+ // If at store, try to sell
+ if (Math.abs(c.x - store.x) < 10) {
+ var part = c.partType;
+ if (parts[part] > 0) {
+ parts[part] -= 1;
+ var price = 30 + Math.floor(Math.random() * 20);
+ money += price;
+ updateMoneyText();
+ updatePartsText();
+ // Animate customer leaving
+ tween(c, {
+ x: store.x + 300
+ }, {
+ duration: 400,
+ onFinish: function onFinish() {
+ c.destroy();
+ }
+ });
+ customers.splice(i, 1);
+ }
+ }
+ }
+}
+// --- Game Update ---
+game.update = function () {
+ // Update mines
+ for (var i = 0; i < mines.length; i++) {
+ mines[i].update();
+ }
+ // Customer spawn logic
+ customerTimer++;
+ if (customerTimer >= customerInterval / store.sellSpeed) {
+ customerTimer = 0;
+ spawnCustomer();
+ }
+ processCustomers();
+};
+// --- Dragging (for fun, not required) ---
+var dragNode = null;
+game.down = function (x, y, obj) {
+ // No drag for now
+};
+game.move = function (x, y, obj) {
+ // No drag for now
+};
+game.up = function (x, y, obj) {
+ // No drag for now
+};
\ No newline at end of file
Factory. In-Game asset. 2d. High contrast. No shadows
Copper. In-Game asset. 2d. High contrast. No shadows
Müşteri. In-Game asset. 2d. High contrast. No shadows
Iron. In-Game asset. 2d. High contrast. No shadows
Silicon. In-Game asset. 2d. High contrast. No shadows
Store. In-Game asset. 2d. High contrast. No shadows
CPU. In-Game asset. 2d. High contrast. No shadows
PC Case. In-Game asset. 2d. High contrast. No shadows
PC GPU. In-Game asset. 2d. High contrast. No shadows
PC RAM. In-Game asset. 2d. High contrast. No shadows
PC Klavye. In-Game asset. 2d. High contrast. No shadows
PC Monitör. In-Game asset. 2d. High contrast. No shadows
City. In-Game asset. 2d. High contrast. No shadows
Bilgisayar teknikeri personel. In-Game asset. 2d. High contrast. No shadows
Mavi gömlekli bilgisayar teknikeri personeli. In-Game asset. 2d. High contrast. No shadows
Silver madeni. In-Game asset. 2d. High contrast. No shadows
Altın cevheri. In-Game asset. 2d. High contrast. No shadows
Nikel cevheri. In-Game asset. 2d. High contrast. No shadows
SSD bilgisayar Parçası. In-Game asset. 2d. High contrast. No shadows
PSU bilgisayar Parçası. In-Game asset. 2d. High contrast. No shadows
ANAKART Bilgisayar Parçası. In-Game asset. 2d. High contrast. No shadows
Maden girişi. In-Game asset. 2d. High contrast. No shadows
2000 sayısı ve Buy butonu. In-Game asset. 2d. High contrast. No shadows