User prompt
Çalışanların özelliklerinin düşük olmasının oyun puanlarına ve oyun geliştirme sayfasında seçtiğim özelliklerin birbiri ile bağlantılı olmasının etki etmesini istiyorum. Sonuçlar Çok farklı olsun. Düşük özellik ve bağlantısız seçimler, oyunun satışını ciddi oranında düşürsün. Bu oranı yakala.
User prompt
Oyunlar neden %100 oranında seviliyor? Çalışanların özelliklerinin düşük olmaasının oyun puanlarına etki etmesini istiyorum.
User prompt
Çalışanların tamamının puan ve geliştirici gücünü %95 azalt.
User prompt
Oyun oluşturma skoru 1000/100 oluyor. Bunu düzelt. Bu yüzden çok yüksek puanlar geliyor. Halbuki geliştirici seviyesi ve puanı çok düşük.
User prompt
Oyun oluştururken 1000 skor yerine 100 skor olsun.
User prompt
Please select a researched genre before starting! hatası veriyor. Araştırılmış olan, herhangi bir Genre seçtiğim halde.
User prompt
Selected Genre: None yazıyor. Seçsem bile değişmiyor. Bunu düzelt.
User prompt
Game Genres Research sayfasında seçtiğimizde oyun oluşturulma ekranında seçilmediği görünüyor.
User prompt
Oyun oluştururken Game Genres Research sayfasında bulunan, araştırılmış bir ürün seçilme zorunluluğu olsun.
User prompt
New Project sayfasına Back butonu ekle
User prompt
Oyun oluşturma sayfasında bulunan, Game Genres Research sayfasında sadece araştırılmış bir türün seçilmesine izin ver. Sadece araştırılmış olan 1 tür seçilsin. Ayrıca bu tür konularını, oyun oluşturma sayfalarından kaldır. Oyun türü yalnızca bu sayfadan seçilsin.
User prompt
Oyun projesi oluşturma sayfasında bulunan Game Genres Research butonları için bir buton oluştur ve bu butonları o butona girince açılan sayfaya taşı..
User prompt
Oyun projesi oluşturma sayfasında bulunan Game Genres Research butonları için bir buton oluştur ve bu butonları o butona girince görünmesini sağla.
User prompt
Oyun projesi oluşturma sayfasında ki butonları alt alta hizala.
User prompt
Oyun projesi oluşturma sayfasında ki butonları hizala.
User prompt
Game Genres Research sayfasında araştırdığımız özellikleri, oyun oluştururken seçebilelim. Ama 1 tanesini seçebilelim. Market Trendleri sadece Game Genres Research da bulunan şeylerden rastgele olsun. Ayrıca oyun yaptıktan sonra 10 oyun firması oyunumuza yorumda bulunsun ve yorum yapsın. Özellikler arasında doğru seçim yaparsak daha yüksek puan ve güzel yorumda bulunsunlar. Eğer kötü oyun yaparsak, kötü puan versinler ve kötü yorum yapsınlar. Oyunların Satış oranlarını, yaptığımız oyun için topladığımız puana göre şekillendir. Bu puan ve yorumlar, geçmişe dönük oyun bilgisi içeren, oyun sayfasına oluştur.
User prompt
Bizim ana karakterimizi de çalışan olarak saysın ve oyun oluşturmada ana karakterimizin özelliklerinden de faydalanılsın.
User prompt
Para çok fazla kazanılıyor. Para kazanma oranını %95 düşür.
User prompt
Sound Research sayfasına Back butonu ekle
User prompt
Graphics Research sayfasına Back butonu ekle
User prompt
Gameplay Research sayfasına Back butonu ekle
User prompt
Stüdyo seviyesi her yükseldikçe 1 tane daha almış olalım. 2 tane değil.
User prompt
Çalışan sayısı 9 olsun
User prompt
Çalışanlar sayfaya yeniden hizalı şekilde sırala.
User prompt
Çalışanlar, liste halinde görünsün. Stüdyo, seviyesi yükseldikçe yeni çalışan alabilelim. Yoksa satın alamayalım.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Button = Container.expand(function () { var self = Container.call(this); var bg = self.attachAsset('button', { anchorX: 0.5, anchorY: 0.5 }); var label = new Text2('Button', { size: 40, fill: 0xFFFFFF }); label.anchor.set(0.5, 0.5); self.addChild(label); self.setLabel = function (text) { label.setText(text); }; self.down = function () { tween(bg, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100 }); LK.getSound('select').play(); }; self.up = function () { tween(bg, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (self.onClick) { self.onClick(); } }; return self; }); var DeveloperCard = Container.expand(function () { var self = Container.call(this); var bg = self.attachAsset('card', { anchorX: 0.5, anchorY: 0.5 }); var icon = self.attachAsset('developerIcon', { anchorX: 0.5, anchorY: 0.5, y: -100 }); var nameText = new Text2('Developer', { size: 30, fill: 0xFFFFFF }); nameText.anchor.set(0.5, 0.5); nameText.y = -20; self.addChild(nameText); var specialtyText = new Text2('Graphics', { size: 25, fill: 0xFFC107 }); specialtyText.anchor.set(0.5, 0.5); specialtyText.y = 20; self.addChild(specialtyText); var costText = new Text2('Cost: $100', { size: 25, fill: 0x4CAF50 }); costText.anchor.set(0.5, 0.5); costText.y = 60; self.addChild(costText); var skillText = new Text2('Skill: 5', { size: 25, fill: 0x2196F3 }); skillText.anchor.set(0.5, 0.5); skillText.y = 100; self.addChild(skillText); self.developerData = null; self.setDeveloper = function (data) { self.developerData = data; nameText.setText(data.name); specialtyText.setText(data.specialty); costText.setText('Cost: $' + data.cost); skillText.setText('Skill: ' + data.skill); var specialtyColors = { 'Graphics': 0xff5722, 'Sound': 0x9c27b0, 'Gameplay': 0x2196f3 }; icon.tint = specialtyColors[data.specialty] || 0xffc107; }; self.down = function () { if (self.onClick) { self.onClick(self.developerData); } }; return self; }); var FeatureCard = Container.expand(function () { var self = Container.call(this); var bg = self.attachAsset('card', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8 }); var icon = self.attachAsset('featureIcon', { anchorX: 0.5, anchorY: 0.5, y: -80 }); var nameText = new Text2('Feature', { size: 25, fill: 0xFFFFFF }); nameText.anchor.set(0.5, 0.5); nameText.y = -20; self.addChild(nameText); var typeText = new Text2('Type', { size: 20, fill: 0x2196F3 }); typeText.anchor.set(0.5, 0.5); typeText.y = 10; self.addChild(typeText); var pointsText = new Text2('Points: 0', { size: 20, fill: 0x4CAF50 }); pointsText.anchor.set(0.5, 0.5); pointsText.y = 40; self.addChild(pointsText); self.featureData = null; self.selected = false; self.setFeature = function (data) { self.featureData = data; nameText.setText(data.name); typeText.setText(data.type); pointsText.setText('Points: ' + data.basePoints + ' | Cost: $' + data.cost); var typeColors = { 'Graphics': 0xff5722, 'Sound': 0x9c27b0, 'Gameplay': 0x2196f3 }; icon.tint = typeColors[data.type] || 0xffc107; }; self.setSelected = function (selected) { self.selected = selected; bg.tint = selected ? 0xe94560 : 0xffffff; }; self.down = function () { if (self.onClick) { self.onClick(self); } }; return self; }); var GameHistoryCard = Container.expand(function () { var self = Container.call(this); var bg = self.attachAsset('card', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 0.6 }); var nameText = new Text2('Game Name', { size: 30, fill: 0xFFFFFF }); nameText.anchor.set(0.5, 0.5); nameText.y = -30; self.addChild(nameText); var salesText = new Text2('Sales: 0', { size: 25, fill: 0x4CAF50 }); salesText.anchor.set(0.5, 0.5); salesText.y = 10; self.addChild(salesText); self.gameData = null; self.setGameData = function (data) { self.gameData = data; nameText.setText(data.name); var salesInfo = data.currentDailySales > 0 ? 'Sales: ' + data.totalSales + ' (Active)' : 'Sales: ' + data.totalSales + ' (Ended)'; salesText.setText(salesInfo); bg.tint = data.currentDailySales > 0 ? 0x0f3460 : 0x16213e; }; self.down = function () { if (self.onClick) { self.onClick(self.gameData); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a2e }); /**** * Game Code ****/ // Game state var gameState = { money: 10000, developers: [], currentProject: null, completedGames: 0, marketTrends: [], currentDay: 1, releasedGames: [], maxHireableDevelopers: 1, studioLevel: 1, studioUpgradeCost: 5000, mainCharacter: { name: "You", level: 1, upgradeCost: 2000, skill: 2, specialty: "All", featurePoints: { Graphics: 1, Sound: 1, Gameplay: 1 } }, gameHistory: [], researchedFeatures: { Graphics: [], Sound: [], Gameplay: [], GameGenres: [] }, currentResearch: null }; // Current game name being created var currentGameName = ''; // Game name display at top var gameNameDisplay = new Text2('', { size: 45, fill: 0xFFFFFF }); gameNameDisplay.anchor.set(0.5, 0); gameNameDisplay.y = 10; LK.gui.top.addChild(gameNameDisplay); // Available developers pool var developerPool = [{ name: 'Alex', specialty: 'Graphics', skill: 3, cost: 500 }, { name: 'Sam', specialty: 'Sound', skill: 4, cost: 1000 }, { name: 'Jordan', specialty: 'Gameplay', skill: 5, cost: 1500 }, { name: 'Morgan', specialty: 'Graphics', skill: 6, cost: 2000 }, { name: 'Casey', specialty: 'Sound', skill: 7, cost: 2500 }, { name: 'Drew', specialty: 'Gameplay', skill: 8, cost: 3000 }]; // Available features - expanded with research requirements var featurePool = [{ name: 'Pixel Art', type: 'Graphics', basePoints: 3, cost: 100, requiresResearch: false }, { name: '3D Models', type: 'Graphics', basePoints: 5, cost: 300, requiresResearch: false }, { name: 'Particle Effects', type: 'Graphics', basePoints: 4, cost: 200, requiresResearch: false }, { name: 'Soundtrack', type: 'Sound', basePoints: 3, cost: 150, requiresResearch: false }, { name: 'Voice Acting', type: 'Sound', basePoints: 6, cost: 400, requiresResearch: false }, { name: 'Sound Effects', type: 'Sound', basePoints: 4, cost: 200, requiresResearch: false }, { name: 'RPG Elements', type: 'Gameplay', basePoints: 5, cost: 250, requiresResearch: false }, { name: 'Multiplayer', type: 'Gameplay', basePoints: 7, cost: 500, requiresResearch: false }, { name: 'Puzzles', type: 'Gameplay', basePoints: 4, cost: 200, requiresResearch: false }, { name: 'Open World', type: 'Gameplay', basePoints: 8, cost: 600, requiresResearch: false }, { name: 'Shaders', type: 'Graphics', basePoints: 6, cost: 400, requiresResearch: true }, { name: 'Ray Tracing', type: 'Graphics', basePoints: 10, cost: 800, requiresResearch: true }, { name: 'Motion Capture', type: 'Graphics', basePoints: 8, cost: 600, requiresResearch: true }, { name: 'Procedural Generation', type: 'Graphics', basePoints: 7, cost: 500, requiresResearch: true }, { name: 'Dynamic Lighting', type: 'Graphics', basePoints: 6, cost: 450, requiresResearch: true }, { name: 'Orchestral Score', type: 'Sound', basePoints: 8, cost: 600, requiresResearch: true }, { name: '3D Audio', type: 'Sound', basePoints: 7, cost: 500, requiresResearch: true }, { name: 'Dynamic Music', type: 'Sound', basePoints: 6, cost: 400, requiresResearch: true }, { name: 'Environmental Audio', type: 'Sound', basePoints: 5, cost: 350, requiresResearch: true }, { name: 'Foley Effects', type: 'Sound', basePoints: 6, cost: 450, requiresResearch: true }, { name: 'Physics Engine', type: 'Gameplay', basePoints: 9, cost: 700, requiresResearch: true }, { name: 'AI Systems', type: 'Gameplay', basePoints: 10, cost: 800, requiresResearch: true }, { name: 'Skill Trees', type: 'Gameplay', basePoints: 6, cost: 400, requiresResearch: true }, { name: 'Crafting System', type: 'Gameplay', basePoints: 7, cost: 500, requiresResearch: true }, { name: 'Dialogue System', type: 'Gameplay', basePoints: 5, cost: 350, requiresResearch: true }]; // Game genres that can be researched var gameGenres = [{ name: 'Action', baseMultiplier: 1.2, trendChance: 0.3, researchCost: 1000, requiresResearch: false }, { name: 'Adventure', baseMultiplier: 1.1, trendChance: 0.25, researchCost: 800, requiresResearch: false }, { name: 'Puzzle', baseMultiplier: 1.0, trendChance: 0.2, researchCost: 600, requiresResearch: false }, { name: 'Racing', baseMultiplier: 1.3, trendChance: 0.35, researchCost: 1200, requiresResearch: true }, { name: 'Strategy', baseMultiplier: 1.4, trendChance: 0.3, researchCost: 1500, requiresResearch: true }, { name: 'Simulation', baseMultiplier: 1.2, trendChance: 0.25, researchCost: 1000, requiresResearch: true }, { name: 'RPG', baseMultiplier: 1.5, trendChance: 0.4, researchCost: 2000, requiresResearch: true }, { name: 'FPS', baseMultiplier: 1.4, trendChance: 0.35, researchCost: 1800, requiresResearch: true }, { name: 'Horror', baseMultiplier: 1.3, trendChance: 0.25, researchCost: 1200, requiresResearch: true }, { name: 'Sports', baseMultiplier: 1.2, trendChance: 0.3, researchCost: 1000, requiresResearch: true }]; // UI Elements var moneyText = new Text2('Money: $10000', { size: 50, fill: 0x4CAF50 }); moneyText.anchor.set(1, 0); LK.gui.topRight.addChild(moneyText); var developersText = new Text2('Developers: 0', { size: 40, fill: 0xFFFFFF }); developersText.anchor.set(1, 0); developersText.y = 60; LK.gui.topRight.addChild(developersText); var gamesText = new Text2('Games Released: 0', { size: 40, fill: 0xFFC107 }); gamesText.anchor.set(1, 0); gamesText.y = 110; LK.gui.topRight.addChild(gamesText); var dayText = new Text2('Day: 1', { size: 40, fill: 0x2196F3 }); dayText.anchor.set(1, 0); dayText.y = 160; LK.gui.topRight.addChild(dayText); // Main menu container var mainMenu = new Container(); game.addChild(mainMenu); var titleText = new Text2('Game Dev Studio', { size: 80, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = 1024; titleText.y = 300; mainMenu.addChild(titleText); var nameGameBtn = new Button(); nameGameBtn.setLabel('Name Your Game'); nameGameBtn.x = 1024; nameGameBtn.y = 600; nameGameBtn.onClick = showNameGameMenu; mainMenu.addChild(nameGameBtn); var hireDeveloperBtn = new Button(); hireDeveloperBtn.setLabel('Hire Developer'); hireDeveloperBtn.x = 1024; hireDeveloperBtn.y = 750; hireDeveloperBtn.onClick = showHireMenu; mainMenu.addChild(hireDeveloperBtn); var startProjectBtn = new Button(); startProjectBtn.setLabel('Start Project'); startProjectBtn.x = 1024; startProjectBtn.y = 900; startProjectBtn.onClick = showProjectMenu; mainMenu.addChild(startProjectBtn); var allGamesBtn = new Button(); allGamesBtn.setLabel('All Released Games'); allGamesBtn.x = 1024; allGamesBtn.y = 1050; allGamesBtn.onClick = showAllGamesMenu; mainMenu.addChild(allGamesBtn); var researchBtn = new Button(); researchBtn.setLabel('Research'); researchBtn.x = 1024; researchBtn.y = 1200; researchBtn.onClick = showResearchMenu; mainMenu.addChild(researchBtn); // --- Upgrade Button and Menu --- var upgradeBtn = new Button(); upgradeBtn.setLabel('Yükselt'); upgradeBtn.x = 1024; upgradeBtn.y = 1350; upgradeBtn.onClick = showUpgradeMenu; mainMenu.addChild(upgradeBtn); var upgradeMenu = new Container(); upgradeMenu.visible = false; game.addChild(upgradeMenu); var upgradeTitle = new Text2('Stüdyo Yükseltmeleri', { size: 60, fill: 0xFFFFFF }); upgradeTitle.anchor.set(0.5, 0.5); upgradeTitle.x = 1024; upgradeTitle.y = 200; upgradeMenu.addChild(upgradeTitle); var studioLevelText = new Text2('', { size: 40, fill: 0xFFC107 }); studioLevelText.anchor.set(0.5, 0.5); studioLevelText.x = 1024; studioLevelText.y = 350; upgradeMenu.addChild(studioLevelText); var studioUpgradeCostText = new Text2('', { size: 35, fill: 0x4CAF50 }); studioUpgradeCostText.anchor.set(0.5, 0.5); studioUpgradeCostText.x = 1024; studioUpgradeCostText.y = 420; upgradeMenu.addChild(studioUpgradeCostText); var studioUpgradeBtn = new Button(); studioUpgradeBtn.setLabel('Stüdyo Seviyesini Yükselt'); studioUpgradeBtn.x = 1024; studioUpgradeBtn.y = 500; studioUpgradeBtn.onClick = function () { if (gameState.money >= gameState.studioUpgradeCost) { gameState.money -= gameState.studioUpgradeCost; gameState.studioLevel += 1; gameState.maxHireableDevelopers = 1 + gameState.studioLevel; gameState.studioUpgradeCost = Math.floor(gameState.studioUpgradeCost * 1.7); updateUI(); showUpgradeMenu(); LK.getSound('success').play(); } }; upgradeMenu.addChild(studioUpgradeBtn); // --- Main Character Section --- var mainCharTitle = new Text2('Ana Karakterin', { size: 40, fill: 0xFFFFFF }); mainCharTitle.anchor.set(0.5, 0.5); mainCharTitle.x = 1024; mainCharTitle.y = 700; upgradeMenu.addChild(mainCharTitle); var mainCharLevelText = new Text2('', { size: 35, fill: 0xFFC107 }); mainCharLevelText.anchor.set(0.5, 0.5); mainCharLevelText.x = 1024; mainCharLevelText.y = 770; upgradeMenu.addChild(mainCharLevelText); var mainCharSkillText = new Text2('', { size: 30, fill: 0x2196F3 }); mainCharSkillText.anchor.set(0.5, 0.5); mainCharSkillText.x = 1024; mainCharSkillText.y = 820; upgradeMenu.addChild(mainCharSkillText); var mainCharUpgradeCostText = new Text2('', { size: 30, fill: 0x4CAF50 }); mainCharUpgradeCostText.anchor.set(0.5, 0.5); mainCharUpgradeCostText.x = 1024; mainCharUpgradeCostText.y = 870; upgradeMenu.addChild(mainCharUpgradeCostText); var mainCharUpgradeBtn = new Button(); mainCharUpgradeBtn.setLabel('Ana Karakteri Yükselt'); mainCharUpgradeBtn.x = 1024; mainCharUpgradeBtn.y = 950; mainCharUpgradeBtn.onClick = function () { if (gameState.money >= gameState.mainCharacter.upgradeCost) { gameState.money -= gameState.mainCharacter.upgradeCost; gameState.mainCharacter.level += 1; gameState.mainCharacter.skill += 1; // Each level, increase all feature points by 1 gameState.mainCharacter.featurePoints.Graphics += 1; gameState.mainCharacter.featurePoints.Sound += 1; gameState.mainCharacter.featurePoints.Gameplay += 1; gameState.mainCharacter.upgradeCost = Math.floor(gameState.mainCharacter.upgradeCost * 1.8); updateUI(); showUpgradeMenu(); LK.getSound('success').play(); } }; upgradeMenu.addChild(mainCharUpgradeBtn); var backFromUpgradeBtn = new Button(); backFromUpgradeBtn.setLabel('Geri'); backFromUpgradeBtn.x = 1024; backFromUpgradeBtn.y = 2400; backFromUpgradeBtn.onClick = function () { upgradeMenu.visible = false; mainMenu.visible = true; }; upgradeMenu.addChild(backFromUpgradeBtn); function showUpgradeMenu() { mainMenu.visible = false; upgradeMenu.visible = true; studioLevelText.setText('Stüdyo Seviyesi: ' + gameState.studioLevel); studioUpgradeCostText.setText('Yükseltme Maliyeti: $' + gameState.studioUpgradeCost); mainCharLevelText.setText('Ana Karakter Seviye: ' + gameState.mainCharacter.level); mainCharSkillText.setText('Her Özellik Puanı: ' + 'Grafik: ' + gameState.mainCharacter.featurePoints.Graphics + ', Ses: ' + gameState.mainCharacter.featurePoints.Sound + ', Oynanış: ' + gameState.mainCharacter.featurePoints.Gameplay); mainCharUpgradeCostText.setText('Yükseltme Maliyeti: $' + gameState.mainCharacter.upgradeCost); } // Research menu container var researchMenu = new Container(); researchMenu.visible = false; game.addChild(researchMenu); var researchTitle = new Text2('Research Lab', { size: 60, fill: 0xFFFFFF }); researchTitle.anchor.set(0.5, 0.5); researchTitle.x = 1024; researchTitle.y = 200; researchMenu.addChild(researchTitle); var researchBackBtn = new Button(); researchBackBtn.setLabel('Back'); researchBackBtn.x = 1024; researchBackBtn.y = 2400; researchBackBtn.onClick = function () { researchMenu.visible = false; mainMenu.visible = true; }; researchMenu.addChild(researchBackBtn); // Research category menu var researchCategoryMenu = new Container(); researchCategoryMenu.visible = false; game.addChild(researchCategoryMenu); var categoryTitle = new Text2('', { size: 60, fill: 0xFFFFFF }); categoryTitle.anchor.set(0.5, 0.5); categoryTitle.x = 1024; categoryTitle.y = 200; researchCategoryMenu.addChild(categoryTitle); var categoryBackBtn = new Button(); categoryBackBtn.setLabel('Back'); categoryBackBtn.x = 1024; categoryBackBtn.y = 2400; categoryBackBtn.onClick = function () { researchCategoryMenu.visible = false; researchMenu.visible = true; }; researchCategoryMenu.addChild(categoryBackBtn); // Name game menu container var nameGameMenu = new Container(); nameGameMenu.visible = false; game.addChild(nameGameMenu); var nameGameTitle = new Text2('Name Your Game', { size: 60, fill: 0xFFFFFF }); nameGameTitle.anchor.set(0.5, 0.5); nameGameTitle.x = 1024; nameGameTitle.y = 200; nameGameMenu.addChild(nameGameTitle); var gameNameInput = new Text2('', { size: 50, fill: 0x4CAF50 }); gameNameInput.anchor.set(0.5, 0.5); gameNameInput.x = 1024; gameNameInput.y = 400; nameGameMenu.addChild(gameNameInput); var inputPrompt = new Text2('Tap to enter game name', { size: 30, fill: 0xFFFFFF }); inputPrompt.anchor.set(0.5, 0.5); inputPrompt.x = 1024; inputPrompt.y = 500; nameGameMenu.addChild(inputPrompt); var randomNameBtn = new Button(); randomNameBtn.setLabel('Random Name'); randomNameBtn.x = 1024; randomNameBtn.y = 700; randomNameBtn.onClick = generateRandomName; nameGameMenu.addChild(randomNameBtn); var confirmNameBtn = new Button(); confirmNameBtn.setLabel('Confirm Name'); confirmNameBtn.x = 1024; confirmNameBtn.y = 850; confirmNameBtn.onClick = confirmGameName; nameGameMenu.addChild(confirmNameBtn); var backFromNameBtn = new Button(); backFromNameBtn.setLabel('Back'); backFromNameBtn.x = 1024; backFromNameBtn.y = 1000; backFromNameBtn.onClick = function () { nameGameMenu.visible = false; mainMenu.visible = true; gameNameInput.setText(''); currentGameName = ''; }; nameGameMenu.addChild(backFromNameBtn); // Simple tap-to-edit name input var nameInputBg = LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 1 }); nameInputBg.x = 1024; nameInputBg.y = 400; nameInputBg.alpha = 0.3; nameGameMenu.addChild(nameInputBg); nameInputBg.interactive = true; nameInputBg.down = function () { // Simulate simple text input with preset options var names = ['Game Studio Pro', 'Developer Tycoon', 'Code Master', 'Pixel Dreams', 'Game Maker Plus']; var randomIndex = Math.floor(Math.random() * names.length); currentGameName = names[randomIndex]; gameNameInput.setText(currentGameName); LK.getSound('select').play(); }; // Move gameNameInput to be on top nameGameMenu.removeChild(gameNameInput); nameGameMenu.addChild(gameNameInput); // All games menu container var allGamesMenu = new Container(); allGamesMenu.visible = false; game.addChild(allGamesMenu); var allGamesTitle = new Text2('All Released Games', { size: 60, fill: 0xFFFFFF }); allGamesTitle.anchor.set(0.5, 0.5); allGamesTitle.x = 1024; allGamesTitle.y = 200; allGamesMenu.addChild(allGamesTitle); var noGamesText = new Text2('No games released yet', { size: 40, fill: 0xFFFFFF }); noGamesText.anchor.set(0.5, 0.5); noGamesText.x = 1024; noGamesText.y = 600; noGamesText.visible = false; allGamesMenu.addChild(noGamesText); var backFromAllGamesBtn = new Button(); backFromAllGamesBtn.setLabel('Back'); backFromAllGamesBtn.x = 1024; backFromAllGamesBtn.y = 2400; backFromAllGamesBtn.onClick = function () { allGamesMenu.visible = false; mainMenu.visible = true; }; allGamesMenu.addChild(backFromAllGamesBtn); // Game detail view container var gameDetailView = new Container(); gameDetailView.visible = false; game.addChild(gameDetailView); var detailBackBtn = new Button(); detailBackBtn.setLabel('Back to Games List'); detailBackBtn.x = 1024; detailBackBtn.y = 2400; detailBackBtn.onClick = function () { gameDetailView.visible = false; allGamesMenu.visible = true; }; gameDetailView.addChild(detailBackBtn); // Hire menu container var hireMenu = new Container(); hireMenu.visible = false; game.addChild(hireMenu); var hireTitle = new Text2('Hire Developer', { size: 60, fill: 0xFFFFFF }); hireTitle.anchor.set(0.5, 0.5); hireTitle.x = 1024; hireTitle.y = 200; hireMenu.addChild(hireTitle); var backFromHireBtn = new Button(); backFromHireBtn.setLabel('Back'); backFromHireBtn.x = 1024; backFromHireBtn.y = 2400; backFromHireBtn.onClick = function () { hireMenu.visible = false; mainMenu.visible = true; }; hireMenu.addChild(backFromHireBtn); // Project menu container var projectMenu = new Container(); projectMenu.visible = false; game.addChild(projectMenu); var projectTitle = new Text2('New Project', { size: 60, fill: 0xFFFFFF }); projectTitle.anchor.set(0.5, 0.5); projectTitle.x = 1024; projectTitle.y = 200; projectMenu.addChild(projectTitle); var selectFeaturesText = new Text2('Select 5 Features:', { size: 40, fill: 0xFFFFFF }); selectFeaturesText.anchor.set(0.5, 0.5); selectFeaturesText.x = 1024; selectFeaturesText.y = 300; projectMenu.addChild(selectFeaturesText); var startDevelopmentBtn = new Button(); startDevelopmentBtn.setLabel('Start Development'); startDevelopmentBtn.x = 1024; startDevelopmentBtn.y = 2200; startDevelopmentBtn.onClick = startDevelopment; projectMenu.addChild(startDevelopmentBtn); var backFromProjectBtn = new Button(); backFromProjectBtn.setLabel('Back'); backFromProjectBtn.x = 1024; backFromProjectBtn.y = 2350; backFromProjectBtn.onClick = function () { projectMenu.visible = false; mainMenu.visible = true; selectedFeatures = []; featureCards.forEach(function (card) { card.setSelected(false); }); }; projectMenu.addChild(backFromProjectBtn); // Feature category menu var featureCategoryMenu = new Container(); featureCategoryMenu.visible = false; game.addChild(featureCategoryMenu); var categoryMenuTitle = new Text2('', { size: 60, fill: 0xFFFFFF }); categoryMenuTitle.anchor.set(0.5, 0.5); categoryMenuTitle.x = 1024; categoryMenuTitle.y = 200; featureCategoryMenu.addChild(categoryMenuTitle); var selectedFeaturesText = new Text2('Selected: 0/5', { size: 40, fill: 0xFFFFFF }); selectedFeaturesText.anchor.set(0.5, 0.5); selectedFeaturesText.x = 1024; selectedFeaturesText.y = 300; featureCategoryMenu.addChild(selectedFeaturesText); var categoryBackBtn = new Button(); categoryBackBtn.setLabel('Back to Categories'); categoryBackBtn.x = 1024; categoryBackBtn.y = 2350; categoryBackBtn.onClick = function () { featureCategoryMenu.visible = false; projectMenu.visible = true; // Update total cost in project menu var totalCost = 0; selectedFeatures.forEach(function (f) { totalCost += f.cost; }); if (projectMenu.totalCostText) { projectMenu.totalCostText.setText('Total Cost: $' + totalCost); } }; featureCategoryMenu.addChild(categoryBackBtn); // Development screen var developmentScreen = new Container(); developmentScreen.visible = false; game.addChild(developmentScreen); var devTitle = new Text2('Developing Game', { size: 60, fill: 0xFFFFFF }); devTitle.anchor.set(0.5, 0.5); devTitle.x = 1024; devTitle.y = 200; developmentScreen.addChild(devTitle); var targetScoreText = new Text2('Target Score: 100', { size: 40, fill: 0xFFFFFF }); targetScoreText.anchor.set(0.5, 0.5); targetScoreText.x = 1024; targetScoreText.y = 400; developmentScreen.addChild(targetScoreText); var currentScoreText = new Text2('Current Score: 0', { size: 40, fill: 0x4CAF50 }); currentScoreText.anchor.set(0.5, 0.5); currentScoreText.x = 1024; currentScoreText.y = 500; developmentScreen.addChild(currentScoreText); var progressBarBg = LK.getAsset('progressBar', { anchorX: 0.5, anchorY: 0.5 }); progressBarBg.x = 1024; progressBarBg.y = 700; developmentScreen.addChild(progressBarBg); var progressBarFill = LK.getAsset('progressFill', { anchorX: 0, anchorY: 0.5 }); progressBarFill.x = 624; progressBarFill.y = 700; progressBarFill.scaleX = 0; developmentScreen.addChild(progressBarFill); var releaseBtn = new Button(); releaseBtn.setLabel('Release Game!'); releaseBtn.x = 1024; releaseBtn.y = 900; releaseBtn.visible = false; releaseBtn.onClick = releaseGame; developmentScreen.addChild(releaseBtn); // Market trends display var trendsContainer = new Container(); trendsContainer.x = 1024; trendsContainer.y = 1200; developmentScreen.addChild(trendsContainer); var trendsTitle = new Text2('Market Trends:', { size: 35, fill: 0xFF5722 }); trendsTitle.anchor.set(0.5, 0.5); trendsContainer.addChild(trendsTitle); // Arrays for UI elements var developerCards = []; var featureCards = []; var selectedFeatures = []; // Functions function updateUI() { moneyText.setText('Money: $' + gameState.money); developersText.setText('Developers: ' + gameState.developers.length); gamesText.setText('Games Released: ' + gameState.completedGames); dayText.setText('Day: ' + gameState.currentDay); } function showResearchMenu() { mainMenu.visible = false; researchMenu.visible = true; // Clear existing buttons for (var i = researchMenu.children.length - 1; i >= 0; i--) { if (researchMenu.children[i] instanceof Button && researchMenu.children[i] !== researchBackBtn) { researchMenu.children[i].destroy(); } } // Create category buttons var categories = ['Graphics', 'Sound', 'Gameplay', 'GameGenres']; categories.forEach(function (category, index) { var btn = new Button(); var displayName = category === 'GameGenres' ? 'Game Genres' : category; btn.setLabel(displayName + ' Research'); btn.x = 1024; btn.y = 400 + index * 150; btn.onClick = function () { showResearchCategory(category); }; researchMenu.addChild(btn); }); } function showResearchCategory(category) { researchMenu.visible = false; researchCategoryMenu.visible = true; var displayName = category === 'GameGenres' ? 'Game Genres' : category; categoryTitle.setText(displayName + ' Research'); // Clear existing items for (var i = researchCategoryMenu.children.length - 1; i >= 0; i--) { var child = researchCategoryMenu.children[i]; if (child !== categoryTitle && child !== categoryBackBtn) { child.destroy(); } } // Get researchable items for this category var items = []; if (category === 'GameGenres') { items = gameGenres.filter(function (genre) { return genre.requiresResearch && gameState.researchedFeatures.GameGenres.indexOf(genre.name) === -1; }); } else { items = featurePool.filter(function (feature) { return feature.type === category && feature.requiresResearch && gameState.researchedFeatures[category].indexOf(feature.name) === -1; }); } // Display research items items.forEach(function (item, index) { var container = new Container(); container.x = 1024; container.y = 400 + index * 120; var bg = LK.getAsset('card', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 0.4 }); container.addChild(bg); var nameText = new Text2(item.name, { size: 30, fill: 0xFFFFFF }); nameText.anchor.set(0.5, 0.5); nameText.y = -20; container.addChild(nameText); var cost = category === 'GameGenres' ? item.researchCost : item.cost * 3; var costText = new Text2('Research Cost: $' + cost, { size: 25, fill: 0x4CAF50 }); costText.anchor.set(0.5, 0.5); costText.y = 20; container.addChild(costText); container.interactive = true; container.down = function () { if (gameState.money >= cost && !gameState.currentResearch) { gameState.money -= cost; gameState.currentResearch = { name: item.name, category: category, timeRemaining: 180 // 3 seconds }; updateUI(); LK.getSound('select').play(); showResearchCategory(category); } }; researchCategoryMenu.addChild(container); }); // Add a Back button specifically for Game Genres Research page if (category === 'GameGenres') { // Remove previous genre back button if any if (researchCategoryMenu.genreBackBtn) { researchCategoryMenu.removeChild(researchCategoryMenu.genreBackBtn); researchCategoryMenu.genreBackBtn.destroy(); researchCategoryMenu.genreBackBtn = null; } var genreBackBtn = new Button(); genreBackBtn.setLabel('Back'); genreBackBtn.x = 1024; genreBackBtn.y = 2400; genreBackBtn.onClick = function () { researchCategoryMenu.visible = false; researchMenu.visible = true; updateGlobalBackBtn && updateGlobalBackBtn(); }; researchCategoryMenu.addChild(genreBackBtn); researchCategoryMenu.genreBackBtn = genreBackBtn; } // Show current research if any if (gameState.currentResearch) { var researchInfo = new Text2('Currently researching: ' + gameState.currentResearch.name, { size: 35, fill: 0xFFC107 }); researchInfo.anchor.set(0.5, 0.5); researchInfo.x = 1024; researchInfo.y = 300; researchCategoryMenu.addChild(researchInfo); } } function showNameGameMenu() { mainMenu.visible = false; nameGameMenu.visible = true; currentGameName = ''; gameNameInput.setText(''); } function generateRandomName() { var prefixes = ['Super', 'Mega', 'Ultra', 'Epic', 'Legendary', 'Amazing', 'Incredible', 'Fantastic']; var genres = ['Adventure', 'Quest', 'Battle', 'World', 'Kingdom', 'Legend', 'Saga', 'Chronicles']; var suffixes = ['2000', 'X', 'Plus', 'HD', 'Remastered', 'Ultimate', 'Deluxe', 'Pro']; var name = prefixes[Math.floor(Math.random() * prefixes.length)] + ' ' + genres[Math.floor(Math.random() * genres.length)] + ' ' + suffixes[Math.floor(Math.random() * suffixes.length)]; currentGameName = name; gameNameInput.setText(name); LK.getSound('select').play(); } function confirmGameName() { if (currentGameName && currentGameName.length > 0) { // Store the game name for later use nameGameMenu.visible = false; mainMenu.visible = true; LK.getSound('success').play(); // Update game name display gameNameDisplay.setText('Next Game: ' + currentGameName); // Show confirmation message var confirmText = new Text2('Next game will be: ' + currentGameName, { size: 30, fill: 0x4CAF50 }); confirmText.anchor.set(0.5, 0.5); confirmText.x = 1024; confirmText.y = 1050; confirmText.alpha = 0; mainMenu.addChild(confirmText); tween(confirmText, { alpha: 1 }, { duration: 500, onFinish: function onFinish() { LK.setTimeout(function () { tween(confirmText, { alpha: 0 }, { duration: 500, onFinish: function onFinish() { confirmText.destroy(); } }); }, 2000); } }); } } function showAllGamesMenu() { mainMenu.visible = false; allGamesMenu.visible = true; // Clear existing game cards var cardsToRemove = []; allGamesMenu.children.forEach(function (child) { if (child instanceof GameHistoryCard) { cardsToRemove.push(child); } }); cardsToRemove.forEach(function (card) { card.destroy(); }); // Show all games (both active and completed) var allGames = gameState.releasedGames.concat(gameState.gameHistory); if (allGames.length === 0) { noGamesText.visible = true; } else { noGamesText.visible = false; allGames.forEach(function (game, index) { var card = new GameHistoryCard(); card.setGameData(game); card.x = 1024; card.y = 400 + index * 150; card.onClick = showGameDetail; allGamesMenu.addChild(card); }); } } function showGameDetail(gameData) { allGamesMenu.visible = false; gameDetailView.visible = true; // Clear previous content for (var i = gameDetailView.children.length - 1; i >= 0; i--) { if (gameDetailView.children[i] !== detailBackBtn) { gameDetailView.children[i].destroy(); } } // Game title var titleText = new Text2(gameData.name, { size: 60, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = 1024; titleText.y = 200; gameDetailView.addChild(titleText); // Release info var releaseText = new Text2('Released on Day ' + gameData.releaseDay, { size: 35, fill: 0x2196F3 }); releaseText.anchor.set(0.5, 0.5); releaseText.x = 1024; releaseText.y = 300; gameDetailView.addChild(releaseText); // Sales info var salesStatus = gameData.currentDailySales > 0 ? 'Active' : 'Ended'; var salesText = new Text2('Total Sales: ' + gameData.totalSales + ' copies (' + salesStatus + ')', { size: 35, fill: 0x4CAF50 }); salesText.anchor.set(0.5, 0.5); salesText.x = 1024; salesText.y = 380; gameDetailView.addChild(salesText); // Score info var scoreText = new Text2('Score: ' + Math.floor(gameData.score) + ' / ' + gameData.targetScore, { size: 35, fill: 0xFFC107 }); scoreText.anchor.set(0.5, 0.5); scoreText.x = 1024; scoreText.y = 460; gameDetailView.addChild(scoreText); // Genre info if (gameData.genre) { var genreText = new Text2('Genre: ' + gameData.genre.name, { size: 35, fill: 0x9C27B0 }); genreText.anchor.set(0.5, 0.5); genreText.x = 1024; genreText.y = 540; gameDetailView.addChild(genreText); } // Features title var featuresTitle = new Text2('Features Used:', { size: 40, fill: 0xFFFFFF }); featuresTitle.anchor.set(0.5, 0.5); featuresTitle.x = 1024; featuresTitle.y = 600; gameDetailView.addChild(featuresTitle); // Display features gameData.features.forEach(function (feature, index) { var featureText = new Text2('• ' + feature.name + ' (' + feature.type + ')', { size: 30, fill: 0x2196F3 }); featureText.anchor.set(0.5, 0.5); featureText.x = 1024; featureText.y = 680 + index * 40; gameDetailView.addChild(featureText); }); // Developers title var devsTitle = new Text2('Developed by:', { size: 40, fill: 0xFFFFFF }); devsTitle.anchor.set(0.5, 0.5); devsTitle.x = 1024; devsTitle.y = 1000; gameDetailView.addChild(devsTitle); // Display developers if stored if (gameData.developers) { gameData.developers.forEach(function (dev, index) { var devText = new Text2('• ' + dev.name + ' (' + dev.specialty + ', Skill: ' + dev.skill + ')', { size: 30, fill: 0xFFC107 }); devText.anchor.set(0.5, 0.5); devText.x = 1024; devText.y = 1080 + index * 40; gameDetailView.addChild(devText); }); } } function showHireMenu() { mainMenu.visible = false; hireMenu.visible = true; // Clear existing cards developerCards.forEach(function (card) { card.destroy(); }); developerCards = []; // Show available developers info var infoText = new Text2('Available Developers: ' + gameState.maxHireableDevelopers, { size: 35, fill: 0xFFC107 }); infoText.anchor.set(0.5, 0.5); infoText.x = 1024; infoText.y = 350; hireMenu.addChild(infoText); // Show main character as always hired var mainCharCard = new DeveloperCard(); mainCharCard.setDeveloper({ name: gameState.mainCharacter.name, specialty: "All", skill: gameState.mainCharacter.skill, cost: 0 }); mainCharCard.x = 1024; mainCharCard.y = 600; mainCharCard.developerData = { name: gameState.mainCharacter.name, specialty: "All", skill: gameState.mainCharacter.skill, cost: 0 }; mainCharCard.down = function () {}; hireMenu.addChild(mainCharCard); developerCards.push(mainCharCard); // Create developer cards as a list, restrict hiring to studio level var availableDevelopers = developerPool.filter(function (dev) { return !gameState.developers.some(function (hired) { return hired.name === dev.name; }); }); // Only allow hiring up to maxHireableDevelopers (studioLevel+1, including main character) var canHireCount = gameState.maxHireableDevelopers - gameState.developers.length; if (canHireCount < 0) canHireCount = 0; // Show all developers in a vertical list, but disable/hide hire if limit reached availableDevelopers.forEach(function (dev, index) { var card = new DeveloperCard(); card.setDeveloper(dev); card.x = 1024; card.y = 1000 + index * 450; // If we can't hire more, gray out the card and disable click if (index >= canHireCount) { card.alpha = 0.4; card.down = function () { // Optionally show a message or play a sound LK.getSound('select').play(); }; // Show a message overlay var lockText = new Text2('Stüdyo seviyesini yükseltmelisin', { size: 28, fill: 0xE94560 }); lockText.anchor.set(0.5, 0.5); lockText.y = 160; card.addChild(lockText); } else { card.onClick = function (developer) { if (gameState.money >= developer.cost) { gameState.money -= developer.cost; gameState.developers.push({ name: developer.name, specialty: developer.specialty, skill: developer.skill, cost: developer.cost, assignedFeature: null // Only 1 feature can be assigned }); updateUI(); LK.getSound('hire').play(); showHireMenu(); // Refresh menu } }; } hireMenu.addChild(card); developerCards.push(card); }); } function showFeatureCategory(category) { projectMenu.visible = false; featureCategoryMenu.visible = true; categoryMenuTitle.setText(category + ' Features'); selectedFeaturesText.setText('Selected: ' + selectedFeatures.length + '/5'); // Clear existing feature cards for (var i = featureCategoryMenu.children.length - 1; i >= 0; i--) { var child = featureCategoryMenu.children[i]; if (child instanceof FeatureCard) { child.destroy(); } } // Get available features for this category var availableFeatures = featurePool.filter(function (feature) { return feature.type === category && (!feature.requiresResearch || gameState.researchedFeatures[feature.type].indexOf(feature.name) !== -1); }); // Create feature cards availableFeatures.forEach(function (feature, index) { var card = new FeatureCard(); card.setFeature(feature); card.x = 400 + index % 4 * 250; card.y = 500 + Math.floor(index / 4) * 350; // Set selected state if already selected var isSelected = selectedFeatures.some(function (f) { return f.name === feature.name; }); card.setSelected(isSelected); // Highlight trending features if (gameState.marketTrends.indexOf(feature.type) !== -1) { var trendIcon = LK.getAsset('trendIcon', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.3, scaleY: 0.3 }); trendIcon.x = 100; trendIcon.y = -100; card.addChild(trendIcon); } card.onClick = function (clickedCard) { if (clickedCard.selected) { clickedCard.setSelected(false); selectedFeatures = selectedFeatures.filter(function (f) { return f !== clickedCard.featureData; }); } else if (selectedFeatures.length < 5) { clickedCard.setSelected(true); selectedFeatures.push(clickedCard.featureData); LK.getSound('select').play(); } // Update selected count selectedFeaturesText.setText('Selected: ' + selectedFeatures.length + '/5'); }; featureCategoryMenu.addChild(card); }); } function showProjectMenu() { if (gameState.developers.length === 0) { return; } mainMenu.visible = false; projectMenu.visible = true; selectedFeatures = []; // Clear existing cards featureCards.forEach(function (card) { card.destroy(); }); featureCards = []; // Clear any existing category buttons for (var i = projectMenu.children.length - 1; i >= 0; i--) { var child = projectMenu.children[i]; if (child instanceof Button && child !== startDevelopmentBtn && child !== backFromProjectBtn) { child.destroy(); } } // Generate and display market trends gameState.marketTrends = []; var trendTypes = ['Graphics', 'Sound', 'Gameplay']; var availableGenres = gameGenres.filter(function (genre) { return !genre.requiresResearch || gameState.researchedFeatures.GameGenres.indexOf(genre.name) !== -1; }); // Feature type trend var trend = trendTypes[Math.floor(Math.random() * trendTypes.length)]; gameState.marketTrends.push(trend); // Genre trend if (availableGenres.length > 0) { var genreTrend = availableGenres[Math.floor(Math.random() * availableGenres.length)]; gameState.marketTrends.push(genreTrend.name + ' games'); } // Display trends at top var trendsText = new Text2('Market Trends: ' + gameState.marketTrends.join(' & ') + ' are hot!', { size: 35, fill: 0xFF5722 }); trendsText.anchor.set(0.5, 0.5); trendsText.x = 1024; trendsText.y = 400; projectMenu.addChild(trendsText); // Total cost display var totalCostText = new Text2('Total Cost: $0', { size: 35, fill: 0x4CAF50 }); totalCostText.anchor.set(0.5, 0.5); totalCostText.x = 1024; totalCostText.y = 480; projectMenu.addChild(totalCostText); // Store totalCostText reference for later updates projectMenu.totalCostText = totalCostText; // Create category buttons var categories = ['Graphics', 'Sound', 'Gameplay']; categories.forEach(function (category, index) { var categoryBtn = new Button(); categoryBtn.setLabel(category + ' Features'); categoryBtn.x = 512 + index * 400; categoryBtn.y = 600; categoryBtn.onClick = function () { showFeatureCategory(category); }; projectMenu.addChild(categoryBtn); }); } function startDevelopment() { if (selectedFeatures.length !== 5) { return; } // Calculate total cost var totalCost = 0; selectedFeatures.forEach(function (feature) { totalCost += feature.cost; }); // Check if player can afford if (gameState.money < totalCost) { return; } // Deduct costs gameState.money -= totalCost; updateUI(); projectMenu.visible = false; developmentScreen.visible = true; // Display trends for (var i = trendsContainer.children.length - 1; i > 0; i--) { trendsContainer.children[i].destroy(); } gameState.marketTrends.forEach(function (trend, index) { var trendText = new Text2(trend + ' is trending!', { size: 30, fill: 0xFF5722 }); trendText.anchor.set(0.5, 0.5); trendText.y = 40 + index * 35; trendsContainer.addChild(trendText); }); // Calculate target score var baseTarget = 100 + gameState.completedGames * 50; targetScoreText.setText('Target Score: ' + baseTarget); // Add genre selection var selectedGenre = null; var availableGenres = gameGenres.filter(function (genre) { return !genre.requiresResearch || gameState.researchedFeatures.GameGenres.indexOf(genre.name) !== -1; }); if (availableGenres.length > 0) { selectedGenre = availableGenres[Math.floor(Math.random() * availableGenres.length)]; } // Start project gameState.currentProject = { features: selectedFeatures, targetScore: baseTarget, currentScore: 0, developmentSpeed: 0, genre: selectedGenre }; // Assign features to developers (1 per developer, main character can do all) var assignedDevelopers = []; var assignedFeatures = []; // Always include main character as a developer var allDevs = [{ name: gameState.mainCharacter.name, specialty: "All", skill: gameState.mainCharacter.skill, featurePoints: Object.assign({}, gameState.mainCharacter.featurePoints) }].concat(gameState.developers.map(function (dev) { return { name: dev.name, specialty: dev.specialty, skill: dev.skill, assignedFeature: null }; })); // Assign features: main character gets all features, others get 1 each var devAssignments = []; selectedFeatures.forEach(function (feature, idx) { if (idx === 0) { // Main character gets all features devAssignments.push({ dev: allDevs[0], feature: feature }); } else { // Assign to next available developer var devIdx = idx; if (devIdx >= allDevs.length) devIdx = allDevs.length - 1; devAssignments.push({ dev: allDevs[devIdx], feature: feature }); allDevs[devIdx].assignedFeature = feature.name; } }); // Calculate development speed var totalSpeed = 0; devAssignments.forEach(function (assignment) { // Main character: use featurePoints for each type if (assignment.dev.name === gameState.mainCharacter.name) { var fp = assignment.dev.featurePoints[assignment.feature.type] || 1; totalSpeed += (assignment.dev.skill + fp) * 0.5; } else { totalSpeed += assignment.dev.skill * 0.5; } }); gameState.currentProject.developmentSpeed = totalSpeed; gameState.currentProject.devAssignments = devAssignments; LK.getSound('develop').play(); releaseBtn.visible = false; progressBarFill.scaleX = 0; } function releaseGame() { var project = gameState.currentProject; // Calculate final score with bonuses var finalScore = project.currentScore; // Trend bonus var trendMultiplier = 1; project.features.forEach(function (feature) { if (gameState.marketTrends.indexOf(feature.type) !== -1) { finalScore *= 1.5; trendMultiplier += 0.3; } }); // Genre bonus if (project.genre) { finalScore *= project.genre.baseMultiplier; if (gameState.marketTrends.some(function (trend) { return trend.indexOf(project.genre.name) !== -1; })) { finalScore *= 1.3; trendMultiplier += 0.4; } } // Calculate initial sales potential var baseSalesMultiplier = 20; if (finalScore >= project.targetScore) { baseSalesMultiplier = 40; } var initialDailySales = Math.floor(finalScore / project.targetScore * baseSalesMultiplier * trendMultiplier); var gameName = currentGameName && currentGameName.length > 0 ? currentGameName : 'Game #' + (gameState.completedGames + 1); var releasedGame = { name: gameName, releaseDay: gameState.currentDay, score: finalScore, targetScore: project.targetScore, initialDailySales: initialDailySales, currentDailySales: initialDailySales, totalSales: 0, features: project.features, trendBonus: trendMultiplier, developers: gameState.developers.slice(), genre: project.genre }; // Reset game name after use currentGameName = ''; gameNameDisplay.setText(''); gameState.releasedGames.push(releasedGame); // Success check if (finalScore >= project.targetScore) { gameState.money += Math.floor(finalScore * 0.005); gameState.completedGames++; LK.getSound('success').play(); LK.setScore(gameState.completedGames); if (gameState.completedGames >= 10) { LK.showYouWin(); } } else { gameState.money += Math.floor(finalScore * 0.00125); } LK.getSound('release').play(); // Reset gameState.currentProject = null; developmentScreen.visible = false; mainMenu.visible = true; updateUI(); } // Game update var dayTimer = 0; game.update = function () { // Handle research progress if (gameState.currentResearch) { gameState.currentResearch.timeRemaining--; if (gameState.currentResearch.timeRemaining <= 0) { // Research complete var research = gameState.currentResearch; gameState.researchedFeatures[research.category].push(research.name); gameState.currentResearch = null; LK.getSound('success').play(); // Show notification var notification = new Container(); game.addChild(notification); var bg = LK.getAsset('card', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 0.8 }); bg.tint = 0x4CAF50; notification.addChild(bg); var text = new Text2('Research Complete: ' + research.name, { size: 35, fill: 0xFFFFFF }); text.anchor.set(0.5, 0.5); notification.addChild(text); notification.x = 1024; notification.y = 600; notification.alpha = 0; tween(notification, { alpha: 1 }, { duration: 500, onFinish: function onFinish() { LK.setTimeout(function () { tween(notification, { alpha: 0 }, { duration: 500, onFinish: function onFinish() { notification.destroy(); } }); }, 2000); } }); } } // Day progression (every 3 seconds = 1 day) dayTimer++; if (dayTimer >= 180) { // 60 fps * 3 seconds dayTimer = 0; gameState.currentDay++; updateUI(); // Process game sales for (var i = gameState.releasedGames.length - 1; i >= 0; i--) { var releasedGame = gameState.releasedGames[i]; var daysSinceRelease = gameState.currentDay - releasedGame.releaseDay; // Calculate sales decline var declineRate = 0.75; // Base 25% daily decline // Better games decline slower if (releasedGame.score >= releasedGame.targetScore * 1.5) { declineRate = 0.85; } else if (releasedGame.score >= releasedGame.targetScore) { declineRate = 0.80; } // Apply trend bonus to decline rate declineRate += (releasedGame.trendBonus - 1) * 0.03; declineRate = Math.min(declineRate, 0.90); // Calculate current day sales releasedGame.currentDailySales = Math.floor(releasedGame.initialDailySales * Math.pow(declineRate, daysSinceRelease)); // Add to total sales and money if (releasedGame.currentDailySales > 0) { releasedGame.totalSales += releasedGame.currentDailySales; var revenue = Math.floor(releasedGame.currentDailySales * 0.25); gameState.money += revenue; } else { // Game no longer selling - remove from market var removedGame = gameState.releasedGames.splice(i, 1)[0]; gameState.gameHistory.push(removedGame); // Show notification var notification = new Container(); game.addChild(notification); var bg = LK.getAsset('card', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 1.2 }); bg.tint = 0x0f3460; notification.addChild(bg); var titleText = new Text2(removedGame.name + ' removed from market', { size: 35, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.y = -30; notification.addChild(titleText); var salesText = new Text2('Total copies sold: ' + removedGame.totalSales, { size: 30, fill: 0x4CAF50 }); salesText.anchor.set(0.5, 0.5); salesText.y = 20; notification.addChild(salesText); notification.x = 1024; notification.y = 1366; notification.alpha = 0; // Animate notification tween(notification, { alpha: 1, y: 1000 }, { duration: 500, onFinish: function onFinish() { LK.setTimeout(function () { tween(notification, { alpha: 0 }, { duration: 500, onFinish: function onFinish() { notification.destroy(); } }); }, 2000); } }); } } updateUI(); } if (gameState.currentProject && developmentScreen.visible) { var project = gameState.currentProject; // Development progress if (project.currentScore < project.targetScore * 10) { // Calculate points per tick var pointsPerTick = project.developmentSpeed / 30; // Feature synergy bonus var synergy = 1; // Main character synergy if (gameState.mainCharacter.featurePoints) { project.features.forEach(function (feature) { if (gameState.mainCharacter.featurePoints[feature.type] && gameState.mainCharacter.featurePoints[feature.type] > 0) { synergy += 0.1; } }); } // Other developers project.features.forEach(function (feature) { gameState.developers.forEach(function (dev) { if (dev.specialty === feature.type) { synergy += 0.1; } }); }); project.currentScore += pointsPerTick * synergy; // Update UI currentScoreText.setText('Current Score: ' + Math.floor(project.currentScore)); var progress = Math.min(project.currentScore / (project.targetScore * 10), 1); progressBarFill.scaleX = progress; // Show release button when ready if (progress >= 1 && !releaseBtn.visible) { releaseBtn.visible = true; tween(releaseBtn, { scaleX: 1.1, scaleY: 1.1 }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { tween(releaseBtn, { scaleX: 1, scaleY: 1 }, { duration: 500 }); } }); } } } // Check game over if (gameState.money < 100 && gameState.developers.length === 0 && !gameState.currentProject) { LK.showGameOver(); } }; // Global Back Button var globalBackBtn = new Button(); globalBackBtn.setLabel('Geri'); // Place at bottom center, matching other menu button size (400x100) globalBackBtn.x = 1024; globalBackBtn.y = 2600; globalBackBtn.visible = false; LK.gui.bottom.addChild(globalBackBtn); // Helper to check if any menu except mainMenu is visible function isAnyMenuOpen() { return upgradeMenu.visible || researchMenu.visible || researchCategoryMenu.visible || nameGameMenu.visible || allGamesMenu.visible || gameDetailView.visible || hireMenu.visible || projectMenu.visible || featureCategoryMenu.visible || developmentScreen.visible; } // Helper to close the topmost open menu and return to mainMenu function closeCurrentMenu() { if (upgradeMenu.visible) { upgradeMenu.visible = false; mainMenu.visible = true; } else if (researchCategoryMenu.visible) { researchCategoryMenu.visible = false; researchMenu.visible = true; } else if (researchMenu.visible) { researchMenu.visible = false; mainMenu.visible = true; } else if (nameGameMenu.visible) { nameGameMenu.visible = false; mainMenu.visible = true; gameNameInput.setText(''); currentGameName = ''; } else if (allGamesMenu.visible) { allGamesMenu.visible = false; mainMenu.visible = true; } else if (gameDetailView.visible) { gameDetailView.visible = false; allGamesMenu.visible = true; } else if (hireMenu.visible) { hireMenu.visible = false; mainMenu.visible = true; } else if (featureCategoryMenu.visible) { featureCategoryMenu.visible = false; projectMenu.visible = true; // Update total cost in project menu var totalCost = 0; selectedFeatures.forEach(function (f) { totalCost += f.cost; }); if (projectMenu.totalCostText) { projectMenu.totalCostText.setText('Total Cost: $' + totalCost); } } else if (projectMenu.visible) { projectMenu.visible = false; mainMenu.visible = true; selectedFeatures = []; featureCards.forEach(function (card) { card.setSelected(false); }); } else if (developmentScreen.visible) { developmentScreen.visible = false; mainMenu.visible = true; } } // Attach handler to global back button globalBackBtn.onClick = function () { closeCurrentMenu(); }; // Show/hide global back button depending on menu state function updateGlobalBackBtn() { // Show if any menu except mainMenu is visible globalBackBtn.visible = isAnyMenuOpen() && !mainMenu.visible; } // Patch all menu show functions to update global back button var _showUpgradeMenu = showUpgradeMenu; showUpgradeMenu = function showUpgradeMenu() { _showUpgradeMenu(); updateGlobalBackBtn(); }; var _showResearchMenu = showResearchMenu; showResearchMenu = function showResearchMenu() { _showResearchMenu(); updateGlobalBackBtn(); }; var _showAllGamesMenu = showAllGamesMenu; showAllGamesMenu = function showAllGamesMenu() { _showAllGamesMenu(); updateGlobalBackBtn(); }; var _showHireMenu = showHireMenu; showHireMenu = function showHireMenu() { _showHireMenu(); updateGlobalBackBtn(); }; var _showProjectMenu = showProjectMenu; showProjectMenu = function showProjectMenu() { _showProjectMenu(); updateGlobalBackBtn(); }; var _showFeatureCategory = showFeatureCategory; showFeatureCategory = function showFeatureCategory(category) { _showFeatureCategory(category); updateGlobalBackBtn(); }; var _showResearchCategory = showResearchCategory; showResearchCategory = function showResearchCategory(category) { _showResearchCategory(category); updateGlobalBackBtn(); }; var _showNameGameMenu = showNameGameMenu; showNameGameMenu = function showNameGameMenu() { _showNameGameMenu(); updateGlobalBackBtn(); }; var _showGameDetail = showGameDetail; showGameDetail = function showGameDetail(gameData) { _showGameDetail(gameData); updateGlobalBackBtn(); }; // Patch all menu back/close buttons to update global back button function patchBackBtn(btn, closeFn) { var old = btn.onClick; btn.onClick = function () { if (old) old(); updateGlobalBackBtn(); }; } patchBackBtn(backFromUpgradeBtn); patchBackBtn(researchBackBtn); patchBackBtn(categoryBackBtn); patchBackBtn(backFromNameBtn); patchBackBtn(backFromAllGamesBtn); patchBackBtn(detailBackBtn); patchBackBtn(backFromHireBtn); patchBackBtn(backFromProjectBtn); patchBackBtn(categoryBackBtn); patchBackBtn(researchBackBtn); patchBackBtn(categoryBackBtn); // Also update on developmentScreen close (release) var _releaseGame = releaseGame; releaseGame = function releaseGame() { _releaseGame(); updateGlobalBackBtn(); }; // Also update on game update (in case of state changes) var _updateUI = updateUI; updateUI = function updateUI() { _updateUI(); updateGlobalBackBtn(); }; // Initialize updateUI(); updateGlobalBackBtn();
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Button = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('button', {
anchorX: 0.5,
anchorY: 0.5
});
var label = new Text2('Button', {
size: 40,
fill: 0xFFFFFF
});
label.anchor.set(0.5, 0.5);
self.addChild(label);
self.setLabel = function (text) {
label.setText(text);
};
self.down = function () {
tween(bg, {
scaleX: 0.95,
scaleY: 0.95
}, {
duration: 100
});
LK.getSound('select').play();
};
self.up = function () {
tween(bg, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
if (self.onClick) {
self.onClick();
}
};
return self;
});
var DeveloperCard = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('card', {
anchorX: 0.5,
anchorY: 0.5
});
var icon = self.attachAsset('developerIcon', {
anchorX: 0.5,
anchorY: 0.5,
y: -100
});
var nameText = new Text2('Developer', {
size: 30,
fill: 0xFFFFFF
});
nameText.anchor.set(0.5, 0.5);
nameText.y = -20;
self.addChild(nameText);
var specialtyText = new Text2('Graphics', {
size: 25,
fill: 0xFFC107
});
specialtyText.anchor.set(0.5, 0.5);
specialtyText.y = 20;
self.addChild(specialtyText);
var costText = new Text2('Cost: $100', {
size: 25,
fill: 0x4CAF50
});
costText.anchor.set(0.5, 0.5);
costText.y = 60;
self.addChild(costText);
var skillText = new Text2('Skill: 5', {
size: 25,
fill: 0x2196F3
});
skillText.anchor.set(0.5, 0.5);
skillText.y = 100;
self.addChild(skillText);
self.developerData = null;
self.setDeveloper = function (data) {
self.developerData = data;
nameText.setText(data.name);
specialtyText.setText(data.specialty);
costText.setText('Cost: $' + data.cost);
skillText.setText('Skill: ' + data.skill);
var specialtyColors = {
'Graphics': 0xff5722,
'Sound': 0x9c27b0,
'Gameplay': 0x2196f3
};
icon.tint = specialtyColors[data.specialty] || 0xffc107;
};
self.down = function () {
if (self.onClick) {
self.onClick(self.developerData);
}
};
return self;
});
var FeatureCard = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('card', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
});
var icon = self.attachAsset('featureIcon', {
anchorX: 0.5,
anchorY: 0.5,
y: -80
});
var nameText = new Text2('Feature', {
size: 25,
fill: 0xFFFFFF
});
nameText.anchor.set(0.5, 0.5);
nameText.y = -20;
self.addChild(nameText);
var typeText = new Text2('Type', {
size: 20,
fill: 0x2196F3
});
typeText.anchor.set(0.5, 0.5);
typeText.y = 10;
self.addChild(typeText);
var pointsText = new Text2('Points: 0', {
size: 20,
fill: 0x4CAF50
});
pointsText.anchor.set(0.5, 0.5);
pointsText.y = 40;
self.addChild(pointsText);
self.featureData = null;
self.selected = false;
self.setFeature = function (data) {
self.featureData = data;
nameText.setText(data.name);
typeText.setText(data.type);
pointsText.setText('Points: ' + data.basePoints + ' | Cost: $' + data.cost);
var typeColors = {
'Graphics': 0xff5722,
'Sound': 0x9c27b0,
'Gameplay': 0x2196f3
};
icon.tint = typeColors[data.type] || 0xffc107;
};
self.setSelected = function (selected) {
self.selected = selected;
bg.tint = selected ? 0xe94560 : 0xffffff;
};
self.down = function () {
if (self.onClick) {
self.onClick(self);
}
};
return self;
});
var GameHistoryCard = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('card', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 0.6
});
var nameText = new Text2('Game Name', {
size: 30,
fill: 0xFFFFFF
});
nameText.anchor.set(0.5, 0.5);
nameText.y = -30;
self.addChild(nameText);
var salesText = new Text2('Sales: 0', {
size: 25,
fill: 0x4CAF50
});
salesText.anchor.set(0.5, 0.5);
salesText.y = 10;
self.addChild(salesText);
self.gameData = null;
self.setGameData = function (data) {
self.gameData = data;
nameText.setText(data.name);
var salesInfo = data.currentDailySales > 0 ? 'Sales: ' + data.totalSales + ' (Active)' : 'Sales: ' + data.totalSales + ' (Ended)';
salesText.setText(salesInfo);
bg.tint = data.currentDailySales > 0 ? 0x0f3460 : 0x16213e;
};
self.down = function () {
if (self.onClick) {
self.onClick(self.gameData);
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a2e
});
/****
* Game Code
****/
// Game state
var gameState = {
money: 10000,
developers: [],
currentProject: null,
completedGames: 0,
marketTrends: [],
currentDay: 1,
releasedGames: [],
maxHireableDevelopers: 1,
studioLevel: 1,
studioUpgradeCost: 5000,
mainCharacter: {
name: "You",
level: 1,
upgradeCost: 2000,
skill: 2,
specialty: "All",
featurePoints: {
Graphics: 1,
Sound: 1,
Gameplay: 1
}
},
gameHistory: [],
researchedFeatures: {
Graphics: [],
Sound: [],
Gameplay: [],
GameGenres: []
},
currentResearch: null
};
// Current game name being created
var currentGameName = '';
// Game name display at top
var gameNameDisplay = new Text2('', {
size: 45,
fill: 0xFFFFFF
});
gameNameDisplay.anchor.set(0.5, 0);
gameNameDisplay.y = 10;
LK.gui.top.addChild(gameNameDisplay);
// Available developers pool
var developerPool = [{
name: 'Alex',
specialty: 'Graphics',
skill: 3,
cost: 500
}, {
name: 'Sam',
specialty: 'Sound',
skill: 4,
cost: 1000
}, {
name: 'Jordan',
specialty: 'Gameplay',
skill: 5,
cost: 1500
}, {
name: 'Morgan',
specialty: 'Graphics',
skill: 6,
cost: 2000
}, {
name: 'Casey',
specialty: 'Sound',
skill: 7,
cost: 2500
}, {
name: 'Drew',
specialty: 'Gameplay',
skill: 8,
cost: 3000
}];
// Available features - expanded with research requirements
var featurePool = [{
name: 'Pixel Art',
type: 'Graphics',
basePoints: 3,
cost: 100,
requiresResearch: false
}, {
name: '3D Models',
type: 'Graphics',
basePoints: 5,
cost: 300,
requiresResearch: false
}, {
name: 'Particle Effects',
type: 'Graphics',
basePoints: 4,
cost: 200,
requiresResearch: false
}, {
name: 'Soundtrack',
type: 'Sound',
basePoints: 3,
cost: 150,
requiresResearch: false
}, {
name: 'Voice Acting',
type: 'Sound',
basePoints: 6,
cost: 400,
requiresResearch: false
}, {
name: 'Sound Effects',
type: 'Sound',
basePoints: 4,
cost: 200,
requiresResearch: false
}, {
name: 'RPG Elements',
type: 'Gameplay',
basePoints: 5,
cost: 250,
requiresResearch: false
}, {
name: 'Multiplayer',
type: 'Gameplay',
basePoints: 7,
cost: 500,
requiresResearch: false
}, {
name: 'Puzzles',
type: 'Gameplay',
basePoints: 4,
cost: 200,
requiresResearch: false
}, {
name: 'Open World',
type: 'Gameplay',
basePoints: 8,
cost: 600,
requiresResearch: false
}, {
name: 'Shaders',
type: 'Graphics',
basePoints: 6,
cost: 400,
requiresResearch: true
}, {
name: 'Ray Tracing',
type: 'Graphics',
basePoints: 10,
cost: 800,
requiresResearch: true
}, {
name: 'Motion Capture',
type: 'Graphics',
basePoints: 8,
cost: 600,
requiresResearch: true
}, {
name: 'Procedural Generation',
type: 'Graphics',
basePoints: 7,
cost: 500,
requiresResearch: true
}, {
name: 'Dynamic Lighting',
type: 'Graphics',
basePoints: 6,
cost: 450,
requiresResearch: true
}, {
name: 'Orchestral Score',
type: 'Sound',
basePoints: 8,
cost: 600,
requiresResearch: true
}, {
name: '3D Audio',
type: 'Sound',
basePoints: 7,
cost: 500,
requiresResearch: true
}, {
name: 'Dynamic Music',
type: 'Sound',
basePoints: 6,
cost: 400,
requiresResearch: true
}, {
name: 'Environmental Audio',
type: 'Sound',
basePoints: 5,
cost: 350,
requiresResearch: true
}, {
name: 'Foley Effects',
type: 'Sound',
basePoints: 6,
cost: 450,
requiresResearch: true
}, {
name: 'Physics Engine',
type: 'Gameplay',
basePoints: 9,
cost: 700,
requiresResearch: true
}, {
name: 'AI Systems',
type: 'Gameplay',
basePoints: 10,
cost: 800,
requiresResearch: true
}, {
name: 'Skill Trees',
type: 'Gameplay',
basePoints: 6,
cost: 400,
requiresResearch: true
}, {
name: 'Crafting System',
type: 'Gameplay',
basePoints: 7,
cost: 500,
requiresResearch: true
}, {
name: 'Dialogue System',
type: 'Gameplay',
basePoints: 5,
cost: 350,
requiresResearch: true
}];
// Game genres that can be researched
var gameGenres = [{
name: 'Action',
baseMultiplier: 1.2,
trendChance: 0.3,
researchCost: 1000,
requiresResearch: false
}, {
name: 'Adventure',
baseMultiplier: 1.1,
trendChance: 0.25,
researchCost: 800,
requiresResearch: false
}, {
name: 'Puzzle',
baseMultiplier: 1.0,
trendChance: 0.2,
researchCost: 600,
requiresResearch: false
}, {
name: 'Racing',
baseMultiplier: 1.3,
trendChance: 0.35,
researchCost: 1200,
requiresResearch: true
}, {
name: 'Strategy',
baseMultiplier: 1.4,
trendChance: 0.3,
researchCost: 1500,
requiresResearch: true
}, {
name: 'Simulation',
baseMultiplier: 1.2,
trendChance: 0.25,
researchCost: 1000,
requiresResearch: true
}, {
name: 'RPG',
baseMultiplier: 1.5,
trendChance: 0.4,
researchCost: 2000,
requiresResearch: true
}, {
name: 'FPS',
baseMultiplier: 1.4,
trendChance: 0.35,
researchCost: 1800,
requiresResearch: true
}, {
name: 'Horror',
baseMultiplier: 1.3,
trendChance: 0.25,
researchCost: 1200,
requiresResearch: true
}, {
name: 'Sports',
baseMultiplier: 1.2,
trendChance: 0.3,
researchCost: 1000,
requiresResearch: true
}];
// UI Elements
var moneyText = new Text2('Money: $10000', {
size: 50,
fill: 0x4CAF50
});
moneyText.anchor.set(1, 0);
LK.gui.topRight.addChild(moneyText);
var developersText = new Text2('Developers: 0', {
size: 40,
fill: 0xFFFFFF
});
developersText.anchor.set(1, 0);
developersText.y = 60;
LK.gui.topRight.addChild(developersText);
var gamesText = new Text2('Games Released: 0', {
size: 40,
fill: 0xFFC107
});
gamesText.anchor.set(1, 0);
gamesText.y = 110;
LK.gui.topRight.addChild(gamesText);
var dayText = new Text2('Day: 1', {
size: 40,
fill: 0x2196F3
});
dayText.anchor.set(1, 0);
dayText.y = 160;
LK.gui.topRight.addChild(dayText);
// Main menu container
var mainMenu = new Container();
game.addChild(mainMenu);
var titleText = new Text2('Game Dev Studio', {
size: 80,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 1024;
titleText.y = 300;
mainMenu.addChild(titleText);
var nameGameBtn = new Button();
nameGameBtn.setLabel('Name Your Game');
nameGameBtn.x = 1024;
nameGameBtn.y = 600;
nameGameBtn.onClick = showNameGameMenu;
mainMenu.addChild(nameGameBtn);
var hireDeveloperBtn = new Button();
hireDeveloperBtn.setLabel('Hire Developer');
hireDeveloperBtn.x = 1024;
hireDeveloperBtn.y = 750;
hireDeveloperBtn.onClick = showHireMenu;
mainMenu.addChild(hireDeveloperBtn);
var startProjectBtn = new Button();
startProjectBtn.setLabel('Start Project');
startProjectBtn.x = 1024;
startProjectBtn.y = 900;
startProjectBtn.onClick = showProjectMenu;
mainMenu.addChild(startProjectBtn);
var allGamesBtn = new Button();
allGamesBtn.setLabel('All Released Games');
allGamesBtn.x = 1024;
allGamesBtn.y = 1050;
allGamesBtn.onClick = showAllGamesMenu;
mainMenu.addChild(allGamesBtn);
var researchBtn = new Button();
researchBtn.setLabel('Research');
researchBtn.x = 1024;
researchBtn.y = 1200;
researchBtn.onClick = showResearchMenu;
mainMenu.addChild(researchBtn);
// --- Upgrade Button and Menu ---
var upgradeBtn = new Button();
upgradeBtn.setLabel('Yükselt');
upgradeBtn.x = 1024;
upgradeBtn.y = 1350;
upgradeBtn.onClick = showUpgradeMenu;
mainMenu.addChild(upgradeBtn);
var upgradeMenu = new Container();
upgradeMenu.visible = false;
game.addChild(upgradeMenu);
var upgradeTitle = new Text2('Stüdyo Yükseltmeleri', {
size: 60,
fill: 0xFFFFFF
});
upgradeTitle.anchor.set(0.5, 0.5);
upgradeTitle.x = 1024;
upgradeTitle.y = 200;
upgradeMenu.addChild(upgradeTitle);
var studioLevelText = new Text2('', {
size: 40,
fill: 0xFFC107
});
studioLevelText.anchor.set(0.5, 0.5);
studioLevelText.x = 1024;
studioLevelText.y = 350;
upgradeMenu.addChild(studioLevelText);
var studioUpgradeCostText = new Text2('', {
size: 35,
fill: 0x4CAF50
});
studioUpgradeCostText.anchor.set(0.5, 0.5);
studioUpgradeCostText.x = 1024;
studioUpgradeCostText.y = 420;
upgradeMenu.addChild(studioUpgradeCostText);
var studioUpgradeBtn = new Button();
studioUpgradeBtn.setLabel('Stüdyo Seviyesini Yükselt');
studioUpgradeBtn.x = 1024;
studioUpgradeBtn.y = 500;
studioUpgradeBtn.onClick = function () {
if (gameState.money >= gameState.studioUpgradeCost) {
gameState.money -= gameState.studioUpgradeCost;
gameState.studioLevel += 1;
gameState.maxHireableDevelopers = 1 + gameState.studioLevel;
gameState.studioUpgradeCost = Math.floor(gameState.studioUpgradeCost * 1.7);
updateUI();
showUpgradeMenu();
LK.getSound('success').play();
}
};
upgradeMenu.addChild(studioUpgradeBtn);
// --- Main Character Section ---
var mainCharTitle = new Text2('Ana Karakterin', {
size: 40,
fill: 0xFFFFFF
});
mainCharTitle.anchor.set(0.5, 0.5);
mainCharTitle.x = 1024;
mainCharTitle.y = 700;
upgradeMenu.addChild(mainCharTitle);
var mainCharLevelText = new Text2('', {
size: 35,
fill: 0xFFC107
});
mainCharLevelText.anchor.set(0.5, 0.5);
mainCharLevelText.x = 1024;
mainCharLevelText.y = 770;
upgradeMenu.addChild(mainCharLevelText);
var mainCharSkillText = new Text2('', {
size: 30,
fill: 0x2196F3
});
mainCharSkillText.anchor.set(0.5, 0.5);
mainCharSkillText.x = 1024;
mainCharSkillText.y = 820;
upgradeMenu.addChild(mainCharSkillText);
var mainCharUpgradeCostText = new Text2('', {
size: 30,
fill: 0x4CAF50
});
mainCharUpgradeCostText.anchor.set(0.5, 0.5);
mainCharUpgradeCostText.x = 1024;
mainCharUpgradeCostText.y = 870;
upgradeMenu.addChild(mainCharUpgradeCostText);
var mainCharUpgradeBtn = new Button();
mainCharUpgradeBtn.setLabel('Ana Karakteri Yükselt');
mainCharUpgradeBtn.x = 1024;
mainCharUpgradeBtn.y = 950;
mainCharUpgradeBtn.onClick = function () {
if (gameState.money >= gameState.mainCharacter.upgradeCost) {
gameState.money -= gameState.mainCharacter.upgradeCost;
gameState.mainCharacter.level += 1;
gameState.mainCharacter.skill += 1;
// Each level, increase all feature points by 1
gameState.mainCharacter.featurePoints.Graphics += 1;
gameState.mainCharacter.featurePoints.Sound += 1;
gameState.mainCharacter.featurePoints.Gameplay += 1;
gameState.mainCharacter.upgradeCost = Math.floor(gameState.mainCharacter.upgradeCost * 1.8);
updateUI();
showUpgradeMenu();
LK.getSound('success').play();
}
};
upgradeMenu.addChild(mainCharUpgradeBtn);
var backFromUpgradeBtn = new Button();
backFromUpgradeBtn.setLabel('Geri');
backFromUpgradeBtn.x = 1024;
backFromUpgradeBtn.y = 2400;
backFromUpgradeBtn.onClick = function () {
upgradeMenu.visible = false;
mainMenu.visible = true;
};
upgradeMenu.addChild(backFromUpgradeBtn);
function showUpgradeMenu() {
mainMenu.visible = false;
upgradeMenu.visible = true;
studioLevelText.setText('Stüdyo Seviyesi: ' + gameState.studioLevel);
studioUpgradeCostText.setText('Yükseltme Maliyeti: $' + gameState.studioUpgradeCost);
mainCharLevelText.setText('Ana Karakter Seviye: ' + gameState.mainCharacter.level);
mainCharSkillText.setText('Her Özellik Puanı: ' + 'Grafik: ' + gameState.mainCharacter.featurePoints.Graphics + ', Ses: ' + gameState.mainCharacter.featurePoints.Sound + ', Oynanış: ' + gameState.mainCharacter.featurePoints.Gameplay);
mainCharUpgradeCostText.setText('Yükseltme Maliyeti: $' + gameState.mainCharacter.upgradeCost);
}
// Research menu container
var researchMenu = new Container();
researchMenu.visible = false;
game.addChild(researchMenu);
var researchTitle = new Text2('Research Lab', {
size: 60,
fill: 0xFFFFFF
});
researchTitle.anchor.set(0.5, 0.5);
researchTitle.x = 1024;
researchTitle.y = 200;
researchMenu.addChild(researchTitle);
var researchBackBtn = new Button();
researchBackBtn.setLabel('Back');
researchBackBtn.x = 1024;
researchBackBtn.y = 2400;
researchBackBtn.onClick = function () {
researchMenu.visible = false;
mainMenu.visible = true;
};
researchMenu.addChild(researchBackBtn);
// Research category menu
var researchCategoryMenu = new Container();
researchCategoryMenu.visible = false;
game.addChild(researchCategoryMenu);
var categoryTitle = new Text2('', {
size: 60,
fill: 0xFFFFFF
});
categoryTitle.anchor.set(0.5, 0.5);
categoryTitle.x = 1024;
categoryTitle.y = 200;
researchCategoryMenu.addChild(categoryTitle);
var categoryBackBtn = new Button();
categoryBackBtn.setLabel('Back');
categoryBackBtn.x = 1024;
categoryBackBtn.y = 2400;
categoryBackBtn.onClick = function () {
researchCategoryMenu.visible = false;
researchMenu.visible = true;
};
researchCategoryMenu.addChild(categoryBackBtn);
// Name game menu container
var nameGameMenu = new Container();
nameGameMenu.visible = false;
game.addChild(nameGameMenu);
var nameGameTitle = new Text2('Name Your Game', {
size: 60,
fill: 0xFFFFFF
});
nameGameTitle.anchor.set(0.5, 0.5);
nameGameTitle.x = 1024;
nameGameTitle.y = 200;
nameGameMenu.addChild(nameGameTitle);
var gameNameInput = new Text2('', {
size: 50,
fill: 0x4CAF50
});
gameNameInput.anchor.set(0.5, 0.5);
gameNameInput.x = 1024;
gameNameInput.y = 400;
nameGameMenu.addChild(gameNameInput);
var inputPrompt = new Text2('Tap to enter game name', {
size: 30,
fill: 0xFFFFFF
});
inputPrompt.anchor.set(0.5, 0.5);
inputPrompt.x = 1024;
inputPrompt.y = 500;
nameGameMenu.addChild(inputPrompt);
var randomNameBtn = new Button();
randomNameBtn.setLabel('Random Name');
randomNameBtn.x = 1024;
randomNameBtn.y = 700;
randomNameBtn.onClick = generateRandomName;
nameGameMenu.addChild(randomNameBtn);
var confirmNameBtn = new Button();
confirmNameBtn.setLabel('Confirm Name');
confirmNameBtn.x = 1024;
confirmNameBtn.y = 850;
confirmNameBtn.onClick = confirmGameName;
nameGameMenu.addChild(confirmNameBtn);
var backFromNameBtn = new Button();
backFromNameBtn.setLabel('Back');
backFromNameBtn.x = 1024;
backFromNameBtn.y = 1000;
backFromNameBtn.onClick = function () {
nameGameMenu.visible = false;
mainMenu.visible = true;
gameNameInput.setText('');
currentGameName = '';
};
nameGameMenu.addChild(backFromNameBtn);
// Simple tap-to-edit name input
var nameInputBg = LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2,
scaleY: 1
});
nameInputBg.x = 1024;
nameInputBg.y = 400;
nameInputBg.alpha = 0.3;
nameGameMenu.addChild(nameInputBg);
nameInputBg.interactive = true;
nameInputBg.down = function () {
// Simulate simple text input with preset options
var names = ['Game Studio Pro', 'Developer Tycoon', 'Code Master', 'Pixel Dreams', 'Game Maker Plus'];
var randomIndex = Math.floor(Math.random() * names.length);
currentGameName = names[randomIndex];
gameNameInput.setText(currentGameName);
LK.getSound('select').play();
};
// Move gameNameInput to be on top
nameGameMenu.removeChild(gameNameInput);
nameGameMenu.addChild(gameNameInput);
// All games menu container
var allGamesMenu = new Container();
allGamesMenu.visible = false;
game.addChild(allGamesMenu);
var allGamesTitle = new Text2('All Released Games', {
size: 60,
fill: 0xFFFFFF
});
allGamesTitle.anchor.set(0.5, 0.5);
allGamesTitle.x = 1024;
allGamesTitle.y = 200;
allGamesMenu.addChild(allGamesTitle);
var noGamesText = new Text2('No games released yet', {
size: 40,
fill: 0xFFFFFF
});
noGamesText.anchor.set(0.5, 0.5);
noGamesText.x = 1024;
noGamesText.y = 600;
noGamesText.visible = false;
allGamesMenu.addChild(noGamesText);
var backFromAllGamesBtn = new Button();
backFromAllGamesBtn.setLabel('Back');
backFromAllGamesBtn.x = 1024;
backFromAllGamesBtn.y = 2400;
backFromAllGamesBtn.onClick = function () {
allGamesMenu.visible = false;
mainMenu.visible = true;
};
allGamesMenu.addChild(backFromAllGamesBtn);
// Game detail view container
var gameDetailView = new Container();
gameDetailView.visible = false;
game.addChild(gameDetailView);
var detailBackBtn = new Button();
detailBackBtn.setLabel('Back to Games List');
detailBackBtn.x = 1024;
detailBackBtn.y = 2400;
detailBackBtn.onClick = function () {
gameDetailView.visible = false;
allGamesMenu.visible = true;
};
gameDetailView.addChild(detailBackBtn);
// Hire menu container
var hireMenu = new Container();
hireMenu.visible = false;
game.addChild(hireMenu);
var hireTitle = new Text2('Hire Developer', {
size: 60,
fill: 0xFFFFFF
});
hireTitle.anchor.set(0.5, 0.5);
hireTitle.x = 1024;
hireTitle.y = 200;
hireMenu.addChild(hireTitle);
var backFromHireBtn = new Button();
backFromHireBtn.setLabel('Back');
backFromHireBtn.x = 1024;
backFromHireBtn.y = 2400;
backFromHireBtn.onClick = function () {
hireMenu.visible = false;
mainMenu.visible = true;
};
hireMenu.addChild(backFromHireBtn);
// Project menu container
var projectMenu = new Container();
projectMenu.visible = false;
game.addChild(projectMenu);
var projectTitle = new Text2('New Project', {
size: 60,
fill: 0xFFFFFF
});
projectTitle.anchor.set(0.5, 0.5);
projectTitle.x = 1024;
projectTitle.y = 200;
projectMenu.addChild(projectTitle);
var selectFeaturesText = new Text2('Select 5 Features:', {
size: 40,
fill: 0xFFFFFF
});
selectFeaturesText.anchor.set(0.5, 0.5);
selectFeaturesText.x = 1024;
selectFeaturesText.y = 300;
projectMenu.addChild(selectFeaturesText);
var startDevelopmentBtn = new Button();
startDevelopmentBtn.setLabel('Start Development');
startDevelopmentBtn.x = 1024;
startDevelopmentBtn.y = 2200;
startDevelopmentBtn.onClick = startDevelopment;
projectMenu.addChild(startDevelopmentBtn);
var backFromProjectBtn = new Button();
backFromProjectBtn.setLabel('Back');
backFromProjectBtn.x = 1024;
backFromProjectBtn.y = 2350;
backFromProjectBtn.onClick = function () {
projectMenu.visible = false;
mainMenu.visible = true;
selectedFeatures = [];
featureCards.forEach(function (card) {
card.setSelected(false);
});
};
projectMenu.addChild(backFromProjectBtn);
// Feature category menu
var featureCategoryMenu = new Container();
featureCategoryMenu.visible = false;
game.addChild(featureCategoryMenu);
var categoryMenuTitle = new Text2('', {
size: 60,
fill: 0xFFFFFF
});
categoryMenuTitle.anchor.set(0.5, 0.5);
categoryMenuTitle.x = 1024;
categoryMenuTitle.y = 200;
featureCategoryMenu.addChild(categoryMenuTitle);
var selectedFeaturesText = new Text2('Selected: 0/5', {
size: 40,
fill: 0xFFFFFF
});
selectedFeaturesText.anchor.set(0.5, 0.5);
selectedFeaturesText.x = 1024;
selectedFeaturesText.y = 300;
featureCategoryMenu.addChild(selectedFeaturesText);
var categoryBackBtn = new Button();
categoryBackBtn.setLabel('Back to Categories');
categoryBackBtn.x = 1024;
categoryBackBtn.y = 2350;
categoryBackBtn.onClick = function () {
featureCategoryMenu.visible = false;
projectMenu.visible = true;
// Update total cost in project menu
var totalCost = 0;
selectedFeatures.forEach(function (f) {
totalCost += f.cost;
});
if (projectMenu.totalCostText) {
projectMenu.totalCostText.setText('Total Cost: $' + totalCost);
}
};
featureCategoryMenu.addChild(categoryBackBtn);
// Development screen
var developmentScreen = new Container();
developmentScreen.visible = false;
game.addChild(developmentScreen);
var devTitle = new Text2('Developing Game', {
size: 60,
fill: 0xFFFFFF
});
devTitle.anchor.set(0.5, 0.5);
devTitle.x = 1024;
devTitle.y = 200;
developmentScreen.addChild(devTitle);
var targetScoreText = new Text2('Target Score: 100', {
size: 40,
fill: 0xFFFFFF
});
targetScoreText.anchor.set(0.5, 0.5);
targetScoreText.x = 1024;
targetScoreText.y = 400;
developmentScreen.addChild(targetScoreText);
var currentScoreText = new Text2('Current Score: 0', {
size: 40,
fill: 0x4CAF50
});
currentScoreText.anchor.set(0.5, 0.5);
currentScoreText.x = 1024;
currentScoreText.y = 500;
developmentScreen.addChild(currentScoreText);
var progressBarBg = LK.getAsset('progressBar', {
anchorX: 0.5,
anchorY: 0.5
});
progressBarBg.x = 1024;
progressBarBg.y = 700;
developmentScreen.addChild(progressBarBg);
var progressBarFill = LK.getAsset('progressFill', {
anchorX: 0,
anchorY: 0.5
});
progressBarFill.x = 624;
progressBarFill.y = 700;
progressBarFill.scaleX = 0;
developmentScreen.addChild(progressBarFill);
var releaseBtn = new Button();
releaseBtn.setLabel('Release Game!');
releaseBtn.x = 1024;
releaseBtn.y = 900;
releaseBtn.visible = false;
releaseBtn.onClick = releaseGame;
developmentScreen.addChild(releaseBtn);
// Market trends display
var trendsContainer = new Container();
trendsContainer.x = 1024;
trendsContainer.y = 1200;
developmentScreen.addChild(trendsContainer);
var trendsTitle = new Text2('Market Trends:', {
size: 35,
fill: 0xFF5722
});
trendsTitle.anchor.set(0.5, 0.5);
trendsContainer.addChild(trendsTitle);
// Arrays for UI elements
var developerCards = [];
var featureCards = [];
var selectedFeatures = [];
// Functions
function updateUI() {
moneyText.setText('Money: $' + gameState.money);
developersText.setText('Developers: ' + gameState.developers.length);
gamesText.setText('Games Released: ' + gameState.completedGames);
dayText.setText('Day: ' + gameState.currentDay);
}
function showResearchMenu() {
mainMenu.visible = false;
researchMenu.visible = true;
// Clear existing buttons
for (var i = researchMenu.children.length - 1; i >= 0; i--) {
if (researchMenu.children[i] instanceof Button && researchMenu.children[i] !== researchBackBtn) {
researchMenu.children[i].destroy();
}
}
// Create category buttons
var categories = ['Graphics', 'Sound', 'Gameplay', 'GameGenres'];
categories.forEach(function (category, index) {
var btn = new Button();
var displayName = category === 'GameGenres' ? 'Game Genres' : category;
btn.setLabel(displayName + ' Research');
btn.x = 1024;
btn.y = 400 + index * 150;
btn.onClick = function () {
showResearchCategory(category);
};
researchMenu.addChild(btn);
});
}
function showResearchCategory(category) {
researchMenu.visible = false;
researchCategoryMenu.visible = true;
var displayName = category === 'GameGenres' ? 'Game Genres' : category;
categoryTitle.setText(displayName + ' Research');
// Clear existing items
for (var i = researchCategoryMenu.children.length - 1; i >= 0; i--) {
var child = researchCategoryMenu.children[i];
if (child !== categoryTitle && child !== categoryBackBtn) {
child.destroy();
}
}
// Get researchable items for this category
var items = [];
if (category === 'GameGenres') {
items = gameGenres.filter(function (genre) {
return genre.requiresResearch && gameState.researchedFeatures.GameGenres.indexOf(genre.name) === -1;
});
} else {
items = featurePool.filter(function (feature) {
return feature.type === category && feature.requiresResearch && gameState.researchedFeatures[category].indexOf(feature.name) === -1;
});
}
// Display research items
items.forEach(function (item, index) {
var container = new Container();
container.x = 1024;
container.y = 400 + index * 120;
var bg = LK.getAsset('card', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2,
scaleY: 0.4
});
container.addChild(bg);
var nameText = new Text2(item.name, {
size: 30,
fill: 0xFFFFFF
});
nameText.anchor.set(0.5, 0.5);
nameText.y = -20;
container.addChild(nameText);
var cost = category === 'GameGenres' ? item.researchCost : item.cost * 3;
var costText = new Text2('Research Cost: $' + cost, {
size: 25,
fill: 0x4CAF50
});
costText.anchor.set(0.5, 0.5);
costText.y = 20;
container.addChild(costText);
container.interactive = true;
container.down = function () {
if (gameState.money >= cost && !gameState.currentResearch) {
gameState.money -= cost;
gameState.currentResearch = {
name: item.name,
category: category,
timeRemaining: 180 // 3 seconds
};
updateUI();
LK.getSound('select').play();
showResearchCategory(category);
}
};
researchCategoryMenu.addChild(container);
});
// Add a Back button specifically for Game Genres Research page
if (category === 'GameGenres') {
// Remove previous genre back button if any
if (researchCategoryMenu.genreBackBtn) {
researchCategoryMenu.removeChild(researchCategoryMenu.genreBackBtn);
researchCategoryMenu.genreBackBtn.destroy();
researchCategoryMenu.genreBackBtn = null;
}
var genreBackBtn = new Button();
genreBackBtn.setLabel('Back');
genreBackBtn.x = 1024;
genreBackBtn.y = 2400;
genreBackBtn.onClick = function () {
researchCategoryMenu.visible = false;
researchMenu.visible = true;
updateGlobalBackBtn && updateGlobalBackBtn();
};
researchCategoryMenu.addChild(genreBackBtn);
researchCategoryMenu.genreBackBtn = genreBackBtn;
}
// Show current research if any
if (gameState.currentResearch) {
var researchInfo = new Text2('Currently researching: ' + gameState.currentResearch.name, {
size: 35,
fill: 0xFFC107
});
researchInfo.anchor.set(0.5, 0.5);
researchInfo.x = 1024;
researchInfo.y = 300;
researchCategoryMenu.addChild(researchInfo);
}
}
function showNameGameMenu() {
mainMenu.visible = false;
nameGameMenu.visible = true;
currentGameName = '';
gameNameInput.setText('');
}
function generateRandomName() {
var prefixes = ['Super', 'Mega', 'Ultra', 'Epic', 'Legendary', 'Amazing', 'Incredible', 'Fantastic'];
var genres = ['Adventure', 'Quest', 'Battle', 'World', 'Kingdom', 'Legend', 'Saga', 'Chronicles'];
var suffixes = ['2000', 'X', 'Plus', 'HD', 'Remastered', 'Ultimate', 'Deluxe', 'Pro'];
var name = prefixes[Math.floor(Math.random() * prefixes.length)] + ' ' + genres[Math.floor(Math.random() * genres.length)] + ' ' + suffixes[Math.floor(Math.random() * suffixes.length)];
currentGameName = name;
gameNameInput.setText(name);
LK.getSound('select').play();
}
function confirmGameName() {
if (currentGameName && currentGameName.length > 0) {
// Store the game name for later use
nameGameMenu.visible = false;
mainMenu.visible = true;
LK.getSound('success').play();
// Update game name display
gameNameDisplay.setText('Next Game: ' + currentGameName);
// Show confirmation message
var confirmText = new Text2('Next game will be: ' + currentGameName, {
size: 30,
fill: 0x4CAF50
});
confirmText.anchor.set(0.5, 0.5);
confirmText.x = 1024;
confirmText.y = 1050;
confirmText.alpha = 0;
mainMenu.addChild(confirmText);
tween(confirmText, {
alpha: 1
}, {
duration: 500,
onFinish: function onFinish() {
LK.setTimeout(function () {
tween(confirmText, {
alpha: 0
}, {
duration: 500,
onFinish: function onFinish() {
confirmText.destroy();
}
});
}, 2000);
}
});
}
}
function showAllGamesMenu() {
mainMenu.visible = false;
allGamesMenu.visible = true;
// Clear existing game cards
var cardsToRemove = [];
allGamesMenu.children.forEach(function (child) {
if (child instanceof GameHistoryCard) {
cardsToRemove.push(child);
}
});
cardsToRemove.forEach(function (card) {
card.destroy();
});
// Show all games (both active and completed)
var allGames = gameState.releasedGames.concat(gameState.gameHistory);
if (allGames.length === 0) {
noGamesText.visible = true;
} else {
noGamesText.visible = false;
allGames.forEach(function (game, index) {
var card = new GameHistoryCard();
card.setGameData(game);
card.x = 1024;
card.y = 400 + index * 150;
card.onClick = showGameDetail;
allGamesMenu.addChild(card);
});
}
}
function showGameDetail(gameData) {
allGamesMenu.visible = false;
gameDetailView.visible = true;
// Clear previous content
for (var i = gameDetailView.children.length - 1; i >= 0; i--) {
if (gameDetailView.children[i] !== detailBackBtn) {
gameDetailView.children[i].destroy();
}
}
// Game title
var titleText = new Text2(gameData.name, {
size: 60,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 1024;
titleText.y = 200;
gameDetailView.addChild(titleText);
// Release info
var releaseText = new Text2('Released on Day ' + gameData.releaseDay, {
size: 35,
fill: 0x2196F3
});
releaseText.anchor.set(0.5, 0.5);
releaseText.x = 1024;
releaseText.y = 300;
gameDetailView.addChild(releaseText);
// Sales info
var salesStatus = gameData.currentDailySales > 0 ? 'Active' : 'Ended';
var salesText = new Text2('Total Sales: ' + gameData.totalSales + ' copies (' + salesStatus + ')', {
size: 35,
fill: 0x4CAF50
});
salesText.anchor.set(0.5, 0.5);
salesText.x = 1024;
salesText.y = 380;
gameDetailView.addChild(salesText);
// Score info
var scoreText = new Text2('Score: ' + Math.floor(gameData.score) + ' / ' + gameData.targetScore, {
size: 35,
fill: 0xFFC107
});
scoreText.anchor.set(0.5, 0.5);
scoreText.x = 1024;
scoreText.y = 460;
gameDetailView.addChild(scoreText);
// Genre info
if (gameData.genre) {
var genreText = new Text2('Genre: ' + gameData.genre.name, {
size: 35,
fill: 0x9C27B0
});
genreText.anchor.set(0.5, 0.5);
genreText.x = 1024;
genreText.y = 540;
gameDetailView.addChild(genreText);
}
// Features title
var featuresTitle = new Text2('Features Used:', {
size: 40,
fill: 0xFFFFFF
});
featuresTitle.anchor.set(0.5, 0.5);
featuresTitle.x = 1024;
featuresTitle.y = 600;
gameDetailView.addChild(featuresTitle);
// Display features
gameData.features.forEach(function (feature, index) {
var featureText = new Text2('• ' + feature.name + ' (' + feature.type + ')', {
size: 30,
fill: 0x2196F3
});
featureText.anchor.set(0.5, 0.5);
featureText.x = 1024;
featureText.y = 680 + index * 40;
gameDetailView.addChild(featureText);
});
// Developers title
var devsTitle = new Text2('Developed by:', {
size: 40,
fill: 0xFFFFFF
});
devsTitle.anchor.set(0.5, 0.5);
devsTitle.x = 1024;
devsTitle.y = 1000;
gameDetailView.addChild(devsTitle);
// Display developers if stored
if (gameData.developers) {
gameData.developers.forEach(function (dev, index) {
var devText = new Text2('• ' + dev.name + ' (' + dev.specialty + ', Skill: ' + dev.skill + ')', {
size: 30,
fill: 0xFFC107
});
devText.anchor.set(0.5, 0.5);
devText.x = 1024;
devText.y = 1080 + index * 40;
gameDetailView.addChild(devText);
});
}
}
function showHireMenu() {
mainMenu.visible = false;
hireMenu.visible = true;
// Clear existing cards
developerCards.forEach(function (card) {
card.destroy();
});
developerCards = [];
// Show available developers info
var infoText = new Text2('Available Developers: ' + gameState.maxHireableDevelopers, {
size: 35,
fill: 0xFFC107
});
infoText.anchor.set(0.5, 0.5);
infoText.x = 1024;
infoText.y = 350;
hireMenu.addChild(infoText);
// Show main character as always hired
var mainCharCard = new DeveloperCard();
mainCharCard.setDeveloper({
name: gameState.mainCharacter.name,
specialty: "All",
skill: gameState.mainCharacter.skill,
cost: 0
});
mainCharCard.x = 1024;
mainCharCard.y = 600;
mainCharCard.developerData = {
name: gameState.mainCharacter.name,
specialty: "All",
skill: gameState.mainCharacter.skill,
cost: 0
};
mainCharCard.down = function () {};
hireMenu.addChild(mainCharCard);
developerCards.push(mainCharCard);
// Create developer cards as a list, restrict hiring to studio level
var availableDevelopers = developerPool.filter(function (dev) {
return !gameState.developers.some(function (hired) {
return hired.name === dev.name;
});
});
// Only allow hiring up to maxHireableDevelopers (studioLevel+1, including main character)
var canHireCount = gameState.maxHireableDevelopers - gameState.developers.length;
if (canHireCount < 0) canHireCount = 0;
// Show all developers in a vertical list, but disable/hide hire if limit reached
availableDevelopers.forEach(function (dev, index) {
var card = new DeveloperCard();
card.setDeveloper(dev);
card.x = 1024;
card.y = 1000 + index * 450;
// If we can't hire more, gray out the card and disable click
if (index >= canHireCount) {
card.alpha = 0.4;
card.down = function () {
// Optionally show a message or play a sound
LK.getSound('select').play();
};
// Show a message overlay
var lockText = new Text2('Stüdyo seviyesini yükseltmelisin', {
size: 28,
fill: 0xE94560
});
lockText.anchor.set(0.5, 0.5);
lockText.y = 160;
card.addChild(lockText);
} else {
card.onClick = function (developer) {
if (gameState.money >= developer.cost) {
gameState.money -= developer.cost;
gameState.developers.push({
name: developer.name,
specialty: developer.specialty,
skill: developer.skill,
cost: developer.cost,
assignedFeature: null // Only 1 feature can be assigned
});
updateUI();
LK.getSound('hire').play();
showHireMenu(); // Refresh menu
}
};
}
hireMenu.addChild(card);
developerCards.push(card);
});
}
function showFeatureCategory(category) {
projectMenu.visible = false;
featureCategoryMenu.visible = true;
categoryMenuTitle.setText(category + ' Features');
selectedFeaturesText.setText('Selected: ' + selectedFeatures.length + '/5');
// Clear existing feature cards
for (var i = featureCategoryMenu.children.length - 1; i >= 0; i--) {
var child = featureCategoryMenu.children[i];
if (child instanceof FeatureCard) {
child.destroy();
}
}
// Get available features for this category
var availableFeatures = featurePool.filter(function (feature) {
return feature.type === category && (!feature.requiresResearch || gameState.researchedFeatures[feature.type].indexOf(feature.name) !== -1);
});
// Create feature cards
availableFeatures.forEach(function (feature, index) {
var card = new FeatureCard();
card.setFeature(feature);
card.x = 400 + index % 4 * 250;
card.y = 500 + Math.floor(index / 4) * 350;
// Set selected state if already selected
var isSelected = selectedFeatures.some(function (f) {
return f.name === feature.name;
});
card.setSelected(isSelected);
// Highlight trending features
if (gameState.marketTrends.indexOf(feature.type) !== -1) {
var trendIcon = LK.getAsset('trendIcon', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.3,
scaleY: 0.3
});
trendIcon.x = 100;
trendIcon.y = -100;
card.addChild(trendIcon);
}
card.onClick = function (clickedCard) {
if (clickedCard.selected) {
clickedCard.setSelected(false);
selectedFeatures = selectedFeatures.filter(function (f) {
return f !== clickedCard.featureData;
});
} else if (selectedFeatures.length < 5) {
clickedCard.setSelected(true);
selectedFeatures.push(clickedCard.featureData);
LK.getSound('select').play();
}
// Update selected count
selectedFeaturesText.setText('Selected: ' + selectedFeatures.length + '/5');
};
featureCategoryMenu.addChild(card);
});
}
function showProjectMenu() {
if (gameState.developers.length === 0) {
return;
}
mainMenu.visible = false;
projectMenu.visible = true;
selectedFeatures = [];
// Clear existing cards
featureCards.forEach(function (card) {
card.destroy();
});
featureCards = [];
// Clear any existing category buttons
for (var i = projectMenu.children.length - 1; i >= 0; i--) {
var child = projectMenu.children[i];
if (child instanceof Button && child !== startDevelopmentBtn && child !== backFromProjectBtn) {
child.destroy();
}
}
// Generate and display market trends
gameState.marketTrends = [];
var trendTypes = ['Graphics', 'Sound', 'Gameplay'];
var availableGenres = gameGenres.filter(function (genre) {
return !genre.requiresResearch || gameState.researchedFeatures.GameGenres.indexOf(genre.name) !== -1;
});
// Feature type trend
var trend = trendTypes[Math.floor(Math.random() * trendTypes.length)];
gameState.marketTrends.push(trend);
// Genre trend
if (availableGenres.length > 0) {
var genreTrend = availableGenres[Math.floor(Math.random() * availableGenres.length)];
gameState.marketTrends.push(genreTrend.name + ' games');
}
// Display trends at top
var trendsText = new Text2('Market Trends: ' + gameState.marketTrends.join(' & ') + ' are hot!', {
size: 35,
fill: 0xFF5722
});
trendsText.anchor.set(0.5, 0.5);
trendsText.x = 1024;
trendsText.y = 400;
projectMenu.addChild(trendsText);
// Total cost display
var totalCostText = new Text2('Total Cost: $0', {
size: 35,
fill: 0x4CAF50
});
totalCostText.anchor.set(0.5, 0.5);
totalCostText.x = 1024;
totalCostText.y = 480;
projectMenu.addChild(totalCostText);
// Store totalCostText reference for later updates
projectMenu.totalCostText = totalCostText;
// Create category buttons
var categories = ['Graphics', 'Sound', 'Gameplay'];
categories.forEach(function (category, index) {
var categoryBtn = new Button();
categoryBtn.setLabel(category + ' Features');
categoryBtn.x = 512 + index * 400;
categoryBtn.y = 600;
categoryBtn.onClick = function () {
showFeatureCategory(category);
};
projectMenu.addChild(categoryBtn);
});
}
function startDevelopment() {
if (selectedFeatures.length !== 5) {
return;
}
// Calculate total cost
var totalCost = 0;
selectedFeatures.forEach(function (feature) {
totalCost += feature.cost;
});
// Check if player can afford
if (gameState.money < totalCost) {
return;
}
// Deduct costs
gameState.money -= totalCost;
updateUI();
projectMenu.visible = false;
developmentScreen.visible = true;
// Display trends
for (var i = trendsContainer.children.length - 1; i > 0; i--) {
trendsContainer.children[i].destroy();
}
gameState.marketTrends.forEach(function (trend, index) {
var trendText = new Text2(trend + ' is trending!', {
size: 30,
fill: 0xFF5722
});
trendText.anchor.set(0.5, 0.5);
trendText.y = 40 + index * 35;
trendsContainer.addChild(trendText);
});
// Calculate target score
var baseTarget = 100 + gameState.completedGames * 50;
targetScoreText.setText('Target Score: ' + baseTarget);
// Add genre selection
var selectedGenre = null;
var availableGenres = gameGenres.filter(function (genre) {
return !genre.requiresResearch || gameState.researchedFeatures.GameGenres.indexOf(genre.name) !== -1;
});
if (availableGenres.length > 0) {
selectedGenre = availableGenres[Math.floor(Math.random() * availableGenres.length)];
}
// Start project
gameState.currentProject = {
features: selectedFeatures,
targetScore: baseTarget,
currentScore: 0,
developmentSpeed: 0,
genre: selectedGenre
};
// Assign features to developers (1 per developer, main character can do all)
var assignedDevelopers = [];
var assignedFeatures = [];
// Always include main character as a developer
var allDevs = [{
name: gameState.mainCharacter.name,
specialty: "All",
skill: gameState.mainCharacter.skill,
featurePoints: Object.assign({}, gameState.mainCharacter.featurePoints)
}].concat(gameState.developers.map(function (dev) {
return {
name: dev.name,
specialty: dev.specialty,
skill: dev.skill,
assignedFeature: null
};
}));
// Assign features: main character gets all features, others get 1 each
var devAssignments = [];
selectedFeatures.forEach(function (feature, idx) {
if (idx === 0) {
// Main character gets all features
devAssignments.push({
dev: allDevs[0],
feature: feature
});
} else {
// Assign to next available developer
var devIdx = idx;
if (devIdx >= allDevs.length) devIdx = allDevs.length - 1;
devAssignments.push({
dev: allDevs[devIdx],
feature: feature
});
allDevs[devIdx].assignedFeature = feature.name;
}
});
// Calculate development speed
var totalSpeed = 0;
devAssignments.forEach(function (assignment) {
// Main character: use featurePoints for each type
if (assignment.dev.name === gameState.mainCharacter.name) {
var fp = assignment.dev.featurePoints[assignment.feature.type] || 1;
totalSpeed += (assignment.dev.skill + fp) * 0.5;
} else {
totalSpeed += assignment.dev.skill * 0.5;
}
});
gameState.currentProject.developmentSpeed = totalSpeed;
gameState.currentProject.devAssignments = devAssignments;
LK.getSound('develop').play();
releaseBtn.visible = false;
progressBarFill.scaleX = 0;
}
function releaseGame() {
var project = gameState.currentProject;
// Calculate final score with bonuses
var finalScore = project.currentScore;
// Trend bonus
var trendMultiplier = 1;
project.features.forEach(function (feature) {
if (gameState.marketTrends.indexOf(feature.type) !== -1) {
finalScore *= 1.5;
trendMultiplier += 0.3;
}
});
// Genre bonus
if (project.genre) {
finalScore *= project.genre.baseMultiplier;
if (gameState.marketTrends.some(function (trend) {
return trend.indexOf(project.genre.name) !== -1;
})) {
finalScore *= 1.3;
trendMultiplier += 0.4;
}
}
// Calculate initial sales potential
var baseSalesMultiplier = 20;
if (finalScore >= project.targetScore) {
baseSalesMultiplier = 40;
}
var initialDailySales = Math.floor(finalScore / project.targetScore * baseSalesMultiplier * trendMultiplier);
var gameName = currentGameName && currentGameName.length > 0 ? currentGameName : 'Game #' + (gameState.completedGames + 1);
var releasedGame = {
name: gameName,
releaseDay: gameState.currentDay,
score: finalScore,
targetScore: project.targetScore,
initialDailySales: initialDailySales,
currentDailySales: initialDailySales,
totalSales: 0,
features: project.features,
trendBonus: trendMultiplier,
developers: gameState.developers.slice(),
genre: project.genre
};
// Reset game name after use
currentGameName = '';
gameNameDisplay.setText('');
gameState.releasedGames.push(releasedGame);
// Success check
if (finalScore >= project.targetScore) {
gameState.money += Math.floor(finalScore * 0.005);
gameState.completedGames++;
LK.getSound('success').play();
LK.setScore(gameState.completedGames);
if (gameState.completedGames >= 10) {
LK.showYouWin();
}
} else {
gameState.money += Math.floor(finalScore * 0.00125);
}
LK.getSound('release').play();
// Reset
gameState.currentProject = null;
developmentScreen.visible = false;
mainMenu.visible = true;
updateUI();
}
// Game update
var dayTimer = 0;
game.update = function () {
// Handle research progress
if (gameState.currentResearch) {
gameState.currentResearch.timeRemaining--;
if (gameState.currentResearch.timeRemaining <= 0) {
// Research complete
var research = gameState.currentResearch;
gameState.researchedFeatures[research.category].push(research.name);
gameState.currentResearch = null;
LK.getSound('success').play();
// Show notification
var notification = new Container();
game.addChild(notification);
var bg = LK.getAsset('card', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2,
scaleY: 0.8
});
bg.tint = 0x4CAF50;
notification.addChild(bg);
var text = new Text2('Research Complete: ' + research.name, {
size: 35,
fill: 0xFFFFFF
});
text.anchor.set(0.5, 0.5);
notification.addChild(text);
notification.x = 1024;
notification.y = 600;
notification.alpha = 0;
tween(notification, {
alpha: 1
}, {
duration: 500,
onFinish: function onFinish() {
LK.setTimeout(function () {
tween(notification, {
alpha: 0
}, {
duration: 500,
onFinish: function onFinish() {
notification.destroy();
}
});
}, 2000);
}
});
}
}
// Day progression (every 3 seconds = 1 day)
dayTimer++;
if (dayTimer >= 180) {
// 60 fps * 3 seconds
dayTimer = 0;
gameState.currentDay++;
updateUI();
// Process game sales
for (var i = gameState.releasedGames.length - 1; i >= 0; i--) {
var releasedGame = gameState.releasedGames[i];
var daysSinceRelease = gameState.currentDay - releasedGame.releaseDay;
// Calculate sales decline
var declineRate = 0.75; // Base 25% daily decline
// Better games decline slower
if (releasedGame.score >= releasedGame.targetScore * 1.5) {
declineRate = 0.85;
} else if (releasedGame.score >= releasedGame.targetScore) {
declineRate = 0.80;
}
// Apply trend bonus to decline rate
declineRate += (releasedGame.trendBonus - 1) * 0.03;
declineRate = Math.min(declineRate, 0.90);
// Calculate current day sales
releasedGame.currentDailySales = Math.floor(releasedGame.initialDailySales * Math.pow(declineRate, daysSinceRelease));
// Add to total sales and money
if (releasedGame.currentDailySales > 0) {
releasedGame.totalSales += releasedGame.currentDailySales;
var revenue = Math.floor(releasedGame.currentDailySales * 0.25);
gameState.money += revenue;
} else {
// Game no longer selling - remove from market
var removedGame = gameState.releasedGames.splice(i, 1)[0];
gameState.gameHistory.push(removedGame);
// Show notification
var notification = new Container();
game.addChild(notification);
var bg = LK.getAsset('card', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2,
scaleY: 1.2
});
bg.tint = 0x0f3460;
notification.addChild(bg);
var titleText = new Text2(removedGame.name + ' removed from market', {
size: 35,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.y = -30;
notification.addChild(titleText);
var salesText = new Text2('Total copies sold: ' + removedGame.totalSales, {
size: 30,
fill: 0x4CAF50
});
salesText.anchor.set(0.5, 0.5);
salesText.y = 20;
notification.addChild(salesText);
notification.x = 1024;
notification.y = 1366;
notification.alpha = 0;
// Animate notification
tween(notification, {
alpha: 1,
y: 1000
}, {
duration: 500,
onFinish: function onFinish() {
LK.setTimeout(function () {
tween(notification, {
alpha: 0
}, {
duration: 500,
onFinish: function onFinish() {
notification.destroy();
}
});
}, 2000);
}
});
}
}
updateUI();
}
if (gameState.currentProject && developmentScreen.visible) {
var project = gameState.currentProject;
// Development progress
if (project.currentScore < project.targetScore * 10) {
// Calculate points per tick
var pointsPerTick = project.developmentSpeed / 30;
// Feature synergy bonus
var synergy = 1;
// Main character synergy
if (gameState.mainCharacter.featurePoints) {
project.features.forEach(function (feature) {
if (gameState.mainCharacter.featurePoints[feature.type] && gameState.mainCharacter.featurePoints[feature.type] > 0) {
synergy += 0.1;
}
});
}
// Other developers
project.features.forEach(function (feature) {
gameState.developers.forEach(function (dev) {
if (dev.specialty === feature.type) {
synergy += 0.1;
}
});
});
project.currentScore += pointsPerTick * synergy;
// Update UI
currentScoreText.setText('Current Score: ' + Math.floor(project.currentScore));
var progress = Math.min(project.currentScore / (project.targetScore * 10), 1);
progressBarFill.scaleX = progress;
// Show release button when ready
if (progress >= 1 && !releaseBtn.visible) {
releaseBtn.visible = true;
tween(releaseBtn, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(releaseBtn, {
scaleX: 1,
scaleY: 1
}, {
duration: 500
});
}
});
}
}
}
// Check game over
if (gameState.money < 100 && gameState.developers.length === 0 && !gameState.currentProject) {
LK.showGameOver();
}
};
// Global Back Button
var globalBackBtn = new Button();
globalBackBtn.setLabel('Geri');
// Place at bottom center, matching other menu button size (400x100)
globalBackBtn.x = 1024;
globalBackBtn.y = 2600;
globalBackBtn.visible = false;
LK.gui.bottom.addChild(globalBackBtn);
// Helper to check if any menu except mainMenu is visible
function isAnyMenuOpen() {
return upgradeMenu.visible || researchMenu.visible || researchCategoryMenu.visible || nameGameMenu.visible || allGamesMenu.visible || gameDetailView.visible || hireMenu.visible || projectMenu.visible || featureCategoryMenu.visible || developmentScreen.visible;
}
// Helper to close the topmost open menu and return to mainMenu
function closeCurrentMenu() {
if (upgradeMenu.visible) {
upgradeMenu.visible = false;
mainMenu.visible = true;
} else if (researchCategoryMenu.visible) {
researchCategoryMenu.visible = false;
researchMenu.visible = true;
} else if (researchMenu.visible) {
researchMenu.visible = false;
mainMenu.visible = true;
} else if (nameGameMenu.visible) {
nameGameMenu.visible = false;
mainMenu.visible = true;
gameNameInput.setText('');
currentGameName = '';
} else if (allGamesMenu.visible) {
allGamesMenu.visible = false;
mainMenu.visible = true;
} else if (gameDetailView.visible) {
gameDetailView.visible = false;
allGamesMenu.visible = true;
} else if (hireMenu.visible) {
hireMenu.visible = false;
mainMenu.visible = true;
} else if (featureCategoryMenu.visible) {
featureCategoryMenu.visible = false;
projectMenu.visible = true;
// Update total cost in project menu
var totalCost = 0;
selectedFeatures.forEach(function (f) {
totalCost += f.cost;
});
if (projectMenu.totalCostText) {
projectMenu.totalCostText.setText('Total Cost: $' + totalCost);
}
} else if (projectMenu.visible) {
projectMenu.visible = false;
mainMenu.visible = true;
selectedFeatures = [];
featureCards.forEach(function (card) {
card.setSelected(false);
});
} else if (developmentScreen.visible) {
developmentScreen.visible = false;
mainMenu.visible = true;
}
}
// Attach handler to global back button
globalBackBtn.onClick = function () {
closeCurrentMenu();
};
// Show/hide global back button depending on menu state
function updateGlobalBackBtn() {
// Show if any menu except mainMenu is visible
globalBackBtn.visible = isAnyMenuOpen() && !mainMenu.visible;
}
// Patch all menu show functions to update global back button
var _showUpgradeMenu = showUpgradeMenu;
showUpgradeMenu = function showUpgradeMenu() {
_showUpgradeMenu();
updateGlobalBackBtn();
};
var _showResearchMenu = showResearchMenu;
showResearchMenu = function showResearchMenu() {
_showResearchMenu();
updateGlobalBackBtn();
};
var _showAllGamesMenu = showAllGamesMenu;
showAllGamesMenu = function showAllGamesMenu() {
_showAllGamesMenu();
updateGlobalBackBtn();
};
var _showHireMenu = showHireMenu;
showHireMenu = function showHireMenu() {
_showHireMenu();
updateGlobalBackBtn();
};
var _showProjectMenu = showProjectMenu;
showProjectMenu = function showProjectMenu() {
_showProjectMenu();
updateGlobalBackBtn();
};
var _showFeatureCategory = showFeatureCategory;
showFeatureCategory = function showFeatureCategory(category) {
_showFeatureCategory(category);
updateGlobalBackBtn();
};
var _showResearchCategory = showResearchCategory;
showResearchCategory = function showResearchCategory(category) {
_showResearchCategory(category);
updateGlobalBackBtn();
};
var _showNameGameMenu = showNameGameMenu;
showNameGameMenu = function showNameGameMenu() {
_showNameGameMenu();
updateGlobalBackBtn();
};
var _showGameDetail = showGameDetail;
showGameDetail = function showGameDetail(gameData) {
_showGameDetail(gameData);
updateGlobalBackBtn();
};
// Patch all menu back/close buttons to update global back button
function patchBackBtn(btn, closeFn) {
var old = btn.onClick;
btn.onClick = function () {
if (old) old();
updateGlobalBackBtn();
};
}
patchBackBtn(backFromUpgradeBtn);
patchBackBtn(researchBackBtn);
patchBackBtn(categoryBackBtn);
patchBackBtn(backFromNameBtn);
patchBackBtn(backFromAllGamesBtn);
patchBackBtn(detailBackBtn);
patchBackBtn(backFromHireBtn);
patchBackBtn(backFromProjectBtn);
patchBackBtn(categoryBackBtn);
patchBackBtn(researchBackBtn);
patchBackBtn(categoryBackBtn);
// Also update on developmentScreen close (release)
var _releaseGame = releaseGame;
releaseGame = function releaseGame() {
_releaseGame();
updateGlobalBackBtn();
};
// Also update on game update (in case of state changes)
var _updateUI = updateUI;
updateUI = function updateUI() {
_updateUI();
updateGlobalBackBtn();
};
// Initialize
updateUI();
updateGlobalBackBtn();