User prompt
UI Layout Improvements 1. Increase Spacing Between Buttons The buttons inside menus are currently too close to each other. Required changes: Add more spacing between buttons inside all menus. Buttons should not be tightly packed. Leave comfortable padding so the player can easily tap them, especially on mobile devices. Ensure that accidental clicks are less likely. This applies to: Main menu buttons Province interaction menus Upgrade buttons Diplomacy buttons War interaction buttons 2. Improve Text Spacing The text elements inside menus should also have better spacing. Requirements: Increase the distance between text lines. Make text easier to read. Avoid cramped UI layouts. Ensure text does not overlap with buttons or borders. This improvement should apply to: Province information panels Upgrade menus War menus Diplomacy menus Any popup windows
User prompt
UI Layout Improvements 1. Increase Spacing Between Buttons The buttons inside menus are currently too close to each other. Required changes: Add more spacing between buttons inside all menus. Buttons should not be tightly packed. Leave comfortable padding so the player can easily tap them, especially on mobile devices. Ensure that accidental clicks are less likely. This applies to: Main menu buttons Province interaction menus Upgrade buttons Diplomacy buttons War interaction buttons 2. Improve Text Spacing The text elements inside menus should also have better spacing. Requirements: Increase the distance between text lines. Make text easier to read. Avoid cramped UI layouts. Ensure text does not overlap with buttons or borders. This improvement should apply to: Province information panels Upgrade menus War menus Diplomacy menus Any popup windows 3. Increase Menu Size The menus themselves should be larger. Requirements: Increase the overall menu panel size. Ensure there is enough room for: Buttons Text Province information The UI should feel comfortable and readable, especially on mobile screens. 4. Adjust Money and Power UI Position The Money and Power display elements should be slightly repositioned. Required change: Move the Money text and Power text slightly to the right. This will prevent them from being too close to the screen edge. The UI should look more balanced and aligned. Map Shape Improvements ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Province Spacing and Layout Fix 1. Fix Overlapping Provinces Currently, some provinces are overlapping and intersecting with each other. This causes visual problems and makes the map difficult to understand. Required fix: Provinces must not overlap or intersect with other provinces. Each province should occupy its own clear area on the map. 2. Proper Distance Between Provinces Provinces should be positioned based on their size, with correct spacing between them. Requirements: Larger provinces should have slightly more space around them. Smaller provinces can have less spacing, but still must remain clearly separated. Provinces should feel properly placed next to each other. 3. No Empty Gaps Between Provinces Although provinces should not overlap, there should also not be large empty gaps between them. Rules: Provinces should touch or connect at their borders like a real map. Borders should align cleanly so the map looks continuous. The map should look like a connected territory, not scattered shapes. 4. Balanced Province Placement Final layout requirements: Provinces must not overlap. Provinces must not leave large empty spaces between them. Borders should connect naturally. Province shapes should fit together properly to form countries.
User prompt
UI Layout Improvements 1. Increase Spacing Between Buttons The buttons inside menus are currently too close to each other. Required changes: Add more spacing between buttons inside all menus. Buttons should not be tightly packed. Leave comfortable padding so the player can easily tap them, especially on mobile devices. Ensure that accidental clicks are less likely. This applies to: Main menu buttons Province interaction menus Upgrade buttons Diplomacy buttons War interaction buttons 2. Improve Text Spacing The text elements inside menus should also have better spacing. Requirements: Increase the distance between text lines. Make text easier to read. Avoid cramped UI layouts. Ensure text does not overlap with buttons or borders. This improvement should apply to: Province information panels Upgrade menus War menus Diplomacy menus Any popup windows 3. Increase Menu Size The menus themselves should be larger. Requirements: Increase the overall menu panel size. Ensure there is enough room for: Buttons Text Province information The UI should feel comfortable and readable, especially on mobile screens. 4. Adjust Money and Power UI Position The Money and Power display elements should be slightly repositioned. Required change: Move the Money text and Power text slightly to the right. This will prevent them from being too close to the screen edge. The UI should look more balanced and aligned. Map Shape Improvements 5. More Realistic Province Shapes Currently the map looks too grid-like and square. Required improvements: Provinces should not all be perfect squares. Introduce varied province shapes. Possible shapes include: Irregular shapes Rounded edges Elliptical areas Mixed polygon shapes 6. Province Size Variation Not all provinces should be the same size. Required changes: Some provinces should be larger. Some provinces should be smaller. This will make the map feel more natural and realistic. 7. More Natural Map Design The overall map should resemble a more natural geographic layout instead of a simple square grid. Improvements: Borders should look organic and irregular. Province shapes should follow natural geographic logic. The map should still remain clear and readable for gameplay. The goal is to make the map feel closer to a real political map, rather than a simple tile grid. Summary of Changes The update should include: More spacing between menu buttons Better spacing between text lines Larger menu panels Slightly repositioned Money and Power UI elements Provinces with varied shapes instead of only squares Different province sizes (large and small) A more natural, realistic map layout ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Reset Progress Feature 1. “Clear All Progress” Button Add a button in the main menu called “Clear All Progress.” Functionality: When the player presses this button: A confirmation popup should appear. Example message: “Are you sure you want to delete all progress?” If the player confirms: All player save data stored in the cloud must be deleted. This includes: Selected country Money Power Levels completed Province ownership Investments After deletion: The game restarts from the beginning. The player returns to the country selection screen. Map Expansion 2. Larger Map with More Provinces Increase the size of the map and add more provinces (tiles). Requirements: The map should feel larger and more strategic. Each country should control more provinces than before. Provinces must remain clearly separated and clickable. The map should stay centered on the screen. New Countries Add the following countries to the game: Egypt Israel Yemen Oman Rules: Each country must have: Its own unique color Multiple provinces Relationship values with the player Province power ranges similar to the other countries Player Starting Province Power 3. Starting Province Strength The player should always start with: 20 Province Power Important distinction: This refers to Province Power, not the global Power variable used for attacking. Province Power represents: The defensive strength of the player’s provinces when attacked by enemy AI. Province Defense Upgrade System Add a button inside the player’s province menu that allows the player to increase Province Power. Functionality: When the player clicks on their own province: A menu appears. Inside the menu there is a button called: “Upgrade Province Power” Purpose: This increases the defensive strength of that province. Reason: If an AI country attacks that province, the province will defend itself based on its Province Power value. Turn-Based War System 4. Turn-Based Combat During War When the player is at war with another country, the game should switch to a turn-based system. Rules: One turn belongs to the player. One turn belongs to the AI enemy. Flow: The player performs an action (attack a province, upgrade power, etc.). The player’s turn ends. The AI performs its action based on the player’s move. Control returns to the player. AI behavior should consider: Province power Strategic position Player actions 5. Normal Gameplay Outside War If the player is not at war, the game continues normally with real-time gameplay. This includes: Real-time income generation Province upgrades Diplomacy actions Map interaction The turn-based system should only activate during wars. Map Shape Improvements 6. Improve Map Accuracy The map should look closer to a real-world Middle East map. Improvements needed: Adjust overall map proportions Make country borders more realistic Improve the geographical shapes of countries 7. Country Shape Improvements Each country should have: More natural borders More accurate shapes compared to real geography Cleaner province boundaries The goal is to make the map look more polished and geographically believable, rather than random square shapes. UI Size and Mobile Usability Improvements 8. Increase UI Size for Mobile Devices The current UI elements are too small, especially on mobile devices. When playing on a phone: Buttons are very difficult to tap Text is too small to read UI elements are too tightly packed Required Improvements: Significantly increase the size of all UI elements. Make buttons much larger and easier to press. Increase font sizes for better readability. Increase spacing between buttons to prevent misclicks. Ensure the UI is optimized for mobile gameplay. This applies to: Menu buttons Province interaction menus Upgrade buttons Relationship controls Economy buttons All readable text in the game The UI should feel comfortable to use on a smartphone, where players can easily tap buttons without precision issues. Summary of New Features The new update should include: Clear All Progress button (cloud save reset) Larger map with more provinces New countries: Egypt Israel Yemen Oman Player starting with 20 Province Power Province defense upgrade system Turn-based combat system during wars Real-time gameplay outside wars Improved map accuracy Better country shapes and borders Much larger UI optimized for mobile devices Larger buttons and readable text for phones ↪💡 Consider importing and using the following plugins: @upit/storage.v1, @upit/tween.v1
User prompt
Background Music System 1. Continuous Background Music Play the audio file: “war.mp3” from TheConquest soundtrack. The music should: Play continuously in the background. Loop automatically when it ends. Play at low volume (soft background level). The music should start when the game loads. Add optional future support for: Music on/off toggle in settings. Province Power Ranking System (Country-Based Power Balance) Each country should have a predefined province power range to create balanced difficulty. Power Ranking Order (Strongest to Weakest): Turkey Iran Saudi Arabia Iraq Syria Province Power Ranges by Country: Syria → 20 or lower Iraq → Between 20 and 35 Saudi Arabia → Between 40 and 50 Iran → Between 60 and 65 Turkey → Between 65 and 70 Rules: When generating provinces, assign random power values within the specified range for that country. This creates natural strength differences between countries. Player Exception Rule The player’s country is not restricted by these predefined power ranges. Player province power can grow freely based on: Investments Power upgrades Level progression Game mechanics This ensures the player is not limited by the original country balance. War Response & Counterattack System (AI Reaction Mechanic) Add a reactive war system: When the player attacks an enemy province: The enemy country should respond based on province power comparison. Combat Logic: If: Player Province Power > Enemy Province Power → Enemy cannot successfully counterattack. If: Enemy Province Power > Player Province Power → Enemy can counterattack and attempt to retake or damage the province. Counterattack Behavior When at war: The AI country should: Periodically evaluate player actions. Attempt to attack back based on: Province power Total country power War status Suggested behavior model: If enemy total power is significantly lower → Defensive mode. If enemy total power is similar → Balanced attacks. If enemy total power is higher → Aggressive counterattacks. Summary of New Systems Continuous low-volume looping background music. Country-based predefined province power ranges. Clear military strength hierarchy: Turkey strongest Syria weakest Player power not restricted by country ranking. Dynamic AI war response system. Power-based counterattack logic. Enemy cannot attack successfully if weaker. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
UI Improvements & Gameplay Adjustments 1. Increase UI Size The current UI appears too small. Increase the overall UI scale. Make buttons, text, and panels larger and easier to read. Improve readability for: Money display (top-left corner) Power display Relationship values Province interaction panels Ensure proper spacing between UI elements. Make the UI responsive and centered properly on the screen. 3. Province Power Not Visible in Menu (Bug Fix) Issue: The province Power value is not visible in the interaction menu. Fix: When clicking a province, the popup menu must clearly display: Province Name Province Owner Province Power Relationship Status (if applicable) Investment Level (if it is the player's province) Power visibility rules: During war → Power must always be visible. In peace → Power visibility depends on design (can remain hidden except in menu). Summary of Changes Increase UI size and readability. Improve layout spacing. Replace single-click capture with multi-click capture system. Add capture progress system. Fix province Power visibility inside the interaction menu.
User prompt
Level System (New Feature) 1. Adding a Level Progression System The game should include a Level System. The player starts at Level 1. The objective of each level is to eliminate (conquer) all other countries on the map. A country is considered eliminated when all of its provinces are captured. 2. Level Completion Condition A level is completed when: The player’s country controls 100% of the provinces on the map. No enemy countries remain. When this condition is met: Show a “Level Complete” screen. After a short delay or button click, load the next level. 3. New Level Generation Rules When a new level starts: Completely reset the map layout. Spawn new countries in different positions. Country borders and province locations should be rearranged. The layout must feel different from the previous level. 4. Player Country Relocation At the beginning of each new level: The player’s country should spawn in a new random location. The player should not always start in the same region. Starting provinces for the player should be balanced (not too weak or too strong). 5. New Enemy Countries Per Level For each new level: Replace eliminated countries with new countries. New countries should: Appear in different geographic positions. Have unique colors. Have their own relationship values. Have their own power levels. Optional scaling (recommended for difficulty progression): Each level increases difficulty. Enemy countries may: Start with higher Power. Have stronger provinces. Generate more income. Be more aggressive diplomatically. 6. Level Scaling System (Difficulty Progression) Suggested scaling model: Level 1: Fewer enemy countries. Lower starting Power values. Lower province strength. Higher Levels: More enemy countries. Higher starting Power. Higher province Power values. Stronger economies. Faster war triggers. 7. Variables Needed for Level System Current Level Total provinces Remaining enemy countries Player spawn position Enemy spawn positions Difficulty scaling multiplier 8. Optional Enhancements (Recommended for Better Game Depth) Add a small reward when leveling up (bonus money or bonus Power). Add a short transition animation between levels. Slightly increase maximum investment potential per level. Add a level counter display (Top of screen: “Level X”). Final Result The game becomes: Progressive Replayable More strategic Increasingly difficult Dynamically generated per level ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Visual & UI Improvements 1. Background Design Add a full-screen background image behind the map. The background should be thematic (political/strategic theme, subtle texture, not distracting). The map should be centered on the screen. The background must not interfere with UI readability. 2. Map & Borders The world map should be displayed in the center of the screen. Provinces (cities/tiles) should have clean, smooth, and clearly defined borders. Borders between countries should be visually distinct and more polished than before. Provinces remain square-based, but edges should visually blend into proper country borders. 3. Country Color System Each country must have its own unique color (not just green/red). Example color logic: Player’s country → Bright Green Iraq → Unique color Syria → Unique color Turkey → Unique color Saudi Arabia → Unique color Iran → Unique color Rules: Each country always keeps its own base color. When war happens, enemy provinces remain in their country color (not all red anymore). Color differences must clearly distinguish countries. Province Power Display System Each province has a Power value. The Power value should be displayed visually on the province tile. However: Only show Power values for countries that the player is currently at war with. Do NOT show Power values for neutral or allied countries. The player’s own provinces do not need visible Power numbers. Economic Investment System (New Feature) 1. Clicking Own Provinces When the player clicks on their own province: An “Economic Investment” option appears. Each investment costs 30 Money. Each province can be upgraded a maximum of 10 times. If the province is already at level 10, the investment button becomes disabled. 2. Income System Each investment: Increases that province’s income output. Every province generates passive income every second. Base Rule: After investing, that province generates +2 Money per second. Scaling Rule: Each additional investment: Costs more than the previous one (progressive cost system). Produces higher income than the previous level. Example System (Suggested Logic): Level 1: Cost: 30 Income: +2 per second Level 2: Cost: Higher than 30 (for example 40) Income: Higher than +2 (for example +3 per second) Each level: Higher cost Higher income generation Maximum level: 10 Economy Display Total Money is displayed in the top-left corner. Income should increase in real time. Income updates every second based on: Total number of owned provinces Their individual investment levels Summary of New Systems Added Background image Centered map layout Cleaner borders Unique country colors Province power visibility only during war Clickable economic investment for owned provinces Progressive investment cost scaling Passive income per province Max 10 upgrades per province
User prompt
Please fix the bug: 'Uncaught TypeError: game.removeAllChildren is not a function' in or related to this line: 'game.removeAllChildren();' Line Number: 370
Code edit (1 edits merged)
Please save this source code
User prompt
Middle East: Legacy
Initial prompt
Game Title: Middle East: Legacy Game Concept Overview: The game is a strategy-based political simulation set on a world map. The map is divided into square-shaped provinces (tiles). Each province belongs to a country and changes color depending on its ownership. 1. Start Screen (Country Selection) When the game starts, the player must choose one of the following countries: Iraq Syria Turkey Saudi Arabia Iran After the player selects a country: The selection screen closes. The chosen country is saved to the cloud. The game map loads. 2. Map System The world map is divided into square provinces (tiles). Each province belongs to a specific country. Provinces change color based on ownership: The player’s country provinces appear green. All other countries’ provinces appear red. 3. Province Interaction System When the player clicks on a province: A small interaction window appears. This window contains two buttons: “+” button → Increases relationship with the selected country. “-” button → Decreases relationship with the selected country. 4. Relationship System Each country has a relationship value with the player. Relationship values can increase or decrease. If the relationship value with a country reaches -50, that country automatically declares war on the player. 5. War & Conquest System When a country declares war: The player can click on that country’s provinces. If at war, clicking on an enemy province allows the player to attempt to capture it. Whether the province is captured depends on the player’s Power variable. 6. Power System The player has a variable called Power. Power determines military strength. Higher Power increases the chance of successfully capturing enemy provinces. Power can be increased using money. There will be a button to increase Power: When clicked: The player pays a certain amount of money. Power increases by +1. 7. Money System The player has a Money variable. Money is displayed in the top-left corner of the screen. Money is used to increase Power. Core Game Variables Selected Country Money Power Relationship value (for each country) Province ownership War status (true/false per country)
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
selectedCountry: "undefined",
currentLevel: 1
});
/****
* Classes
****/
var CaptureButton = Container.expand(function () {
var self = Container.call(this);
self.targetProvince = null;
self.buttonGraphic = null;
self.textLabel = null;
self.init = function (label, targetProvince) {
self.targetProvince = targetProvince;
self.buttonGraphic = self.attachAsset('button', {
anchorX: 0.5,
anchorY: 0.5
});
self.textLabel = self.addChild(new Text2(label, {
size: 40,
fill: 0xFFFFFF
}));
self.textLabel.anchor.set(0.5, 0.5);
self.textLabel.x = 0;
self.textLabel.y = 0;
self.interactive = true;
};
self.down = function (x, y, obj) {
if (atWar[self.targetProvince.countryIndex]) {
var random = Math.random();
var successChance = power / (power + 100);
if (random < successChance) {
self.targetProvince.countryIndex = playerCountryIndex;
self.targetProvince.updateGraphic();
money += 10;
moneyText.setText('Money: $' + money);
LK.effects.flashObject(self.targetProvince, 0x4CAF50, 500);
var enemyCountryIndex = self.targetProvince.countryIndex;
if (self.targetProvince.power > power) {
LK.setTimeout(function () {
var counterRandom = Math.random();
var counterSuccessChance = self.targetProvince.power / (self.targetProvince.power + power);
if (counterRandom < counterSuccessChance && self.targetProvince.countryIndex === playerCountryIndex) {
self.targetProvince.countryIndex = enemyCountryIndex;
self.targetProvince.updateGraphic();
LK.effects.flashObject(self.targetProvince, 0xF44336, 500);
}
}, 500);
}
} else {
LK.effects.flashObject(self.targetProvince, 0xF44336, 500);
}
LK.game.removeChild(currentPanel);
currentPanel = null;
}
};
return self;
});
//{custom_lcs_12}
var ConfirmationDialog = Container.expand(function () {
var self = Container.call(this);
//{custom_confirm_1}
self.panelGraphic = null; //{custom_confirm_2}
self.init = function (message, onConfirm, onCancel) {
//{custom_confirm_3}
self.panelGraphic = self.attachAsset('panel', {
//{custom_confirm_4}
anchorX: 0.5,
//{custom_confirm_5}
anchorY: 0.5 //{custom_confirm_6}
}); //{custom_confirm_7}
self.x = 1024; //{custom_confirm_8}
self.y = 1366; //{custom_confirm_9}
var messageText = new Text2(message, {
//{custom_confirm_10}
size: 60,
//{custom_confirm_11}
fill: 0xFFFFFF //{custom_confirm_12}
}); //{custom_confirm_13}
messageText.anchor.set(0.5, 0.5); //{custom_confirm_14}
messageText.x = 0; //{custom_confirm_15}
messageText.y = -100; //{custom_confirm_16}
self.addChild(messageText); //{custom_confirm_17}
var confirmBtn = self.addChild(new Container()); //{custom_confirm_18}
confirmBtn.attachAsset('button', {
//{custom_confirm_19}
anchorX: 0.5,
//{custom_confirm_20}
anchorY: 0.5 //{custom_confirm_21}
}); //{custom_confirm_22}
confirmBtn.x = -180; //{custom_confirm_23}
confirmBtn.y = 120; //{custom_confirm_24}
confirmBtn.interactive = true; //{custom_confirm_25}
var confirmLabel = confirmBtn.addChild(new Text2('YES', {
//{custom_confirm_26}
size: 50,
//{custom_confirm_27}
fill: 0xFFFFFF //{custom_confirm_28}
})); //{custom_confirm_29}
confirmLabel.anchor.set(0.5, 0.5); //{custom_confirm_30}
confirmBtn.down = function () {
//{custom_confirm_31}
game.removeChild(self); //{custom_confirm_32}
onConfirm(); //{custom_confirm_33}
}; //{custom_confirm_34}
var cancelBtn = self.addChild(new Container()); //{custom_confirm_35}
cancelBtn.attachAsset('buttonNegative', {
//{custom_confirm_36}
anchorX: 0.5,
//{custom_confirm_37}
anchorY: 0.5 //{custom_confirm_38}
}); //{custom_confirm_39}
cancelBtn.x = 180; //{custom_confirm_40}
cancelBtn.y = 120; //{custom_confirm_41}
cancelBtn.interactive = true; //{custom_confirm_42}
var cancelLabel = cancelBtn.addChild(new Text2('NO', {
//{custom_confirm_43}
size: 50,
//{custom_confirm_44}
fill: 0xFFFFFF //{custom_confirm_45}
})); //{custom_confirm_46}
cancelLabel.anchor.set(0.5, 0.5); //{custom_confirm_47}
cancelBtn.down = function () {
//{custom_confirm_48}
game.removeChild(self); //{custom_confirm_49}
onCancel(); //{custom_confirm_50}
}; //{custom_confirm_51}
}; //{custom_confirm_52}
return self; //{custom_confirm_53}
});
var CountryButton = Container.expand(function () {
var self = Container.call(this);
self.countryIndex = -1;
self.countryName = '';
self.buttonGraphic = null;
self.textLabel = null;
self.init = function (countryName, index) {
self.countryName = countryName;
self.countryIndex = index;
self.buttonGraphic = self.attachAsset('button', {
anchorX: 0.5,
anchorY: 0.5
});
self.textLabel = self.addChild(new Text2(countryName, {
size: 70,
fill: 0xFFFFFF
}));
self.textLabel.anchor.set(0.5, 0.5);
self.textLabel.x = 0;
self.textLabel.y = 0;
self.interactive = true;
};
self.down = function (x, y, obj) {
playerCountryIndex = self.countryIndex;
storage.selectedCountry = self.countryIndex;
initializeGame();
LK.game.removeChild(countrySelection);
countrySelection = null;
};
return self;
});
var CountrySelectionScreen = Container.expand(function () {
var self = Container.call(this);
var countries = ['Iraq', 'Syria', 'Turkey', 'Saudi Arabia', 'Iran'];
var buttons = [];
self.init = function () {
var titleText = new Text2('Select Your Country', {
size: 140,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 1024;
titleText.y = 300;
self.addChild(titleText);
var buttonWidth = 300;
var buttonHeight = 100;
var spacing = 220;
var startY = 600;
for (var i = 0; i < countries.length; i++) {
var btn = self.addChild(new CountryButton());
btn.init(countries[i], i);
btn.x = 1024;
btn.y = startY + i * spacing;
buttons.push(btn);
}
var resetBtn = self.addChild(new ResetProgressButton()); //{custom_selection_reset_1}
resetBtn.init(); //{custom_selection_reset_2}
resetBtn.x = 1024; //{custom_selection_reset_3}
resetBtn.y = 2500; //{custom_selection_reset_4}
};
self.init();
return self;
});
var EconomicInvestmentButton = Container.expand(function () {
var self = Container.call(this);
self.targetProvince = null;
self.buttonGraphic = null;
self.textLabel = null;
self.investmentCost = 30;
self.init = function (targetProvince) {
self.targetProvince = targetProvince;
self.investmentCost = 30 + targetProvince.investmentLevel * 10;
self.buttonGraphic = self.attachAsset('button', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonLabel = 'Invest ($' + self.investmentCost + ')';
if (targetProvince.investmentLevel >= 10) {
buttonLabel = 'Max Level (10)';
self.buttonGraphic.tint = 0x666666;
}
self.textLabel = self.addChild(new Text2(buttonLabel, {
size: 36,
fill: 0xFFFFFF
}));
self.textLabel.anchor.set(0.5, 0.5);
self.textLabel.x = 0;
self.textLabel.y = 0;
self.interactive = true;
};
self.down = function (x, y, obj) {
if (self.targetProvince.investmentLevel < 10 && money >= self.investmentCost) {
money -= self.investmentCost;
self.targetProvince.investmentLevel += 1;
moneyText.setText('Money: $' + money);
if (currentPanel) {
game.removeChild(currentPanel);
currentPanel = null;
}
} else if (self.targetProvince.investmentLevel >= 10) {
// Max level reached, do nothing
}
};
return self;
});
var InteractionButton = Container.expand(function () {
var self = Container.call(this);
self.countryIndex = -1;
self.isPositive = true;
self.buttonGraphic = null;
self.textLabel = null;
self.init = function (label, countryIndex, isPositive) {
self.countryIndex = countryIndex;
self.isPositive = isPositive;
var color = isPositive ? 'button' : 'buttonNegative';
self.buttonGraphic = self.attachAsset(color, {
anchorX: 0.5,
anchorY: 0.5
});
self.textLabel = self.addChild(new Text2(label, {
size: 40,
fill: 0xFFFFFF
}));
self.textLabel.anchor.set(0.5, 0.5);
self.textLabel.x = 0;
self.textLabel.y = 0;
self.interactive = true;
};
self.down = function (x, y, obj) {
var change = self.isPositive ? 10 : -10;
relationships[self.countryIndex] += change;
if (relationships[self.countryIndex] <= -50 && !atWar[self.countryIndex]) {
atWar[self.countryIndex] = true;
}
if (currentPanel && currentPanel.closeBtn) {
var relationshipText = null;
for (var i = 0; i < currentPanel.children.length; i++) {
if (currentPanel.children[i].id === 'relationshipText') {
relationshipText = currentPanel.children[i];
break;
}
}
if (relationshipText) {
relationshipText.setText('Relationship: ' + relationships[self.countryIndex]);
}
}
};
return self;
});
var InteractionPanel = Container.expand(function () {
var self = Container.call(this);
self.targetProvince = null;
self.targetCountryIndex = -1;
self.panelGraphic = null;
self.closeBtn = null;
self.init = function (province) {
self.targetProvince = province;
self.targetCountryIndex = province.countryIndex;
self.panelGraphic = self.attachAsset('panel', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 1024;
self.y = 1366;
var targetCountryName = countryNames[self.targetCountryIndex];
var titleText = new Text2('Interact with ' + targetCountryName, {
size: 80,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0);
titleText.x = 0;
titleText.y = -270;
self.addChild(titleText);
var relationshipText = new Text2('Relationship: ' + relationships[self.targetCountryIndex], {
size: 50,
fill: 0xFFEB3B
});
relationshipText.anchor.set(0.5, 0);
relationshipText.x = 0;
relationshipText.y = -200;
relationshipText.id = 'relationshipText';
self.addChild(relationshipText);
var warText = new Text2('', {
size: 50,
fill: 0xF44336
});
warText.anchor.set(0.5, 0);
warText.x = 0;
warText.y = -130;
if (atWar[self.targetCountryIndex]) {
warText.setText('AT WAR');
}
self.addChild(warText);
var provinceNameText = self.addChild(new Text2('Province Power: ' + province.power, {
size: 50,
fill: 0xFFFFFF
}));
provinceNameText.anchor.set(0.5, 0);
provinceNameText.x = 0;
provinceNameText.y = -60;
if (self.targetCountryIndex === playerCountryIndex) {
var investmentLevelText = self.addChild(new Text2('Level: ' + province.investmentLevel + '/10', {
size: 42,
fill: 0x00FF00
}));
investmentLevelText.anchor.set(0.5, 0);
investmentLevelText.x = 0;
investmentLevelText.y = 70;
var incomeText = self.addChild(new Text2('Income: +' + (2 + province.investmentLevel) + '/sec', {
size: 42,
fill: 0x00FF00
}));
incomeText.anchor.set(0.5, 0);
incomeText.x = 0;
incomeText.y = 140;
var defenseText = self.addChild(new Text2('Defense: ' + province.defenseLevel + '/10', {
//{custom_defense_text_1}
size: 42,
//{custom_defense_text_2}
fill: 0xFF6B9D //{custom_defense_text_3}
})); //{custom_defense_text_4}
defenseText.anchor.set(0.5, 0); //{custom_defense_text_5}
defenseText.x = 0; //{custom_defense_text_6}
defenseText.y = 210; //{custom_defense_text_7}
var investBtn = self.addChild(new EconomicInvestmentButton());
investBtn.init(province);
investBtn.x = -150;
investBtn.y = 300;
var defenseBtn = self.addChild(new ProvinceDefenseButton()); //{custom_defense_btn_panel_1}
defenseBtn.init(province); //{custom_defense_btn_panel_2}
defenseBtn.x = 150; //{custom_defense_btn_panel_3}
defenseBtn.y = 300; //{custom_defense_btn_panel_4}
} else {
var increaseBtn = self.addChild(new InteractionButton());
increaseBtn.init('+10 Relationship', self.targetCountryIndex, true);
increaseBtn.x = -220;
increaseBtn.y = 100;
var decreaseBtn = self.addChild(new InteractionButton());
decreaseBtn.init('-10 Relationship', self.targetCountryIndex, false);
decreaseBtn.x = 220;
decreaseBtn.y = 100;
}
self.closeBtn = self.addChild(new Container());
self.closeBtn.attachAsset('closeButton', {
anchorX: 0.5,
anchorY: 0.5
});
self.closeBtn.x = 370;
self.closeBtn.y = -270;
self.closeBtn.interactive = true;
var closeLabel = self.closeBtn.addChild(new Text2('X', {
size: 40,
fill: 0xFFFFFF
}));
closeLabel.anchor.set(0.5, 0.5);
self.closeBtn.down = function () {
LK.game.removeChild(self);
currentPanel = null;
};
};
return self;
});
var LevelCompleteScreen = Container.expand(function () {
var self = Container.call(this);
//{custom_lcs_1}
self.panelGraphic = null; //{custom_lcs_2}
self.init = function () {
self.panelGraphic = self.attachAsset('panel', {
anchorX: 0.5,
anchorY: 0.5
}); //{custom_lcs_3}
self.x = 1024;
self.y = 1366;
var titleText = new Text2('LEVEL COMPLETE!', {
size: 80,
fill: 0x4CAF50
}); //{custom_lcs_4}
titleText.anchor.set(0.5, 0.5);
titleText.x = 0;
titleText.y = -150;
self.addChild(titleText); //{custom_lcs_5}
var nextLevelText = new Text2('Level ' + (currentLevel + 1) + ' Starting...', {
size: 60,
fill: 0xFFFFFF
}); //{custom_lcs_6}
nextLevelText.anchor.set(0.5, 0.5);
nextLevelText.x = 0;
nextLevelText.y = 0;
self.addChild(nextLevelText); //{custom_lcs_7}
var bonusText = new Text2('Bonus: +50 Money', {
size: 40,
fill: 0xFFEB3B
}); //{custom_lcs_8}
bonusText.anchor.set(0.5, 0.5);
bonusText.x = 0;
bonusText.y = 100;
self.addChild(bonusText); //{custom_lcs_9}
}; //{custom_lcs_10}
self.init();
return self; //{custom_lcs_11}
});
//{custom_lcs_12}
var PowerUpButton = Container.expand(function () {
var self = Container.call(this);
self.buttonGraphic = null;
self.textLabel = null;
self.powerCost = 50;
self.init = function (powerCost) {
self.powerCost = powerCost;
self.buttonGraphic = self.attachAsset('button', {
anchorX: 0.5,
anchorY: 0.5
});
self.textLabel = self.addChild(new Text2('Power +1 ($' + powerCost + ')', {
size: 40,
fill: 0xFFFFFF
}));
self.textLabel.anchor.set(0.5, 0.5);
self.textLabel.x = 0;
self.textLabel.y = 0;
self.interactive = true;
};
self.down = function (x, y, obj) {
if (money >= self.powerCost) {
money -= self.powerCost;
power += 1;
moneyText.setText('Money: $' + money);
powerText.setText('Power: ' + power);
}
};
return self;
});
var Province = Container.expand(function () {
var self = Container.call(this);
self.countryIndex = -1;
self.gridX = 0;
self.gridY = 0;
self.graphic = null;
self.init = function (gridX, gridY, countryIndex) {
self.gridX = gridX;
self.gridY = gridY;
self.countryIndex = countryIndex;
self.investmentLevel = 0;
self.defenseLevel = 0;
self.power = 50;
if (countryIndex === playerCountryIndex) {
//{custom_province_init_1}
self.power = 20; //{custom_province_init_2}
} //{custom_province_init_3}
self.lastIncomeTime = Date.now();
self.updateGraphic();
self.interactive = true;
};
self.updateGraphic = function () {
if (self.graphic) {
self.removeChild(self.graphic);
}
if (self.powerText) {
self.removeChild(self.powerText);
self.powerText = null;
}
var assetId = 'province';
if (self.countryIndex === -1) {
assetId = 'provinceNeutral';
} else if (self.countryIndex === playerCountryIndex) {
assetId = 'province';
} else if (self.countryIndex === 0) {
assetId = 'provinceIraq';
} else if (self.countryIndex === 1) {
assetId = 'provinceSyria';
} else if (self.countryIndex === 2) {
assetId = 'provinceTurkey';
} else if (self.countryIndex === 3) {
assetId = 'provinceSaudiArabia';
} else if (self.countryIndex === 4) {
assetId = 'provinceIran';
} else if (self.countryIndex === 5) {
//{custom_asset_egypt}
assetId = 'provinceEgypt'; //{custom_asset_egypt_2}
} else if (self.countryIndex === 6) {
//{custom_asset_israel}
assetId = 'provinceIsrael'; //{custom_asset_israel_2}
} else if (self.countryIndex === 7) {
//{custom_asset_yemen}
assetId = 'provinceYemen'; //{custom_asset_yemen_2}
} else if (self.countryIndex === 8) {
//{custom_asset_oman}
assetId = 'provinceOman'; //{custom_asset_oman_2}
}
self.graphic = self.attachAsset(assetId, {
anchorX: 0.5,
anchorY: 0.5
});
if (atWar[self.countryIndex] && self.countryIndex !== playerCountryIndex && self.countryIndex !== -1) {
self.powerText = self.addChild(new Text2(self.power || '0', {
size: 24,
fill: 0xFFFFFF
}));
self.powerText.anchor.set(0.5, 0.5);
self.powerText.x = 0;
self.powerText.y = 0;
}
};
self.down = function (x, y, obj) {
if (self.countryIndex !== -1) {
openProvincePanel(self);
}
if (self.countryIndex === playerCountryIndex) {
openProvincePanel(self);
}
};
return self;
});
//{custom_confirm_54}
var ProvinceDefenseButton = Container.expand(function () {
var self = Container.call(this);
//{custom_defense_1}
//{custom_defense_2}
self.targetProvince = null; //{custom_defense_3}
self.buttonGraphic = null; //{custom_defense_4}
self.textLabel = null; //{custom_defense_5}
self.defenseCost = 40; //{custom_defense_6}
self.init = function (targetProvince) {
//{custom_defense_7}
self.targetProvince = targetProvince; //{custom_defense_8}
self.defenseCost = 40 + targetProvince.defenseLevel * 5; //{custom_defense_9}
self.buttonGraphic = self.attachAsset('button', {
//{custom_defense_10}
anchorX: 0.5,
//{custom_defense_11}
anchorY: 0.5 //{custom_defense_12}
}); //{custom_defense_13}
var buttonLabel = 'Upgrade Defense ($' + self.defenseCost + ')'; //{custom_defense_14}
if (targetProvince.defenseLevel >= 10) {
//{custom_defense_15}
buttonLabel = 'Max Defense (10)'; //{custom_defense_16}
self.buttonGraphic.tint = 0x666666; //{custom_defense_17}
} //{custom_defense_18}
self.textLabel = self.addChild(new Text2(buttonLabel, {
//{custom_defense_19}
size: 36,
//{custom_defense_20}
fill: 0xFFFFFF //{custom_defense_21}
})); //{custom_defense_22}
self.textLabel.anchor.set(0.5, 0.5); //{custom_defense_23}
self.textLabel.x = 0; //{custom_defense_24}
self.textLabel.y = 0; //{custom_defense_25}
self.interactive = true; //{custom_defense_26}
}; //{custom_defense_27}
self.down = function (x, y, obj) {
//{custom_defense_28}
if (self.targetProvince.defenseLevel < 10 && money >= self.defenseCost) {
//{custom_defense_29}
money -= self.defenseCost; //{custom_defense_30}
self.targetProvince.defenseLevel += 1; //{custom_defense_31}
self.targetProvince.power += 5; //{custom_defense_32}
moneyText.setText('Money: $' + money); //{custom_defense_33}
if (currentPanel) {
//{custom_defense_34}
game.removeChild(currentPanel); //{custom_defense_35}
currentPanel = null; //{custom_defense_36}
} //{custom_defense_37}
} else if (self.targetProvince.defenseLevel >= 10) {//{custom_defense_38}
// Max level reached, do nothing
} //{custom_defense_39}
}; //{custom_defense_40}
return self; //{custom_defense_41}
});
//{custom_defense_42}
var ResetProgressButton = Container.expand(function () {
var self = Container.call(this);
//{custom_reset_btn_1}
//{custom_reset_btn_2}
self.buttonGraphic = null; //{custom_reset_btn_3}
self.textLabel = null; //{custom_reset_btn_4}
self.init = function () {
//{custom_reset_btn_5}
self.buttonGraphic = self.attachAsset('buttonNegative', {
//{custom_reset_btn_6}
anchorX: 0.5,
//{custom_reset_btn_7}
anchorY: 0.5 //{custom_reset_btn_8}
}); //{custom_reset_btn_9}
self.textLabel = self.addChild(new Text2('Clear All Progress', {
//{custom_reset_btn_10}
size: 45,
//{custom_reset_btn_11}
fill: 0xFFFFFF //{custom_reset_btn_12}
})); //{custom_reset_btn_13}
self.textLabel.anchor.set(0.5, 0.5); //{custom_reset_btn_14}
self.textLabel.x = 0; //{custom_reset_btn_15}
self.textLabel.y = 0; //{custom_reset_btn_16}
self.interactive = true; //{custom_reset_btn_17}
}; //{custom_reset_btn_18}
self.down = function (x, y, obj) {
//{custom_reset_btn_19}
var confirmDialog = game.addChild(new ConfirmationDialog()); //{custom_reset_btn_20}
confirmDialog.init('Clear all progress?', function () {
//{custom_reset_btn_21}
storage.selectedCountry = 'undefined'; //{custom_reset_btn_22}
storage.currentLevel = 1; //{custom_reset_btn_23}
playerCountryIndex = -1; //{custom_reset_btn_24}
currentLevel = 1; //{custom_reset_btn_25}
money = 100; //{custom_reset_btn_26}
power = 10; //{custom_reset_btn_27}
provinces = []; //{custom_reset_btn_28}
while (game.children.length > 0) {
//{custom_reset_btn_29}
game.removeChild(game.children[0]); //{custom_reset_btn_30}
} //{custom_reset_btn_31}
LK.gui.topLeft.removeChild(moneyText); //{custom_reset_btn_32}
LK.gui.topLeft.removeChild(powerText); //{custom_reset_btn_33}
LK.gui.top.removeChild(levelText); //{custom_reset_btn_34}
for (var i = LK.gui.bottom.children.length - 1; i >= 0; i--) {
//{custom_reset_btn_35}
LK.gui.bottom.removeChild(LK.gui.bottom.children[i]); //{custom_reset_btn_36}
} //{custom_reset_btn_37}
initializeGame(); //{custom_reset_btn_38}
}, function () {//{custom_reset_btn_39}
// Cancel - do nothing
}); //{custom_reset_btn_40}
}; //{custom_reset_btn_41}
return self; //{custom_reset_btn_42}
});
/****
* Initialize Game
****/
//{custom_reset_btn_43}
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
LK.game = game;
/****
* Game Variables
****/
var countryNames = ['Iraq', 'Syria', 'Turkey', 'Saudi Arabia', 'Iran', 'Egypt', 'Israel', 'Yemen', 'Oman'];
var relationships = [0, 0, 0, 0, 0, 0, 0, 0, 0];
var atWar = [false, false, false, false, false, false, false, false, false];
var playerCountryIndex = storage.selectedCountry !== undefined ? storage.selectedCountry : -1;
var currentLevel = storage.currentLevel || 1;
var money = 100;
var power = 10;
var provinces = [];
var countrySelection = null;
var currentPanel = null;
var moneyText = null;
var powerText = null;
var levelText = null;
function initializeMap() {
var background = game.addChild(LK.getAsset('background', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
}));
var difficultyMultiplier = 1 + (currentLevel - 1) * 0.15;
var mapWidth = 8; //{custom_map_width}
var mapHeight = 8; //{custom_map_height}
var provinceSize = 100; //{custom_map_size}
var totalMapWidth = mapWidth * provinceSize;
var totalMapHeight = mapHeight * provinceSize;
var startX = (2048 - totalMapWidth) / 2;
var startY = (2732 - totalMapHeight) / 2 + 100;
function getCountryPowerRange(countryIndex) {
if (countryIndex === playerCountryIndex) {
return {
min: 50,
max: 100
};
}
if (countryIndex === 0) {
return {
min: 20,
max: 35
};
}
if (countryIndex === 1) {
return {
min: 20,
max: 20
};
}
if (countryIndex === 2) {
return {
min: 65,
max: 70
};
}
if (countryIndex === 3) {
return {
min: 40,
max: 50
};
}
if (countryIndex === 4) {
return {
min: 60,
max: 65
};
}
if (countryIndex === 5) {
//{custom_egypt_range}
return {
//{custom_egypt_range_2}
min: 35,
//{custom_egypt_range_3}
max: 45 //{custom_egypt_range_4}
}; //{custom_egypt_range_5}
} //{custom_egypt_range_6}
if (countryIndex === 6) {
//{custom_israel_range}
return {
//{custom_israel_range_2}
min: 40,
//{custom_israel_range_3}
max: 55 //{custom_israel_range_4}
}; //{custom_israel_range_5}
} //{custom_israel_range_6}
if (countryIndex === 7) {
//{custom_yemen_range}
return {
//{custom_yemen_range_2}
min: 25,
//{custom_yemen_range_3}
max: 40 //{custom_yemen_range_4}
}; //{custom_yemen_range_5}
} //{custom_yemen_range_6}
if (countryIndex === 8) {
//{custom_oman_range}
return {
//{custom_oman_range_2}
min: 30,
//{custom_oman_range_3}
max: 45 //{custom_oman_range_4}
}; //{custom_oman_range_5}
} //{custom_oman_range_6}
return {
min: 30,
max: 50
};
}
for (var y = 0; y < mapHeight; y++) {
for (var x = 0; x < mapWidth; x++) {
var randomCountry = Math.floor(Math.random() * 9); //{custom_random_9}
var province = game.addChild(new Province());
province.init(x, y, randomCountry);
province.x = startX + x * provinceSize + provinceSize / 2;
province.y = startY + y * provinceSize + provinceSize / 2;
var powerRange = getCountryPowerRange(randomCountry);
var basePower = powerRange.min + Math.floor(Math.random() * (powerRange.max - powerRange.min + 1));
province.power = Math.floor(basePower * difficultyMultiplier);
provinces.push(province);
}
}
for (var i = 0; i < 9; i++) {
//{custom_reset_9}
relationships[i] = 0;
atWar[i] = false;
} //{custom_reset_relationships}
var playerCountriesToConquer = 12; //{custom_conquer_12}
var assignedCount = 0;
for (var i = 0; i < provinces.length && assignedCount < playerCountriesToConquer; i++) {
var randomIndex = Math.floor(Math.random() * provinces.length);
if (provinces[randomIndex].countryIndex !== playerCountryIndex) {
provinces[randomIndex].countryIndex = playerCountryIndex;
provinces[randomIndex].investmentLevel = 0;
provinces[randomIndex].defenseLevel = 0; //{custom_init_defense_level}
provinces[randomIndex].updateGraphic();
assignedCount += 1;
}
}
}
function openProvincePanel(province) {
if (currentPanel) {
game.removeChild(currentPanel);
}
currentPanel = game.addChild(new InteractionPanel());
currentPanel.init(province);
if (atWar[province.countryIndex]) {
var captureBtn = currentPanel.addChild(new CaptureButton());
captureBtn.init('CAPTURE PROVINCE', province);
captureBtn.x = 0;
captureBtn.y = 250;
}
}
function showLevelComplete() {
game.update = function () {};
var levelCompleteScreen = game.addChild(new LevelCompleteScreen());
currentLevel += 1;
storage.currentLevel = currentLevel;
money += 50;
LK.setTimeout(function () {
while (game.children.length > 0) {
game.removeChild(game.children[0]);
}
LK.gui.top.removeChild(levelText);
LK.gui.topLeft.removeChild(moneyText);
LK.gui.topLeft.removeChild(powerText);
LK.gui.bottom.removeChild(LK.gui.bottom.children[0]);
provinces = [];
initializeMap();
moneyText = new Text2('Money: $' + money, {
size: 90,
fill: 0xFFFFFF
});
moneyText.anchor.set(0, 0);
moneyText.x = 30;
moneyText.y = 30;
LK.gui.topLeft.addChild(moneyText);
powerText = new Text2('Power: ' + power, {
size: 90,
fill: 0xFFEB3B
});
powerText.anchor.set(0, 0);
powerText.x = 30;
powerText.y = 140;
LK.gui.topLeft.addChild(powerText);
levelText = new Text2('Level ' + currentLevel, {
size: 90,
fill: 0x4CAF50
});
levelText.anchor.set(0.5, 0);
levelText.x = 0;
levelText.y = 40;
LK.gui.top.addChild(levelText);
var powerUpBtn = LK.gui.bottom.addChild(new PowerUpButton());
powerUpBtn.init(50);
powerUpBtn.x = 0;
powerUpBtn.y = -120;
game.update = function () {
if (LK.ticks % 60 === 0) {
var incomePerSecond = 0;
var playerProvincesCount = 0;
var totalProvincesCount = 0;
for (var p = 0; p < provinces.length; p++) {
totalProvincesCount += 1;
if (provinces[p].countryIndex === playerCountryIndex) {
incomePerSecond += 2 + provinces[p].investmentLevel;
playerProvincesCount += 1;
}
}
money += incomePerSecond;
moneyText.setText('Money: $' + money);
if (playerProvincesCount === totalProvincesCount && totalProvincesCount > 0) {
showLevelComplete();
}
}
};
}, 3000);
} //{custom_show_level_complete}
function initializeGame() {
if (playerCountryIndex === -1) {
countrySelection = game.addChild(new CountrySelectionScreen());
return;
}
while (game.children.length > 0) {
game.removeChild(game.children[0]);
}
initializeMap();
moneyText = new Text2('Money: $' + money, {
size: 90,
fill: 0xFFFFFF
});
moneyText.anchor.set(0, 0);
moneyText.x = 30;
moneyText.y = 30;
LK.gui.topLeft.addChild(moneyText);
powerText = new Text2('Power: ' + power, {
size: 90,
fill: 0xFFEB3B
});
powerText.anchor.set(0, 0);
powerText.x = 30;
powerText.y = 140;
LK.gui.topLeft.addChild(powerText);
levelText = new Text2('Level ' + currentLevel, {
size: 90,
fill: 0x4CAF50
});
levelText.anchor.set(0.5, 0);
levelText.x = 0;
levelText.y = 40;
LK.gui.top.addChild(levelText);
var powerUpBtn = LK.gui.bottom.addChild(new PowerUpButton());
powerUpBtn.init(50);
powerUpBtn.x = 0;
powerUpBtn.y = -120;
game.update = function () {
if (LK.ticks % 60 === 0) {
var incomePerSecond = 0;
var playerProvincesCount = 0;
var totalProvincesCount = 0;
for (var p = 0; p < provinces.length; p++) {
totalProvincesCount += 1;
if (provinces[p].countryIndex === playerCountryIndex) {
incomePerSecond += 2 + provinces[p].investmentLevel;
playerProvincesCount += 1;
}
}
money += incomePerSecond;
moneyText.setText('Money: $' + money);
if (playerProvincesCount === totalProvincesCount && totalProvincesCount > 0) {
showLevelComplete();
} //{custom_level_check}
}
};
}
if (playerCountryIndex === -1) {
countrySelection = game.addChild(new CountrySelectionScreen());
} else {
initializeGame();
}
LK.playMusic('TheConquest', {
loop: true,
fade: {
start: 0,
end: 0.3,
duration: 2000
}
});
//{custom_reset_btn_43} ===================================================================
--- original.js
+++ change.js
@@ -71,12 +71,9 @@
self.panelGraphic = self.attachAsset('panel', {
//{custom_confirm_4}
anchorX: 0.5,
//{custom_confirm_5}
- anchorY: 0.5,
- //{custom_confirm_6}
- scaleX: 1.1,
- scaleY: 1.1 //{custom_confirm_6}
+ anchorY: 0.5 //{custom_confirm_6}
}); //{custom_confirm_7}
self.x = 1024; //{custom_confirm_8}
self.y = 1366; //{custom_confirm_9}
var messageText = new Text2(message, {
@@ -95,9 +92,9 @@
anchorX: 0.5,
//{custom_confirm_20}
anchorY: 0.5 //{custom_confirm_21}
}); //{custom_confirm_22}
- confirmBtn.x = -200; //{custom_confirm_23}
+ confirmBtn.x = -180; //{custom_confirm_23}
confirmBtn.y = 120; //{custom_confirm_24}
confirmBtn.interactive = true; //{custom_confirm_25}
var confirmLabel = confirmBtn.addChild(new Text2('YES', {
//{custom_confirm_26}
@@ -117,9 +114,9 @@
anchorX: 0.5,
//{custom_confirm_37}
anchorY: 0.5 //{custom_confirm_38}
}); //{custom_confirm_39}
- cancelBtn.x = 200; //{custom_confirm_40}
+ cancelBtn.x = 180; //{custom_confirm_40}
cancelBtn.y = 120; //{custom_confirm_41}
cancelBtn.interactive = true; //{custom_confirm_42}
var cancelLabel = cancelBtn.addChild(new Text2('NO', {
//{custom_confirm_43}
@@ -181,9 +178,9 @@
titleText.y = 300;
self.addChild(titleText);
var buttonWidth = 300;
var buttonHeight = 100;
- var spacing = 150;
+ var spacing = 220;
var startY = 600;
for (var i = 0; i < countries.length; i++) {
var btn = self.addChild(new CountryButton());
btn.init(countries[i], i);
@@ -295,11 +292,9 @@
self.targetProvince = province;
self.targetCountryIndex = province.countryIndex;
self.panelGraphic = self.attachAsset('panel', {
anchorX: 0.5,
- anchorY: 0.5,
- scaleX: 1.15,
- scaleY: 1.15
+ anchorY: 0.5
});
self.x = 1024;
self.y = 1366;
var targetCountryName = countryNames[self.targetCountryIndex];
@@ -308,26 +303,26 @@
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0);
titleText.x = 0;
- titleText.y = -320;
+ titleText.y = -270;
self.addChild(titleText);
var relationshipText = new Text2('Relationship: ' + relationships[self.targetCountryIndex], {
size: 50,
fill: 0xFFEB3B
});
relationshipText.anchor.set(0.5, 0);
relationshipText.x = 0;
- relationshipText.y = -210;
+ relationshipText.y = -200;
relationshipText.id = 'relationshipText';
self.addChild(relationshipText);
var warText = new Text2('', {
size: 50,
fill: 0xF44336
});
warText.anchor.set(0.5, 0);
warText.x = 0;
- warText.y = -140;
+ warText.y = -130;
if (atWar[self.targetCountryIndex]) {
warText.setText('AT WAR');
}
self.addChild(warText);
@@ -344,42 +339,42 @@
fill: 0x00FF00
}));
investmentLevelText.anchor.set(0.5, 0);
investmentLevelText.x = 0;
- investmentLevelText.y = 30;
+ investmentLevelText.y = 70;
var incomeText = self.addChild(new Text2('Income: +' + (2 + province.investmentLevel) + '/sec', {
size: 42,
fill: 0x00FF00
}));
incomeText.anchor.set(0.5, 0);
incomeText.x = 0;
- incomeText.y = 100;
+ incomeText.y = 140;
var defenseText = self.addChild(new Text2('Defense: ' + province.defenseLevel + '/10', {
//{custom_defense_text_1}
size: 42,
//{custom_defense_text_2}
fill: 0xFF6B9D //{custom_defense_text_3}
})); //{custom_defense_text_4}
defenseText.anchor.set(0.5, 0); //{custom_defense_text_5}
defenseText.x = 0; //{custom_defense_text_6}
- defenseText.y = 170; //{custom_defense_text_7}
+ defenseText.y = 210; //{custom_defense_text_7}
var investBtn = self.addChild(new EconomicInvestmentButton());
investBtn.init(province);
- investBtn.x = -120;
- investBtn.y = 350;
+ investBtn.x = -150;
+ investBtn.y = 300;
var defenseBtn = self.addChild(new ProvinceDefenseButton()); //{custom_defense_btn_panel_1}
defenseBtn.init(province); //{custom_defense_btn_panel_2}
- defenseBtn.x = 120; //{custom_defense_btn_panel_3}
- defenseBtn.y = 350; //{custom_defense_btn_panel_4}
+ defenseBtn.x = 150; //{custom_defense_btn_panel_3}
+ defenseBtn.y = 300; //{custom_defense_btn_panel_4}
} else {
var increaseBtn = self.addChild(new InteractionButton());
increaseBtn.init('+10 Relationship', self.targetCountryIndex, true);
- increaseBtn.x = -200;
- increaseBtn.y = 150;
+ increaseBtn.x = -220;
+ increaseBtn.y = 100;
var decreaseBtn = self.addChild(new InteractionButton());
decreaseBtn.init('-10 Relationship', self.targetCountryIndex, false);
- decreaseBtn.x = 200;
- decreaseBtn.y = 150;
+ decreaseBtn.x = 220;
+ decreaseBtn.y = 100;
}
self.closeBtn = self.addChild(new Container());
self.closeBtn.attachAsset('closeButton', {
anchorX: 0.5,
@@ -824,9 +819,9 @@
if (atWar[province.countryIndex]) {
var captureBtn = currentPanel.addChild(new CaptureButton());
captureBtn.init('CAPTURE PROVINCE', province);
captureBtn.x = 0;
- captureBtn.y = 200;
+ captureBtn.y = 250;
}
}
function showLevelComplete() {
game.update = function () {};
@@ -848,17 +843,17 @@
size: 90,
fill: 0xFFFFFF
});
moneyText.anchor.set(0, 0);
- moneyText.x = 120;
+ moneyText.x = 30;
moneyText.y = 30;
LK.gui.topLeft.addChild(moneyText);
powerText = new Text2('Power: ' + power, {
size: 90,
fill: 0xFFEB3B
});
powerText.anchor.set(0, 0);
- powerText.x = 120;
+ powerText.x = 30;
powerText.y = 140;
LK.gui.topLeft.addChild(powerText);
levelText = new Text2('Level ' + currentLevel, {
size: 90,
@@ -906,17 +901,17 @@
size: 90,
fill: 0xFFFFFF
});
moneyText.anchor.set(0, 0);
- moneyText.x = 120;
+ moneyText.x = 30;
moneyText.y = 30;
LK.gui.topLeft.addChild(moneyText);
powerText = new Text2('Power: ' + power, {
size: 90,
fill: 0xFFEB3B
});
powerText.anchor.set(0, 0);
- powerText.x = 120;
+ powerText.x = 30;
powerText.y = 140;
LK.gui.topLeft.addChild(powerText);
levelText = new Text2('Level ' + currentLevel, {
size: 90,