User prompt
coin texturu ile fiyat sayısı arasındaki boşluğu 15 pixel arttır
User prompt
market fiyatlarında coin yazısı yerine coin texturunu koy ve sayının rengini biraz koyulaştır
User prompt
0.1 yani tek haneli küsürat olsun sanraki küsüratları yuvarla fiyatlarda
User prompt
oyunu optimize ve stabilize etmeyi dene şu anda yükleme ekranında kalıyor açılmıyor oyun. %60-70 civarında
User prompt
her şehir için ayrı market envanteri oluştur. ve her şehre rasgele eşya fiyatlandırma sistemi oluştur. mesela bazı şehirler elmayı %5 pahalıya satarken bazı şehirler tuzu %1 daha ucuza satsın ekonomi sistemindeki mevcut fiyatına göre şehrin ismine göre mantıklı fiyatlandırma koy. maximum %10 fark etmeli ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
satış modullerindeki item ismi textini %20 küçült
User prompt
satış modullerindeki fiyat textini 10 pixel aşşağı taşı
User prompt
market slotlarını ve market ismi text ini 60 pixel yukarı taşı
User prompt
market slotlarını birbirlerinden biraz daha uzaklaştır
User prompt
satış modüllerindeki item ismi ve fiyatları 20 pixel aşşağı taşı tüm modullerde ve boyutlarını 2 katına çıkar
User prompt
Move the top 3 market slots 30 pixels upward
User prompt
üsteli 3 market slotunu 40 pixel daha yukarı çıkar
User prompt
bazı texture boyutları ayarladım görünmez market slotlarının konumlarını buna göre tekrar ayarlayabilir misin
User prompt
görünmez slotları ve modüllerin boyutunu 2 katına çıkar ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'length')' in or related to this line: 'if (currentMap < 0 || currentMap >= slotProbabilityPools.length || !slotProbabilityPools[currentMap]) {' Line Number: 1972
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'length')' in or related to this line: 'if (currentMap < 0 || currentMap >= slotProbabilityPools.length || !slotProbabilityPools[currentMap]) {' Line Number: 1971
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'length')' in or related to this line: 'if (currentMap < 0 || currentMap >= slotProbabilityPools.length || !slotProbabilityPools[currentMap]) {' Line Number: 1971
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading '11')' in or related to this line: 'var probabilityPool = slotProbabilityPools[currentMap];' Line Number: 1971
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'length')' in or related to this line: 'for (var i = 0; i < marketSlots.length; i++) {' Line Number: 1962 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'length')' in or related to this line: 'for (var i = 0; i < marketSlots.length; i++) {' Line Number: 1962
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'length')' in or related to this line: 'for (var i = 0; i < marketSlots.length; i++) {' Line Number: 1962 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'length')' in or related to this line: 'for (var i = 0; i < marketSlots.length; i++) {' Line Number: 1960
User prompt
markete 6 slotluk bir sistem ekle görünmez olsun slotlar. slotlara koyulacak item modül sistemi yap. modülün mantığı: tradearea texturesi item çercevesi bu çerçevenin üst kısmına itemin texturesi texturenin altında itemin ismi ve en alt kısmında economy sisteminden gelen itemin o anki değeri yazacak şimdilik. 2 modül yap şimdilik 2 eşyanız var salt ve apple. elma ve salt texturelerini kullan . modüller çok iyi oluşturulmalı ki daha sonra bu modüller üzerinden işlemler yapabilelim. daha önce eklediğin 6 slotluk sistemde her slot için bir olasılık havuzu hazırla. şimdilik %60 boş %25 apple modülü %15 salt modülü gelecek her 3000 pixel hareketimizde herangi bir şehrin slotlarındaki modüller %10 şansla yenilenebilir . o modüle tıkladığımızda eğer yeterli paramız varsa modülde gösterilen eşyayı satın alırız ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Error: Invalid value. Only literals or 1-level deep objects/arrays containing literals are allowed.' in or related to this line: 'storage.economyData = economyData;' Line Number: 1978 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
arkaplanda çalışan ekonomi sistemi ekle ileride markete kuracağımız sistem buradan veri çekecek. şimdilik 2 eşyamıs var tuz ve elma. tuz temel fiyatı 2000 ve her hareket ettiğimiz 5000 pixelde bir %50 şansla fiyatı ya %7 artacak ya da %6 azalacak. elma da temel fiyatı 10 olacak her hareket ettiğimiz 500 pixelde %50 ihtimalle fiyatı ya 1 azalacak ya da 1 artacak. elma fiyatında sınır olsun 5 ten düşük 25 den büyük olamaz elma. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var CenterMarker = Container.expand(function () { var self = Container.call(this); var markerGraphics = self.attachAsset('centerMarker', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Character = Container.expand(function () { var self = Container.call(this); var characterGraphics = self.attachAsset('character', { anchorX: 0.5, anchorY: 0.5 }); self.isMoving = false; self.targetX = 0; self.targetY = 0; self.speed = 3; self.lastX = 0; // Track last X position for direction detection self.moveTo = function (x, y) { self.targetX = x; self.targetY = y; self.isMoving = true; }; self.update = function () { if (self.isMoving) { var dx = self.targetX - self.x; var dy = self.targetY - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < self.speed) { self.x = self.targetX; self.y = self.targetY; self.isMoving = false; } else { // Store current X before updating var currentX = self.x; self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; // Check direction change and flip character accordingly if (self.x > currentX) { // Moving right - face right (normal) characterGraphics.scale.x = Math.abs(characterGraphics.scale.x); } else if (self.x < currentX) { // Moving left - face left (flipped) characterGraphics.scale.x = -Math.abs(characterGraphics.scale.x); } } } }; return self; }); var City = Container.expand(function () { var self = Container.call(this); var cityGraphics = self.attachAsset('city', { anchorX: 0.5, anchorY: 0.5 }); cityGraphics.y = -60; // Move graphics up by 60 pixels return self; }); var Mountain = Container.expand(function () { var self = Container.call(this); var mountainGraphics = self.attachAsset('mountain', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Passage = Container.expand(function () { var self = Container.call(this); var passageGraphics = self.attachAsset('passage', { anchorX: 0.5, anchorY: 0.5 }); self.targetMap = 0; self.targetX = 0; self.targetY = 0; return self; }); var Road = Container.expand(function () { var self = Container.call(this); var roadGraphics = self.attachAsset('road', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var TradeSlot = Container.expand(function () { var self = Container.call(this); // Slot properties self.item = null; // 'salt', 'apple', or null for empty self.price = 0; // Create slot background (tradearea) var slotBg = self.attachAsset('tradearea', { anchorX: 0.5, anchorY: 0.5 }); // Item icon (initially invisible) var itemIcon = null; // Item name text var itemNameText = new Text2('', { size: 24, fill: 0xFFFFFF }); itemNameText.anchor.set(0.5, 0.5); itemNameText.x = 0; itemNameText.y = 30; self.addChild(itemNameText); // Item price text var itemPriceText = new Text2('', { size: 20, fill: 0xFFD700 }); itemPriceText.anchor.set(0.5, 0.5); itemPriceText.x = 0; itemPriceText.y = 50; self.addChild(itemPriceText); // Method to set item self.setItem = function (itemType) { // Clear existing item icon if (itemIcon) { self.removeChild(itemIcon); itemIcon = null; } self.item = itemType; if (itemType === 'salt') { itemIcon = LK.getAsset('salt', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 2 }); itemIcon.x = 0; itemIcon.y = -20; self.addChild(itemIcon); itemNameText.setText('Salt'); self.price = Math.round(saltCurrentPrice); itemPriceText.setText(self.price + ' Gold'); } else if (itemType === 'apple') { itemIcon = LK.getAsset('elma', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 2 }); itemIcon.x = 0; itemIcon.y = -20; self.addChild(itemIcon); itemNameText.setText('Apple'); self.price = appleCurrentPrice; itemPriceText.setText(self.price + ' Gold'); } else { // Empty slot itemNameText.setText(''); itemPriceText.setText(''); self.price = 0; } }; // Handle slot click self.down = function (x, y, obj) { if (self.item && playerGold >= self.price) { // Purchase item playerGold -= self.price; updateGoldDisplay(); // Flash effect on purchase LK.effects.flashObject(self, 0x00FF00, 500); // Clear the slot after purchase self.setItem(null); } else if (self.item && playerGold < self.price) { // Not enough gold - flash red LK.effects.flashObject(self, 0xFF0000, 500); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x228b22 }); /**** * Game Code ****/ var currentMap = storage.currentMap || 0; var character = game.addChild(new Character()); var roads = []; var mountains = []; var passages = []; var centerMarker = null; var city = null; // Gold system variables var playerGold = storage.playerGold || 100; var goldIcon = null; var goldText = null; // Economy system variables - flattened for storage compatibility var saltBasePrice = 2000; var saltCurrentPrice = storage.saltCurrentPrice || 2000; var appleBasePrice = 10; var appleCurrentPrice = storage.appleCurrentPrice || 10; // Movement tracking for economy var lastPlayerX = 0; var lastPlayerY = 0; var totalMovementDistance = storage.totalMovementDistance || 0; var lastSaltPriceUpdate = storage.lastSaltPriceUpdate || 0; var lastApplePriceUpdate = storage.lastApplePriceUpdate || 0; // Map data - 12 interconnected maps var mapData = [ // Map 0 { roads: [{ x: 200, y: 400 }, { x: 300, y: 400 }, { x: 400, y: 400 }, { x: 500, y: 400 }, { x: 600, y: 400 }, { x: 700, y: 400 }, { x: 800, y: 500 }, { x: 900, y: 600 }, { x: 1000, y: 700 }, { x: 1100, y: 800 }, { x: 1200, y: 900 }, { x: 1300, y: 1000 }, { x: 1400, y: 1100 }, { x: 1500, y: 1200 }, { x: 1600, y: 1300 }, { x: 1700, y: 1400 }, { x: 1800, y: 1500 }, { x: 1900, y: 1500 }, { x: 2000, y: 1500 }, { x: 1800, y: 1600 }, { x: 1800, y: 1700 }, { x: 1800, y: 1800 }, { x: 1800, y: 1900 }, { x: 1800, y: 2000 }, { x: 1800, y: 2100 }, { x: 1800, y: 2200 }, { x: 1800, y: 2300 }, { x: 1800, y: 2400 }, { x: 1800, y: 2500 }, { x: 1800, y: 2600 }, { x: 1800, y: 2700 }], mountains: [{ x: 150, y: 200 }, { x: 250, y: 150 }, { x: 350, y: 180 }, { x: 450, y: 220 }, { x: 550, y: 180 }, { x: 650, y: 200 }, { x: 750, y: 250 }, { x: 850, y: 300 }, { x: 950, y: 350 }, { x: 1050, y: 400 }, { x: 1150, y: 450 }, { x: 1250, y: 500 }, { x: 1350, y: 550 }, { x: 1450, y: 600 }, { x: 1550, y: 650 }, { x: 1650, y: 700 }], passages: [{ x: 2000, y: 1500, targetMap: 1, targetX: 100, targetY: 1500 }, { x: 1800, y: 2700, targetMap: 3, targetX: 1800, targetY: 100 }], startX: 200, startY: 400 }, // Map 1 { roads: [{ x: 100, y: 1500 }, { x: 200, y: 1500 }, { x: 300, y: 1500 }, { x: 400, y: 1400 }, { x: 500, y: 1300 }, { x: 600, y: 1200 }, { x: 700, y: 1100 }, { x: 800, y: 1000 }, { x: 900, y: 900 }, { x: 1000, y: 800 }, { x: 1100, y: 700 }, { x: 1200, y: 600 }, { x: 1300, y: 500 }, { x: 1400, y: 400 }, { x: 1500, y: 300 }, { x: 1600, y: 200 }, { x: 48, y: 1500 }, { x: 1600, y: 150 }, { x: 1600, y: 100 }, { x: 1600, y: 48 }], mountains: [{ x: 200, y: 1700 }, { x: 300, y: 1800 }, { x: 400, y: 1700 }, { x: 500, y: 1600 }, { x: 600, y: 1500 }, { x: 700, y: 1400 }, { x: 800, y: 1300 }, { x: 900, y: 1200 }, { x: 1000, y: 1100 }, { x: 1100, y: 1000 }, { x: 1200, y: 900 }, { x: 1300, y: 800 }], passages: [{ x: 100, y: 1500, targetMap: 0, targetX: 2000, targetY: 1500 }, { x: 1600, y: 100, targetMap: 2, targetX: 1600, targetY: 2700 }], startX: 100, startY: 1500 }, // Map 2 { roads: [{ x: 1600, y: 2700 }, { x: 1600, y: 2600 }, { x: 1600, y: 2500 }, { x: 1600, y: 2400 }, { x: 1600, y: 2300 }, { x: 1600, y: 2200 }, { x: 1600, y: 2100 }, { x: 1600, y: 2000 }, { x: 1600, y: 1900 }, { x: 1600, y: 1800 }, { x: 1600, y: 1700 }, { x: 1600, y: 1600 }, { x: 1600, y: 1500 }, { x: 1600, y: 1400 }, { x: 1600, y: 1300 }, { x: 1600, y: 1200 }], mountains: [{ x: 1400, y: 2600 }, { x: 1500, y: 2500 }, { x: 1700, y: 2500 }, { x: 1800, y: 2600 }, { x: 1400, y: 2400 }, { x: 1800, y: 2400 }, { x: 1400, y: 2200 }, { x: 1800, y: 2200 }, { x: 1400, y: 2000 }, { x: 1800, y: 2000 }, { x: 1400, y: 1800 }, { x: 1800, y: 1800 }], passages: [{ x: 1600, y: 2700, targetMap: 1, targetX: 1600, targetY: 100 }, { x: 1600, y: 1200, targetMap: 4, targetX: 1600, targetY: 2350 }], startX: 1600, startY: 2700 }, // Map 3 { roads: [{ x: 1800, y: 100 }, { x: 1700, y: 200 }, { x: 1600, y: 300 }, { x: 1500, y: 400 }, { x: 1400, y: 500 }, { x: 1300, y: 600 }, { x: 1200, y: 700 }, { x: 1100, y: 800 }, { x: 1000, y: 900 }, { x: 900, y: 1000 }, { x: 800, y: 1100 }, { x: 700, y: 1200 }, { x: 600, y: 1300 }, { x: 500, y: 1400 }, { x: 400, y: 1500 }, { x: 300, y: 1600 }, { x: 1800, y: 48 }, { x: 250, y: 1600 }, { x: 200, y: 1600 }], mountains: [{ x: 1900, y: 200 }, { x: 1800, y: 300 }, { x: 1700, y: 400 }, { x: 1600, y: 500 }, { x: 1500, y: 600 }, { x: 1400, y: 700 }, { x: 1300, y: 800 }, { x: 1200, y: 900 }, { x: 1100, y: 1000 }, { x: 1000, y: 1100 }, { x: 900, y: 1200 }, { x: 800, y: 1300 }], passages: [{ x: 1800, y: 100, targetMap: 0, targetX: 1800, targetY: 2700 }, { x: 200, y: 1600, targetMap: 5, targetX: 1900, targetY: 1600 }], startX: 1800, startY: 100 }, // Map 4 { roads: [{ x: 1600, y: 2350 }, { x: 1500, y: 2250 }, { x: 1400, y: 2150 }, { x: 1300, y: 2050 }, { x: 1200, y: 1950 }, { x: 1100, y: 1850 }, { x: 1000, y: 1750 }, { x: 900, y: 1650 }, { x: 800, y: 1550 }, { x: 700, y: 1450 }, { x: 600, y: 1350 }, { x: 500, y: 1250 }], mountains: [{ x: 1700, y: 2700 }, { x: 1600, y: 2800 }, { x: 1500, y: 2700 }, { x: 1400, y: 2600 }, { x: 1300, y: 2500 }, { x: 1200, y: 2400 }, { x: 1100, y: 2300 }, { x: 1000, y: 2200 }], passages: [{ x: 1600, y: 2350, targetMap: 2, targetX: 1600, targetY: 1200 }, { x: 500, y: 1250, targetMap: 6, targetX: 1800, targetY: 1500 }], startX: 1600, startY: 2350 }, // Map 5 { roads: [{ x: 1900, y: 1600 }, { x: 1800, y: 1600 }, { x: 1700, y: 1600 }, { x: 1600, y: 1600 }, { x: 1500, y: 1600 }, { x: 1400, y: 1600 }, { x: 1300, y: 1600 }, { x: 1200, y: 1600 }, { x: 1100, y: 1600 }, { x: 1000, y: 1600 }, { x: 900, y: 1600 }, { x: 800, y: 1600 }, { x: 750, y: 1600 }, { x: 700, y: 1600 }, { x: 1950, y: 1600 }, { x: 2000, y: 1600 }], mountains: [{ x: 1900, y: 1400 }, { x: 1800, y: 1400 }, { x: 1900, y: 1800 }, { x: 1800, y: 1800 }, { x: 1700, y: 1400 }, { x: 1600, y: 1400 }, { x: 1700, y: 1800 }, { x: 1600, y: 1800 }], passages: [{ x: 2000, y: 1600, targetMap: 3, targetX: 200, targetY: 1600 }, { x: 700, y: 1600, targetMap: 7, targetX: 1400, targetY: 1600 }], startX: 1900, startY: 1600 }, // Map 6 { roads: [{ x: 1800, y: 1500 }, { x: 1700, y: 1400 }, { x: 1600, y: 1300 }, { x: 1500, y: 1200 }, { x: 1400, y: 1100 }, { x: 1300, y: 1000 }, { x: 1200, y: 900 }, { x: 1100, y: 800 }, { x: 1000, y: 700 }, { x: 900, y: 600 }, { x: 800, y: 500 }, { x: 700, y: 400 }, { x: 1850, y: 1500 }, { x: 1900, y: 1500 }, { x: 1950, y: 1500 }, { x: 2000, y: 1500 }, { x: 650, y: 400 }, { x: 600, y: 400 }], mountains: [{ x: 1900, y: 1600 }, { x: 1800, y: 1700 }, { x: 1700, y: 1600 }, { x: 1600, y: 1500 }, { x: 1500, y: 1400 }, { x: 1400, y: 1300 }, { x: 1300, y: 1200 }, { x: 1200, y: 1100 }], passages: [{ x: 2000, y: 1500, targetMap: 4, targetX: 500, targetY: 1250 }, { x: 600, y: 400, targetMap: 8, targetX: 1500, targetY: 2300 }], startX: 1800, startY: 1500 }, // Map 7 { roads: [{ x: 1400, y: 1600 }, { x: 1300, y: 1500 }, { x: 1200, y: 1400 }, { x: 1100, y: 1300 }, { x: 1000, y: 1200 }, { x: 900, y: 1100 }, { x: 800, y: 1000 }, { x: 700, y: 900 }, { x: 600, y: 800 }, { x: 500, y: 700 }, { x: 400, y: 600 }, { x: 300, y: 500 }, { x: 1450, y: 1600 }, { x: 1500, y: 1600 }, { x: 250, y: 500 }, { x: 200, y: 500 }], mountains: [{ x: 1500, y: 1700 }, { x: 1400, y: 1800 }, { x: 1300, y: 1700 }, { x: 1200, y: 1600 }, { x: 1100, y: 1500 }, { x: 1000, y: 1400 }, { x: 900, y: 1300 }, { x: 800, y: 1200 }], passages: [{ x: 1500, y: 1600, targetMap: 5, targetX: 700, targetY: 1600 }, { x: 200, y: 500, targetMap: 9, targetX: 1800, targetY: 500 }], startX: 1400, startY: 1600 }, // Map 8 { roads: [{ x: 1500, y: 2300 }, { x: 1400, y: 2200 }, { x: 1300, y: 2100 }, { x: 1200, y: 2000 }, { x: 1100, y: 1900 }, { x: 1000, y: 1800 }, { x: 900, y: 1700 }, { x: 800, y: 1600 }, { x: 700, y: 1500 }, { x: 600, y: 1400 }, { x: 500, y: 1300 }, { x: 400, y: 1200 }, { x: 1500, y: 2400 }, { x: 1500, y: 2500 }, { x: 1500, y: 2600 }, { x: 1500, y: 2700 }, { x: 1500, y: 2732 }, { x: 350, y: 1200 }, { x: 300, y: 1200 }], mountains: [{ x: 1600, y: 2400 }, { x: 1500, y: 2500 }, { x: 1400, y: 2400 }, { x: 1300, y: 2300 }, { x: 1200, y: 2200 }, { x: 1100, y: 2100 }, { x: 1000, y: 2000 }, { x: 900, y: 1900 }], passages: [{ x: 1500, y: 2700, targetMap: 6, targetX: 600, targetY: 400 }, { x: 300, y: 1200, targetMap: 10, targetX: 1700, targetY: 1200 }], startX: 1500, startY: 2300 }, // Map 9 { roads: [{ x: 1800, y: 500 }, { x: 1700, y: 600 }, { x: 1600, y: 700 }, { x: 1500, y: 800 }, { x: 1400, y: 900 }, { x: 1300, y: 1000 }, { x: 1200, y: 1100 }, { x: 1100, y: 1200 }, { x: 1000, y: 1300 }, { x: 900, y: 1400 }, { x: 800, y: 1500 }, { x: 700, y: 1600 }, { x: 1850, y: 500 }, { x: 1900, y: 500 }, { x: 1950, y: 500 }, { x: 2000, y: 500 }, { x: 900, y: 1300 }, { x: 800, y: 1300 }, { x: 700, y: 1300 }, { x: 600, y: 1300 }, { x: 550, y: 1300 }, { x: 500, y: 1300 }], mountains: [{ x: 1900, y: 400 }, { x: 1800, y: 300 }, { x: 1700, y: 400 }, { x: 1600, y: 500 }, { x: 1500, y: 600 }, { x: 1400, y: 700 }, { x: 1300, y: 800 }, { x: 1200, y: 900 }], passages: [{ x: 2000, y: 500, targetMap: 7, targetX: 200, targetY: 500 }, { x: 500, y: 1300, targetMap: 11, targetX: 1500, targetY: 800 }], startX: 1800, startY: 500 }, // Map 10 { roads: [{ x: 1700, y: 1200 }, { x: 1600, y: 1100 }, { x: 1500, y: 1000 }, { x: 1400, y: 900 }, { x: 1300, y: 800 }, { x: 1200, y: 700 }, { x: 1100, y: 600 }, { x: 1000, y: 500 }, { x: 900, y: 400 }, { x: 800, y: 300 }, { x: 700, y: 200 }, { x: 600, y: 100 }, { x: 1750, y: 1200 }, { x: 1800, y: 1200 }, { x: 600, y: 75 }, { x: 600, y: 48 }], mountains: [{ x: 1800, y: 1300 }, { x: 1700, y: 1400 }, { x: 1600, y: 1300 }, { x: 1500, y: 1200 }, { x: 1400, y: 1100 }, { x: 1300, y: 1000 }, { x: 1200, y: 900 }, { x: 1100, y: 800 }], passages: [{ x: 1795, y: 1260, targetMap: 8, targetX: 300, targetY: 1200 }, { x: 600, y: 100, targetMap: 11, targetX: 600, targetY: 2700 }], startX: 1700, startY: 1200 }, // Map 11 { roads: [{ x: 1500, y: 800 }, { x: 1400, y: 900 }, { x: 1300, y: 1000 }, { x: 1200, y: 1100 }, { x: 1100, y: 1200 }, { x: 1000, y: 1300 }, { x: 900, y: 1400 }, { x: 800, y: 1500 }, { x: 700, y: 1600 }, { x: 600, y: 1700 }, { x: 600, y: 1800 }, { x: 600, y: 1900 }, { x: 600, y: 2000 }, { x: 600, y: 2100 }, { x: 600, y: 2200 }, { x: 600, y: 2300 }, { x: 600, y: 2400 }, { x: 600, y: 2500 }, { x: 600, y: 2600 }, { x: 1500, y: 750 }, { x: 1500, y: 700 }, { x: 600, y: 2650 }, { x: 600, y: 2700 }, { x: 600, y: 2732 }], mountains: [{ x: 1600, y: 700 }, { x: 1500, y: 600 }, { x: 1400, y: 700 }, { x: 1300, y: 800 }, { x: 1200, y: 900 }, { x: 1100, y: 1000 }, { x: 1000, y: 1100 }, { x: 900, y: 1200 }, { x: 500, y: 1700 }, { x: 700, y: 1700 }, { x: 500, y: 1900 }, { x: 700, y: 1900 }], passages: [{ x: 1500, y: 700, targetMap: 9, targetX: 600, targetY: 1600 }, { x: 600, y: 2700, targetMap: 10, targetX: 600, targetY: 100 }], startX: 1500, startY: 800 }]; var arBackground = null; function loadMap(mapIndex) { // Clear existing elements for (var i = 0; i < roads.length; i++) { roads[i].destroy(); } // Mountain cleanup removed for (var i = 0; i < passages.length; i++) { passages[i].destroy(); } // Clean up existing center marker if (centerMarker) { centerMarker.destroy(); centerMarker = null; } // Clean up existing city marker if (city) { city.destroy(); city = null; } // Clean up existing AR background if (arBackground) { arBackground.destroy(); arBackground = null; } roads = []; mountains = []; passages = []; var map = mapData[mapIndex]; // Add AR background only for Ancient Ruins (map 6) if (mapIndex === 6) { arBackground = game.addChild(LK.getAsset('AR', { anchorX: 0.5, anchorY: 0.5, scaleX: 1, scaleY: 1, x: 1024, y: 1366 })); } // Add CP background only for Central Plains (map 4) if (mapIndex === 4) { arBackground = game.addChild(LK.getAsset('CP', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 2, x: 1024, y: 1366 })); } // Add SR background only for Southern Ridge (map 2) if (mapIndex === 2) { arBackground = game.addChild(LK.getAsset('Sr', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 2, x: 1024, y: 1366 })); } // Add EV background only for Eastern Valleys (map 1) if (mapIndex === 1) { arBackground = game.addChild(LK.getAsset('Ev', { anchorX: 0.5, anchorY: 0.5, scaleX: 5, scaleY: 7, x: 1024, y: 1366 })); } // Add NH background only for Northern Highlands (map 0) if (mapIndex === 0) { arBackground = game.addChild(LK.getAsset('Nh', { anchorX: 0.5, anchorY: 0.5, scaleX: 5, scaleY: 7, x: 1024, y: 1366 })); } // Add WP background only for Western Peaks (map 3) if (mapIndex === 3) { arBackground = game.addChild(LK.getAsset('wp', { anchorX: 0.5, anchorY: 0.5, scaleX: 7, scaleY: 9, x: 1024, y: 1366 })); } // Add MW background only for Mystic Woods (map 5) if (mapIndex === 5) { arBackground = game.addChild(LK.getAsset('mw', { anchorX: 0.5, anchorY: 0.5, scaleX: 5, scaleY: 7, x: 1024, y: 1366 })); } // Add DS background only for Desert Sands (map 7) if (mapIndex === 7) { arBackground = game.addChild(LK.getAsset('ds', { anchorX: 0.5, anchorY: 0.5, scaleX: 5, scaleY: 7, x: 1024, y: 1366 })); } // Add CC background only for Coastal Cliffs (map 9) if (mapIndex === 9) { arBackground = game.addChild(LK.getAsset('cc', { anchorX: 0.5, anchorY: 0.5, scaleX: 5, scaleY: 5, x: 1024, y: 1366 })); } // Add SG background only for Sacred Grove (map 11) if (mapIndex === 11) { arBackground = game.addChild(LK.getAsset('sg', { anchorX: 0.5, anchorY: 0.5, scaleX: 5, scaleY: 7, x: 1024, y: 1366 })); } // Add MP background only for Mountain Pass (map 10) if (mapIndex === 10) { arBackground = game.addChild(LK.getAsset('mp', { anchorX: 0.5, anchorY: 0.5, scaleX: 5, scaleY: 5, x: 1024, y: 1366 })); } // Add FW background only for Frozen Wastes (map 8) if (mapIndex === 8) { arBackground = game.addChild(LK.getAsset('fw', { anchorX: 0.5, anchorY: 0.5, scaleX: 5, scaleY: 5, x: 1024, y: 1366 })); } // Create roads for (var i = 0; i < map.roads.length; i++) { var road = game.addChild(new Road()); road.x = map.roads[i].x; road.y = map.roads[i].y; roads.push(road); } // Mountains removed from display // Create passages for (var i = 0; i < map.passages.length; i++) { var passage = game.addChild(new Passage()); passage.x = map.passages[i].x; passage.y = map.passages[i].y; passage.targetMap = map.passages[i].targetMap; passage.targetX = map.passages[i].targetX; passage.targetY = map.passages[i].targetY; passages.push(passage); } // Set character position if (character.x === 0 && character.y === 0) { character.x = map.startX; character.y = map.startY; } // Find and mark the center road point var centerRoad = findCenterRoad(); if (centerRoad) { centerMarker = game.addChild(new CenterMarker()); centerMarker.x = centerRoad.x; centerMarker.y = centerRoad.y; } // Add city marker at calculated position var cityPosition = findCityPosition(); city = game.addChild(new City()); city.x = cityPosition.x; city.y = cityPosition.y; // Create connecting road between center marker and city if (centerMarker && city) { var connectionRoads = createConnectionRoad(centerMarker.x, centerMarker.y, city.x, city.y); for (var i = 0; i < connectionRoads.length; i++) { roads.push(connectionRoads[i]); } } // Bring city to front so it appears above roads if (city) { game.removeChild(city); game.addChild(city); } // Bring character to front so it appears above roads game.removeChild(character); game.addChild(character); // Reset city visit tracking for new map hasVisitedCity = false; lastCityDistance = Infinity; if (isMarketOpen) { closeMarketScreen(); } // Generate new market slots for this map generateMarketSlots(); } function findNearestRoad(x, y) { var nearestRoad = null; var minDistance = Infinity; for (var i = 0; i < roads.length; i++) { var road = roads[i]; var dx = x - road.x; var dy = y - road.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < minDistance) { minDistance = distance; nearestRoad = road; } } return nearestRoad; } function findCityPosition() { var centerX = 1024; // Screen center X var centerY = 1366; // Screen center Y var mirrorPoints = []; var map = mapData[currentMap]; // Calculate mirror coordinates for each passage for (var i = 0; i < map.passages.length; i++) { var passage = map.passages[i]; var mirrorX = 2 * centerX - passage.x; var mirrorY = 2 * centerY - passage.y; mirrorPoints.push({ x: mirrorX, y: mirrorY }); } // Find the center of all mirror points if (mirrorPoints.length === 0) { return { x: centerX, y: centerY }; // Default to screen center if no passages } var totalX = 0; var totalY = 0; for (var i = 0; i < mirrorPoints.length; i++) { totalX += mirrorPoints[i].x; totalY += mirrorPoints[i].y; } return { x: totalX / mirrorPoints.length, y: totalY / mirrorPoints.length }; } function createConnectionRoad(startX, startY, endX, endY) { var connectionRoads = []; var dx = endX - startX; var dy = endY - startY; var distance = Math.sqrt(dx * dx + dy * dy); var steps = Math.floor(distance / 100); // Create road points every 100 pixels for (var i = 1; i <= steps; i++) { var progress = i / (steps + 1); var roadX = startX + dx * progress; var roadY = startY + dy * progress; var road = game.addChild(new Road()); road.x = roadX; road.y = roadY; connectionRoads.push(road); } return connectionRoads; } function findCenterRoad() { var centerX = 1024; // Screen center X var centerY = 1366; // Screen center Y var centerRoad = null; var minDistance = Infinity; for (var i = 0; i < roads.length; i++) { var road = roads[i]; var dx = centerX - road.x; var dy = centerY - road.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < minDistance) { minDistance = distance; centerRoad = road; } } return centerRoad; } function checkPassageCollision() { for (var i = 0; i < passages.length; i++) { var passage = passages[i]; var dx = character.x - passage.x; var dy = character.y - passage.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 80) { currentMap = passage.targetMap; storage.currentMap = currentMap; loadMap(currentMap); // Find the 4th nearest road point to the target passage var targetPassageX = passage.targetX; var targetPassageY = passage.targetY; var roadDistances = []; // Calculate distances from target passage to all roads for (var j = 0; j < roads.length; j++) { var road = roads[j]; var rdx = targetPassageX - road.x; var rdy = targetPassageY - road.y; var roadDistance = Math.sqrt(rdx * rdx + rdy * rdy); roadDistances.push({ road: road, distance: roadDistance }); } // Sort roads by distance roadDistances.sort(function (a, b) { return a.distance - b.distance; }); // Get the 4th nearest road (index 3), or closest available if less than 4 roads var targetRoadIndex = Math.min(3, roadDistances.length - 1); // Special case for Western Peaks left passage teleportation - use 5th nearest road for better positioning if (currentMap === 5 && passage.targetX === 1900 && passage.targetY === 1600) { targetRoadIndex = Math.min(4, roadDistances.length - 1); } // Special case for Sacred Grove to Coastal Cliffs teleportation - use 3rd nearest road if (currentMap === 9 && passage.targetX === 600 && passage.targetY === 1600) { targetRoadIndex = Math.min(2, roadDistances.length - 1); } var targetRoad = roadDistances[targetRoadIndex].road; character.x = targetRoad.x; character.y = targetRoad.y; character.isMoving = false; break; } } } // Initialize first map loadMap(currentMap); // Bring character to front so it appears above roads game.removeChild(character); game.addChild(character); // Initialize economy system tracking lastPlayerX = character.x; lastPlayerY = character.y; // Initialize market slots array to prevent undefined errors generateMarketSlots(); // Region names for each map var regionNames = ['Northern Highlands', 'Eastern Valleys', 'Southern Ridge', 'Western Peaks', 'Central Plains', 'Mystic Woods', 'Ancient Ruins', 'Desert Sands', 'Frozen Wastes', 'Coastal Cliffs', 'Mountain Pass', 'Sacred Grove']; // Map info display var mapText = new Text2(regionNames[currentMap], { size: 60, fill: 0xFFFFFF }); mapText.anchor.set(1, 1); LK.gui.bottomRight.addChild(mapText); // Gold display setup goldIcon = LK.getAsset('gold', { anchorX: 0, anchorY: 0, scaleX: 1.6, scaleY: 1.6 }); goldIcon.x = 120; goldIcon.y = 20; LK.gui.topLeft.addChild(goldIcon); goldText = new Text2(playerGold.toString(), { size: 96, fill: 0xFFD700 }); goldText.anchor.set(0, 0); goldText.x = 280; goldText.y = 50; LK.gui.topLeft.addChild(goldText); // City market UI variables var marketScreen = null; var marketTitle = null; var closeButton = null; var isMarketOpen = false; var lastCityDistance = Infinity; var hasVisitedCity = false; // Market slot system variables var marketSlots = []; var lastSlotRefreshDistance = storage.lastSlotRefreshDistance || 0; // Slot probability pools for each city var slotProbabilityPools = [ // Map 0 - Northern Highlands [null, null, null, null, null, null, 'apple', 'apple', 'apple', 'salt'], // 60% empty, 25% apple, 15% salt // Map 1 - Eastern Valleys [null, null, null, null, null, null, 'apple', 'apple', 'apple', 'salt'], // Map 2 - Southern Ridge [null, null, null, null, null, null, 'apple', 'apple', 'apple', 'salt'], // Map 3 - Western Peaks [null, null, null, null, null, null, 'apple', 'apple', 'apple', 'salt'], // Map 4 - Central Plains [null, null, null, null, null, null, 'apple', 'apple', 'apple', 'salt'], // Map 5 - Mystic Woods [null, null, null, null, null, null, 'apple', 'apple', 'apple', 'salt'], // Map 6 - Ancient Ruins [null, null, null, null, null, null, 'apple', 'apple', 'apple', 'salt'], // Map 7 - Desert Sands [null, null, null, null, null, null, 'apple', 'apple', 'apple', 'salt'], // Map 8 - Frozen Wastes [null, null, null, null, null, null, 'apple', 'apple', 'apple', 'salt'], // Map 9 - Coastal Cliffs [null, null, null, null, null, null, 'apple', 'apple', 'apple', 'salt'], // Map 10 - Mountain Pass [null, null, null, null, null, null, 'apple', 'apple', 'apple', 'salt'], // Map 11 - Sacred Grove [null, null, null, null, null, null, 'apple', 'apple', 'apple', 'salt']]; function generateMarketSlots() { // Clear existing slots for (var i = 0; i < marketSlots.length; i++) { if (marketSlots[i] && marketSlots[i].parent) { marketSlots[i].parent.removeChild(marketSlots[i]); } } marketSlots = []; // Get probability pool for current map var probabilityPool = slotProbabilityPools[currentMap]; // Generate 6 slots for (var i = 0; i < 6; i++) { var slot = new TradeSlot(); // Random item from probability pool var randomIndex = Math.floor(Math.random() * probabilityPool.length); var itemType = probabilityPool[randomIndex]; slot.setItem(itemType); marketSlots.push(slot); } } function refreshMarketSlots() { // Safety check for marketSlots array if (!marketSlots || marketSlots.length === 0) { generateMarketSlots(); return; } // 10% chance to refresh each slot var probabilityPool = slotProbabilityPools[currentMap]; for (var i = 0; i < marketSlots.length; i++) { if (Math.random() < 0.1) { var randomIndex = Math.floor(Math.random() * probabilityPool.length); var itemType = probabilityPool[randomIndex]; marketSlots[i].setItem(itemType); } } } function createMarketScreen() { // Create market background container marketScreen = new Container(); marketScreen.x = 0; marketScreen.y = 0; // Create market background using citytrade texture var marketBg = LK.getAsset('citytrade', { anchorX: 0.5, anchorY: 0.5, scaleX: 1, scaleY: 1 }); marketBg.x = 24; marketBg.y = -34; marketScreen.addChild(marketBg); // Generate market slots if they don't exist if (marketSlots.length === 0) { generateMarketSlots(); } // Position and add slots to market screen (2 rows, 3 columns) var slotStartX = -150; var slotStartY = -200; var slotSpacingX = 150; var slotSpacingY = 150; for (var i = 0; i < marketSlots.length; i++) { var slot = marketSlots[i]; var row = Math.floor(i / 3); var col = i % 3; slot.x = slotStartX + col * slotSpacingX; slot.y = slotStartY + row * slotSpacingY; marketScreen.addChild(slot); } // Create market title marketTitle = new Text2(regionNames[currentMap] + ' Market', { size: 77, fill: 0xFFFFFF }); marketTitle.anchor.set(0.5, 0); marketTitle.x = 24; marketTitle.y = -430; marketScreen.addChild(marketTitle); // Create close button using xbutton texture closeButton = LK.getAsset('xbutton', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 2 }); closeButton.x = 556; closeButton.y = -680; marketScreen.addChild(closeButton); // Add close button functionality closeButton.down = function () { closeMarketScreen(); }; LK.gui.center.addChild(marketScreen); isMarketOpen = true; } function closeMarketScreen() { if (marketScreen) { LK.gui.center.removeChild(marketScreen); marketScreen = null; marketTitle = null; closeButton = null; isMarketOpen = false; } } function checkCityProximity() { if (!city) { return; } var dx = character.x - city.x; var dy = character.y - city.y; var currentDistance = Math.sqrt(dx * dx + dy * dy); // Check if entering city range (distance < 100) if (lastCityDistance >= 100 && currentDistance < 100) { // Just entered city - show market if not already visited if (!hasVisitedCity && !isMarketOpen) { createMarketScreen(); hasVisitedCity = true; } } // Check if leaving city range (distance > 150) if (lastCityDistance <= 150 && currentDistance > 150) { // Left city area - reset visit flag for next entry hasVisitedCity = false; if (isMarketOpen) { closeMarketScreen(); } } lastCityDistance = currentDistance; } game.down = function (x, y, obj) { // Prevent movement when market is open if (isMarketOpen) { return; } var nearestRoad = findNearestRoad(x, y); if (nearestRoad) { character.moveTo(nearestRoad.x, nearestRoad.y); } }; function updateGoldDisplay() { if (goldText) { goldText.setText(playerGold.toString()); storage.playerGold = playerGold; } } function updateEconomySystem() { // Track movement distance var dx = character.x - lastPlayerX; var dy = character.y - lastPlayerY; var movementThisFrame = Math.sqrt(dx * dx + dy * dy); if (movementThisFrame > 0) { totalMovementDistance += movementThisFrame; // Salt price update every 5000 pixels var saltDistanceThreshold = lastSaltPriceUpdate + 5000; if (totalMovementDistance >= saltDistanceThreshold) { // 50% chance for price change if (Math.random() < 0.5) { // 50% chance for increase (7%) or decrease (6%) if (Math.random() < 0.5) { saltCurrentPrice *= 1.07; // 7% increase } else { saltCurrentPrice *= 0.94; // 6% decrease } } lastSaltPriceUpdate = totalMovementDistance; } // Apple price update every 500 pixels var appleDistanceThreshold = lastApplePriceUpdate + 500; if (totalMovementDistance >= appleDistanceThreshold) { // 50% chance for price change if (Math.random() < 0.5) { // 50% chance for increase (+1) or decrease (-1) if (Math.random() < 0.5) { appleCurrentPrice += 1; } else { appleCurrentPrice -= 1; } // Apply price limits for apple (5-25) if (appleCurrentPrice < 5) { appleCurrentPrice = 5; } if (appleCurrentPrice > 25) { appleCurrentPrice = 25; } } lastApplePriceUpdate = totalMovementDistance; } // Check for slot refresh every 3000 pixels var slotRefreshThreshold = lastSlotRefreshDistance + 3000; if (totalMovementDistance >= slotRefreshThreshold) { if (marketSlots && marketSlots.length > 0) { refreshMarketSlots(); } lastSlotRefreshDistance = totalMovementDistance; storage.lastSlotRefreshDistance = lastSlotRefreshDistance; } // Save economy data to storage storage.saltCurrentPrice = saltCurrentPrice; storage.appleCurrentPrice = appleCurrentPrice; storage.totalMovementDistance = totalMovementDistance; storage.lastSaltPriceUpdate = lastSaltPriceUpdate; storage.lastApplePriceUpdate = lastApplePriceUpdate; } // Update last position lastPlayerX = character.x; lastPlayerY = character.y; } game.update = function () { checkPassageCollision(); mapText.setText(regionNames[currentMap]); checkCityProximity(); updateGoldDisplay(); updateEconomySystem(); };
===================================================================
--- original.js
+++ change.js
@@ -1860,8 +1860,10 @@
game.addChild(character);
// Initialize economy system tracking
lastPlayerX = character.x;
lastPlayerY = character.y;
+// Initialize market slots array to prevent undefined errors
+generateMarketSlots();
// Region names for each map
var regionNames = ['Northern Highlands', 'Eastern Valleys', 'Southern Ridge', 'Western Peaks', 'Central Plains', 'Mystic Woods', 'Ancient Ruins', 'Desert Sands', 'Frozen Wastes', 'Coastal Cliffs', 'Mountain Pass', 'Sacred Grove'];
// Map info display
var mapText = new Text2(regionNames[currentMap], {
@@ -1897,10 +1899,8 @@
var hasVisitedCity = false;
// Market slot system variables
var marketSlots = [];
var lastSlotRefreshDistance = storage.lastSlotRefreshDistance || 0;
-// Initialize market slots array to prevent undefined errors
-generateMarketSlots();
// Slot probability pools for each city
var slotProbabilityPools = [
// Map 0 - Northern Highlands
[null, null, null, null, null, null, 'apple', 'apple', 'apple', 'salt'],
mağara girişi. In-Game asset. 2d. High contrast. No shadows
ortaçağ atlı araba ve tüccar . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
aynısı arkaplansız
medieval X close button. In-Game asset. 2d. High contrast. No shadows
altın kesesi. In-Game asset. 2d. High contrast. No shadows
elma. In-Game asset. 2d. High contrast. No shadows
ortaçağ ticari tuz. In-Game asset. 2d. High contrast. No shadows
çivi ile duvara asılı hafif yıpranmış parşomen. In-Game asset. 2d. High contrast. No shadows
medieval envanter bag. In-Game asset. 2d. High contrast. No shadows
minecraft envaneri gibi kutucuklar sadece kutucuklar başka uı elementi yok. ortaçağ temasında bir çanta içi hissi vermeli dokusu . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
bir ortaçağ eşyası bize hız veriyor ne olur bilmiyorum. In-Game asset. 2d. High contrast. No shadows
medieval sword. In-Game asset. 2d. High contrast. No shadows