Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'viewPort.wCellX = Math.max(0, Math.min(mapXSize - viewPort.cellW, rockIlot1Center.x - Math.floor(viewPort.cellW / 2)));' Line Number: 2035
User prompt
ok, but also set the viewport centered on the rockIlot1Center at start
User prompt
currently rockIlot1Center and rockIlot2Center are fixed on top left and bottom down. make them randomly 'rotate' so that players start at one of the corners randomly
Code edit (11 edits merged)
Please save this source code
User prompt
in checkGameEnd(), show popup asset before game over
User prompt
show popup asset before game over
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
under welcomeText, add a help text "how to play..."
Code edit (2 edits merged)
Please save this source code
User prompt
on the popup write the text "Welcome on Dune."
Code edit (1 edits merged)
Please save this source code
User prompt
before game starts, show popup Asset
User prompt
before the game starts display a popup
Code edit (6 edits merged)
Please save this source code
User prompt
how would you handle energy so that low energy level slow down constructions
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'type')' in or related to this line: 'player1.spice += buildableRepository.getBuildableInfo(currentBuildingForPlacement.type).cost;' Line Number: 462
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: unit is not defined' in or related to this line: 'switch (unit.type) {' Line Number: 2176
Code edit (1 edits merged)
Please save this source code
Code edit (14 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -569,9 +569,11 @@
// Create and return the navigation mesh for pathfinding
};
self.findPath = function (start, end, range, ignoreSpecificBuilding) {
range = range || 0;
- console.log("findPath ", start, end, range);
+ if (range == 13) {
+ console.log("findPath ", start, end, range);
+ }
// A* pathfinding algorithm implementation
// Avoid buildings by checking if the cell is occupied
var openSet = [];
var closedSet = [];
@@ -603,8 +605,11 @@
var currentNode = openSet[lowestIndex];
var dx = currentNode.x - endNode.x;
var dy = currentNode.y - endNode.y;
if (Math.sqrt(dx * dx + dy * dy) <= range) {
+ if (range == 13) {
+ console.log("findPath Ok Within range :", currentNode.x, currentNode.y + " / dist=" + Math.sqrt(dx * dx + dy * dy));
+ }
var curr = currentNode;
while (curr.parent) {
var prev = curr.parent;
if (prev) {
@@ -619,9 +624,11 @@
}
curr = curr.parent;
}
path.reverse();
- //console.log("Return path 1", path);
+ if (range == 13) {
+ console.log("Return path 1", path);
+ }
return path;
}
openSet.splice(lowestIndex, 1);
closedSet.push(currentNode);
@@ -1052,16 +1059,16 @@
self.lastAttackTime = Date.now();
// Check if target is in range
var distanceToTarget = calculateDistance(self, self.attackTarget);
if (distanceToTarget <= self.attackRange) {
- console.log("Target at range => fire");
+ console.log(self.playerId + " - " + self.type + " : Target at range => fire");
// Rotate towards the target
var angleToTarget = calculateAngle(self, self.attackTarget);
self.asset.rotation = angleToTarget;
// Fire at the target
self.fire();
} else {
- console.log("Target too far => move to target");
+ console.log(self.playerId + " - " + self.type + " : Target too far => move to target");
self.attackMode = 2;
// Move towards the target if it's out of range
var path = gameMap.findPath({
x: self.cellX,
@@ -1375,10 +1382,9 @@
'className': 'UnitHeavyTank',
'actions': ['move', 'attack', 'return'],
'health': 60,
'sightRange': 8,
- 'attackRange': 2,
- //6, TEMP DEBUG !!!TEMP DEBUG !!!TEMP DEBUG !!!
+ 'attackRange': 6,
'attackSpeed': 5,
'attackDamage': 6
}
// Add more units as needed
@@ -1658,9 +1664,9 @@
console.log("AttackActionLogic...", targetCellX, ',', targetCellY);
var target = gameMap.cells[targetCellX][targetCellY].unit || gameMap.cells[targetCellX][targetCellY].building;
if (theUnit && theUnit.isUnit && target) {
theUnit.stopOtherActions();
- var attackPosition = findAvailableCellAtRange(targetCellX, targetCellY, theUnit.range);
+ var attackPosition = findAvailableCellAtRange(targetCellX, targetCellY, theUnit.attackRange);
var path = gameMap.findPath({
x: theUnit.cellX,
y: theUnit.cellY
}, {
@@ -2469,9 +2475,11 @@
//unit.visible = false;
});
gameMap.handleDrag(inputPosition);
dragDelta = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
- selectionMarker.setOnElement(currentSelection);
+ if (currentSelection && currentSelection.health > 0) {
+ selectionMarker.setOnElement(currentSelection);
+ }
}
}
function handleDragEnd(obj) {
var currentPos = obj.event.getLocalPosition(game);
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