Code edit (8 edits merged)
Please save this source code
User prompt
in updateBaseInfo, also update player1EnergyText
User prompt
in updateEnergy(), check all building of the player and sum their energy
User prompt
in handleBuildingPlacement when player 1 place a new building, call updateEnergy then updateBaseInfo
Code edit (1 edits merged)
Please save this source code
User prompt
add a player1EnergyText after player1SpiceText
User prompt
in enqueueBuildable call updateBaseInfo instead of player1SpiceText.setText(player1.spice.toString());
Code edit (4 edits merged)
Please save this source code
User prompt
at the end of handleBuildingPlacement clear currentBuildingForPlacement
Code edit (4 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of null (reading 'name')' in or related to this line: 'console.log('updateActionBoard...' + currentSelection.name);' Line Number: 596
Code edit (1 edits merged)
Please save this source code
User prompt
at the end of handleBuildingPlacement switch back to NAVIGATING state
Code edit (1 edits merged)
Please save this source code
User prompt
in displayBuildableItems, when (!currentSelection || !currentSelection.buildable), the previous BuildableItemIconshould be cleared
User prompt
at the end of handleBuildingPlacement, reset the state by selecting the new building
Code edit (1 edits merged)
Please save this source code
User prompt
when PLACING_BUILDINGS, in handleDragEnd ignore the event if isValidPlacement is false
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'setText')' in or related to this line: 'game.mouseCoordsText.setText(Math.floor(x) + ',' + Math.floor(y) + '\r\n' + cellCoord.cellX + ',' + cellCoord.cellY);' Line Number: 611
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'setText')' in or related to this line: 'game.mouseCoordsText.setText(Math.floor(x) + ',' + Math.floor(y) + '\r\n' + cellCoord.cellX + ',' + cellCoord.cellY);' Line Number: 611
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'setText')' in or related to this line: 'game.mouseCoordsText.setText(Math.floor(x) + ',' + Math.floor(y) + '\r\n' + cellCoord.cellX + ',' + cellCoord.cellY);' Line Number: 605
User prompt
Fix Bug: 'TypeError: Cannot read properties of null (reading 'currentViewCenter')' in or related to this line: 'return {' Line Number: 595
Code edit (2 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -314,9 +314,9 @@
console.log("Not enough resources to build.");
return;
}
player1.spice -= buildableInfo.cost;
- player1SpiceText.setText(player1.spice.toString());
+ updateBaseInfo();
var constructionTime = buildableInfo.constructionTime;
var building;
switch (buildableInfo.className) {
case 'ConstructionYard':
@@ -592,8 +592,12 @@
if (game.mouseCoordsText) {
game.mouseCoordsText.setText(Math.floor(x) + ',' + Math.floor(y) + '\r\n' + cellCoord.cellX + ',' + cellCoord.cellY);
}
};
+// Global function to update base info text
+var updateBaseInfo = function updateBaseInfo() {
+ player1SpiceText.setText(player1.spice.toString());
+};
function initGame() {
// Create players
player1 = new Player(1, 0xAAAAff);
player2 = new Player(2, 0xffAAAA);
@@ -624,10 +628,9 @@
size: 50,
fill: '#000000',
font: "'GillSans-Bold',Impact,'Arial Black',Tahoma"
});
- player1SpiceText.anchor.set(1.0, 0.5);
- // Add the spice level text to the GUI overlay
+ player1SpiceText.anchor.set(1.0, 0.25);
LK.gui.topRight.addChild(player1SpiceText);
gameIsRunning = true;
}
// Game tick
a tileable sand terrain tile.
A square tileable rock terrain tile WITHOUT BBORDER. Single Game Texture. In-Game asset. 2d. No shadows. No Border
Zenith view of Dune's Wind Trap power facility square fence. Ressembles a bit to Sydney's Opera. Zenith view Directly from above.
grey cancel icon. UI
thin white circle empty.
0x5e86ff
Zenith view of a white rectangular Harvester shape of a garbage truck with a triangular head. Harvesting on sand, with flowing spice in the back. inside a square fence. Zenith view. Directly overhead. Plumb view.
Minimal Ui icon of an right sign aside with an icon of a target. sand background
Minimal icon of a home with direction icon pointing to the home. sand background
3 white flat isometric concentric circles like a target.
Remove background
Gray background
Minimal Ui icon of target sign on a fire icon.. sand background
top view of an explosion effect.
Simple heavy army tank factory buiding a tank with a crane. Square fence... Zenith view Directly overhead. Plumb view.
an empty black popup UI. UI