Code edit (1 edits merged)
Please save this source code
User prompt
rework : if (cellX >= 0 && cellX < gameMap.cells.length && cellY >= 0 && cellY < gameMap.cells[cellX].length) { var cell = gameMap.cells[cellX][cellY]; if (!cell.building) { currentSelection = null; selectionMarker.hide(); console.log("Nothing selected at " + cellX + ',' + cellY); updateActionBoard(); } else { console.log("Selected building at " + cellX + ',' + cellY); currentSelection = cell.building; selectionMarker.setOnElement(currentSelection); updateActionBoard(); } } to handle units
User prompt
in handleDragEnd, if cell has a unit, select it
Code edit (1 edits merged)
Please save this source code
User prompt
in Unit class, tint the units in the color of the player
User prompt
in the render function, render the units after the buildings
User prompt
add the newHarvester to the gameMap
Code edit (1 edits merged)
Please save this source code
User prompt
add a Unit class to hold units common properties
User prompt
Fix Bug: 'Timeout.tick error: UnitHarvester is not defined' in or related to this line: 'var newHarvester = new UnitHarvester(rockIlot1Center.x, rockIlot1Center.y - 2, player1.playerId);' Line Number: 605
User prompt
Fix Bug: 'Timeout.tick error: unitRepository is not defined' in or related to this line: 'var harvesterUnitInfo = unitRepository.getUnitInfo('unitHarvester');' Line Number: 603
User prompt
in prepareMap, after player1.addBuilding(initialConstructionYard); add a new harvester to player 1
User prompt
add a addUnit function to Player class
User prompt
add an array of units to the player class
Code edit (1 edits merged)
Please save this source code
User prompt
add a global UnitRepository, and first unit will be the 'Spice Harvester'
User prompt
when CancelActionButton pressed,call restoreLabel on all BuildableItemIcon
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'cost')' in or related to this line: 'var costPerTick = buildableInfo.cost * 0.1 / constructionTime;' Line Number: 440
User prompt
when CancelActionButton pressed, if there is a building ready to place restaure its label to the name of the building instead of 'Place'
Code edit (1 edits merged)
Please save this source code
User prompt
also hide the cancelAction after the building was properly placed
User prompt
hide the CancelActionButton after it was pressed
User prompt
in CancelActionButton 'down', if PLACING_BUILDINGS restaure to NAVIGATING;
User prompt
Fix Bug: 'TypeError: Cannot read properties of null (reading 'asset')' in or related to this line: 'currentBuildingForPlacement.asset.tint = isValidPlacement ? 0xFFFFFF : 0xFF0000;' Line Number: 607
===================================================================
--- original.js
+++ change.js
@@ -226,8 +226,9 @@
self.cellH = cellH || 1; // Default to 1x1 if not specified
self.x = x * 100;
self.y = y * 100;
self.type = type;
+ self.isBuilding = true;
self.playerId = playerId;
self.name = name;
self.buildable = buildable || []; // New property to store what the building can build
self.asset = self.attachAsset(type, {
@@ -302,8 +303,9 @@
self.x = x * 100;
self.y = y * 100;
self.playerId = playerId;
self.type = type;
+ self.isUnit = true;
self.asset = self.attachAsset(type, {
anchorX: 0.5,
anchorY: 0.5,
tint: getPlayerTint(playerId)
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