User prompt
Fix Bug: 'Timeout.tick error: unitRepository is not defined' in or related to this line: 'var unitInfo = unitRepository.getUnitInfo(type);' Line Number: 342
User prompt
in Unit class , set the name property using the UnitRepository
Code edit (1 edits merged)
Please save this source code
User prompt
in SelectionMarker define 2 assets : selectionCross and selectionCircle
User prompt
Fix Bug: 'Timeout.tick error: element is not defined' in or related to this line: 'if (element.isBuilding) {' Line Number: 210
User prompt
in SelectionMarker setOnElement, use asset selectionCross when element.isBuilding, and selectionCircle when element.isUnit
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -589,8 +589,9 @@
var gameIsRunning = false;
var mapXSize = 50;
var mapYSize = 30;
var gameMap = new Map();
+var unitRepository = new UnitRepository();
// Define user action states
var UserActionState = {
NAVIGATING: 'navigating',
BUILDING: '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