Code edit (1 edits merged)
Please save this source code
User prompt
implement convertCoordsToCell to return a Convertion of mouse/touch x,y to Cell coordinates
User prompt
call updateMouseCoords in handleDragMove with input x and y
Code edit (2 edits merged)
Please save this source code
User prompt
add a global function updateMouseCoords()
Code edit (10 edits merged)
Please save this source code
User prompt
in the topLeft, add a mouseCoords text defaulting with "X,Y"
User prompt
in handleDragMove, during UserActionState.PLACING_BUILDINGS, tint the building in red when above an invalid placement (sand or building)
Code edit (2 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'y')' in or related to this line: 'if (input.y > game.height * 0.80) {' Line Number: 507
Code edit (1 edits merged)
Please save this source code
User prompt
in handleDragEnduse UserActionState.PLACING_BUILDINGS instead of the test on currentBuildingForPlacement
User prompt
in handleDragMove use UserActionState.PLACING_BUILDINGS instead of the test on currentBuildingForPlacement
User prompt
in BuildableItemIcon in 'on' evet handler, when currentBuildingForPlacement is not null, set useractionstate to placing building
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
===================================================================
--- original.js
+++ change.js
@@ -13,22 +13,28 @@
self.asset.on('down', function () {
if (!self.asset.interactive) {
return;
}
+ if (currentBuildingForPlacement) {
+ console.log("User is placing ", currentBuildingForPlacement);
+ return;
+ }
var progressDisplay = new BuildingProgressDisplay(self);
game.addChild(progressDisplay);
enqueueBuildable(type, progressDisplay);
game.children.forEach(function (child) {
if (child instanceof BuildableItemIcon) {
child.alpha = 0.75;
}
});
+ /*
self.on('down', function () {
console.log("User is placing ", self);
currentBuildingForPlacement = self;
game.addChild(self);
self.visible = true;
});
+ */
});
var buildableInfo = buildableRepository.getBuildableInfo(type);
self.label = new Text2(buildableInfo.name, {
size: 30,
@@ -322,24 +328,26 @@
building.constructionProgress += 0.1;
building.progressDisplay.setProgress(building.constructionProgress / constructionTime);
if (building.constructionProgress >= constructionTime) {
LK.clearInterval(building.constructionTimer);
+ console.log(type + " construction completed.");
building.constructionTimer = null;
building.progressDisplay.hide();
if (progressDisplay.parentIcon && typeof progressDisplay.parentIcon.setLabelToPlace === 'function') {
progressDisplay.parentIcon.setLabelToPlace(); // Change label text to 'Place'
}
- console.log(type + " construction completed.");
- if (building) {
+ console.log("Building Ready for placement ", building);
+ currentBuildingForPlacement = building;
+ /*
building.asset.interactive = true;
building.alpha = 1.0;
building.on('down', function () {
console.log("User is placing ", building);
currentBuildingForPlacement = building;
game.addChild(building);
building.visible = true;
});
- }
+ */
}
}, 100);
building.progressDisplay = progressDisplay;
currentSelection.buildingQueue.push(building);
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