Code edit (2 edits merged)
Please save this source code
User prompt
create a global variable to clearly handle userActionState (navigating, building, placing buildings, giving orders, ...) with comments
Code edit (1 edits merged)
Please save this source code
User prompt
in building.on('down', function () { console.log("User is placing ", building); currentBuildingForPlacement = building; game.addChild(building); building.visible = true; }); the even should be set on the BuildableItemIcon not the building itself
Code edit (4 edits merged)
Please save this source code
User prompt
Fix when clicking the finished building the log is : "Clicked on boardat 190.67083333333335,2362.041666666667" instead of "User is placing..."
User prompt
looks like : building.asset.on('down', function () { console.log("User is placing ", building); currentBuildingForPlacement = building; game.addChild(building); building.asset.visible = true; }); is not working : There is no log when clicking on the finished building !
Code edit (1 edits merged)
Please save this source code
User prompt
when the finished buiding is clicked, add it to the game so that its asset is visible
User prompt
when currentBuildingForPlacement is not null move the building with the mouse until user taps
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Timeout.tick error: rockIlot1Center is not defined' in or related to this line: 'currentSelection = gameMap.cells[rockIlot1Center.x][rockIlot1Center.y].building;' Line Number: 567
User prompt
when game starts, preselect Player 1 construction yard
User prompt
Fix Bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'setLabelToPlace')' in or related to this line: 'progressDisplay.parentIcon.setLabelToPlace(); // Change label text to 'Place'' Line Number: 339
User prompt
when th buidling is finished buiding, temporarly remplace the name under the build icon by the text 'Place'
User prompt
add a handleBuilding placement function
User prompt
currentBuildingForPlacement should not be treated in handleDragEnd .
User prompt
Fix Bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'asset')' in or related to this line: 'self.asset.interactive = true;' Line Number: 336
User prompt
Now don't place the finished building automatically, instead the user must first click the ready BuildableItemIcon and the place the building on the map
User prompt
make the progressDisplay more fluid, update it every 100ms instead of every second
Code edit (1 edits merged)
Please save this source code
User prompt
restaure alpha of all BuildableItemIcons when building id finished
User prompt
during building, reduce alpha of all BuildableItemIcons
User prompt
during building, diable all BuildableItemIcons
Code edit (2 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -31,8 +31,12 @@
});
self.label.x = self.asset.x - buildableInfo.name.length / 2 * 15;
self.label.y = self.asset.y + 120;
self.addChild(self.label);
+ self.setLabelToPlace = function () {
+ self.label.setText('Place');
+ self.label.x = self.asset.x - 'Place'.length / 2 * 15; // Recalculate x position for new text
+ };
return self;
});
var BuildingProgressDisplay = Container.expand(function (parentIcon) {
var self = Container.call(this);
@@ -319,8 +323,9 @@
if (building.constructionProgress >= constructionTime) {
LK.clearInterval(building.constructionTimer);
building.constructionTimer = null;
building.progressDisplay.hide();
+ progressDisplay.parentIcon.setLabelToPlace(); // Change label text to 'Place'
console.log(type + " construction completed.");
if (building) {
building.asset.interactive = true;
building.alpha = 1.0;
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