Code edit (20 edits merged)
Please save this source code
User prompt
in unitharvester stopOtherActions, user unit player tint instead of 0xFFFFFF
User prompt
implent fog of war
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Update the findPath A* algorithm to take into account the range when openSet.length === 0
User prompt
Update the findPath A* algorithm to take into account the range
Code edit (5 edits merged)
Please save this source code
User prompt
add a new 'range' argument to findPath that give the desired range to destination. default is 0
User prompt
add a new 'range' argument to findPath and return the path when distance to destination is <= range
Code edit (2 edits merged)
Please save this source code
User prompt
in guard, only add units and building of other player in allTargets
Code edit (1 edits merged)
Please save this source code
User prompt
in guard function, also search for buildings
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
in prepareMap, add 2 WindTraps for player 2
Code edit (1 edits merged)
Please save this source code
User prompt
if displayActionItems, also check if unit health > 0 before displaying actions
Code edit (1 edits merged)
Please save this source code
User prompt
in fire(), if target element health <=0 return to attackMode = 0
User prompt
in setOnElement, if element health <=0 hide the selector
User prompt
in findPath return the best path even if it doest reach the destination
Code edit (3 edits merged)
Please save this source code
User prompt
in findPath pathfinding algorithm avoid also cells with units
===================================================================
--- original.js
+++ change.js
@@ -1733,9 +1733,9 @@
var initialConstructionYard = new ConstructionYard(rockIlot1Center.x, rockIlot1Center.y, 1);
gameMap.cells[rockIlot1Center.x][rockIlot1Center.y].building = initialConstructionYard;
applyCellOccupation(rockIlot1Center.x, rockIlot1Center.y);
player1.addBuilding(initialConstructionYard);
- // Add a new harvester to player 1
+ // Player 2 base
// Define a fixed rock ilot near the center right of the map
var rockIlot2Center = {
x: 10,
//Math.floor(mapXSize * 0.85),// TEMP DEBUG !!!// TEMP DEBUG !!!// TEMP DEBUG !!!
@@ -1753,22 +1753,60 @@
var initialConstructionYard2 = new ConstructionYard(rockIlot2Center.x, rockIlot2Center.y, 2);
gameMap.cells[rockIlot2Center.x][rockIlot2Center.y].building = initialConstructionYard2;
applyCellOccupation(rockIlot2Center.x, rockIlot2Center.y);
player2.addBuilding(initialConstructionYard2);
- // Add 2 WindTraps for player 2
- var windTrap1 = new WindTrap(rockIlot2Center.x + 2, rockIlot2Center.y, 2);
- gameMap.cells[rockIlot2Center.x + 2][rockIlot2Center.y].building = windTrap1;
- applyCellOccupation(rockIlot2Center.x + 2, rockIlot2Center.y);
+ var windTrap1 = new WindTrap(rockIlot2Center.x + 3, rockIlot2Center.y, 2);
+ gameMap.cells[rockIlot2Center.x + 3][rockIlot2Center.y].building = windTrap1;
+ applyCellOccupation(rockIlot2Center.x + 3, rockIlot2Center.y);
player2.addBuilding(windTrap1);
- var windTrap2 = new WindTrap(rockIlot2Center.x - 4, rockIlot2Center.y, 2);
- gameMap.cells[rockIlot2Center.x + 4][rockIlot2Center.y].building = windTrap2;
- applyCellOccupation(rockIlot2Center.x + 4, rockIlot2Center.y);
+ var windTrap2 = new WindTrap(rockIlot2Center.x - 3, rockIlot2Center.y, 2);
+ gameMap.cells[rockIlot2Center.x - 3][rockIlot2Center.y].building = windTrap2;
+ applyCellOccupation(rockIlot2Center.x - 3, rockIlot2Center.y);
player2.addBuilding(windTrap2);
- // Spawn a Quad for player 2 next to its ConstructionYard
- var quadForPlayer2 = new UnitQuad(rockIlot2Center.x + 2, rockIlot2Center.y, 2);
- gameMap.cells[rockIlot2Center.x + 2][rockIlot2Center.y].unit = quadForPlayer2;
- player2.addUnit(quadForPlayer2);
- game.addChild(quadForPlayer2);
+ var refinery1 = new SpiceRefinery(rockIlot2Center.x - 3, rockIlot2Center.y + 3, 2);
+ gameMap.cells[rockIlot2Center.x - 3][rockIlot2Center.y + 3].building = refinery1;
+ applyCellOccupation(rockIlot2Center.x - 3, rockIlot2Center.y + 3);
+ player2.addBuilding(refinery1);
+ var heavyFactory1 = new HeavyFactory(rockIlot2Center.x + 2, rockIlot2Center.y + 3, 2);
+ gameMap.cells[rockIlot2Center.x + 2][rockIlot2Center.y + 3].building = heavyFactory1;
+ applyCellOccupation(rockIlot2Center.x + 2, rockIlot2Center.y + 3);
+ player2.addBuilding(heavyFactory1);
+ var lightFactory1 = new LightFactory(rockIlot2Center.x, rockIlot2Center.y - 3, 2);
+ gameMap.cells[rockIlot2Center.x][rockIlot2Center.y - 3].building = lightFactory1;
+ applyCellOccupation(rockIlot2Center.x, rockIlot2Center.y - 3);
+ player2.addBuilding(lightFactory1);
+ var quad1 = new UnitQuad(rockIlot2Center.x, rockIlot2Center.y - 6, 2);
+ gameMap.cells[rockIlot2Center.x][rockIlot2Center.y - 6].unit = quad1;
+ player2.addUnit(quad1);
+ game.addChild(quad1);
+ var quad2 = new UnitQuad(rockIlot2Center.x, rockIlot2Center.y + 6, 2);
+ gameMap.cells[rockIlot2Center.x][rockIlot2Center.y + 6].unit = quad2;
+ player2.addUnit(quad2);
+ game.addChild(quad2);
+ var heavyTank1 = new UnitHeavyTank(rockIlot2Center.x - 5, rockIlot2Center.y - 5, 2);
+ gameMap.cells[rockIlot2Center.x - 5][rockIlot2Center.y - 5].unit = heavyTank1;
+ player2.addUnit(heavyTank1);
+ game.addChild(heavyTank1);
+ var heavyTank2 = new UnitHeavyTank(rockIlot2Center.x + 5, rockIlot2Center.y - 5, 2);
+ gameMap.cells[rockIlot2Center.x + 5][rockIlot2Center.y - 5].unit = heavyTank2;
+ player2.addUnit(heavyTank2);
+ game.addChild(heavyTank2);
+ var heavyTank3 = new UnitHeavyTank(rockIlot2Center.x + 5, rockIlot2Center.y + 5, 2);
+ gameMap.cells[rockIlot2Center.x + 5][rockIlot2Center.y + 5].unit = heavyTank3;
+ player2.addUnit(heavyTank3);
+ game.addChild(heavyTank3);
+ var heavyTank4 = new UnitHeavyTank(rockIlot2Center.x - 5, rockIlot2Center.y + 5, 2);
+ gameMap.cells[rockIlot2Center.x - 5][rockIlot2Center.y + 5].unit = heavyTank4;
+ player2.addUnit(heavyTank4);
+ game.addChild(heavyTank4);
+ var lightTank5 = new UnitLightTank(rockIlot2Center.x - 1, rockIlot2Center.y - 1, 2);
+ gameMap.cells[rockIlot2Center.x - 1][rockIlot2Center.y - 1].unit = lightTank5;
+ player2.addUnit(lightTank5);
+ game.addChild(lightTank5);
+ var lightTank6 = new UnitLightTank(rockIlot2Center.x + 2, rockIlot2Center.y + 2, 2);
+ gameMap.cells[rockIlot2Center.x + 2][rockIlot2Center.y + 2].unit = lightTank6;
+ player2.addUnit(lightTank6);
+ game.addChild(lightTank6);
gameMap.initTerrain(mapXSize, mapYSize); // Initialize with a 20x20 grid
initSpiceSpots();
console.log('ConstructionYard1 cell :', gameMap.cells[rockIlot1Center.x][rockIlot1Center.y]);
selectionMarker = new SelectionMarker();
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