Code edit (1 edits merged)
Please save this source code
Code edit (15 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'addChild')' in or related to this line: 'self.addChild(unit.asset);' Line Number: 1241
Code edit (2 edits merged)
Please save this source code
User prompt
Fix Bug: 'Timeout.tick error: viewSize is not defined' in or related to this line: 'var screenX = (self.cellX - gameMap.currentViewCenter.x + viewSize) * self.asset.width;' Line Number: 452
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
in render, concat player2 units to allUnits
User prompt
in render implement the loop that renders units
Code edit (4 edits merged)
Please save this source code
User prompt
I found the bug of unit not moving : unit is rendered in the render() function at the cell coordinates so the updateMovement changes are ignored. Fix the render function
Code edit (2 edits merged)
Please save this source code
User prompt
add the call updateMovement
Code edit (3 edits merged)
Please save this source code
User prompt
add the call to updateMovement
User prompt
rework moveUnit to use a delta and a continuous movement
Code edit (1 edits merged)
Please save this source code
Code edit (8 edits merged)
Please save this source code
User prompt
In moveActionLogic move the unit to the destination
User prompt
In handleDragEnd, when SET_ORDER_TARGET Use unit actions and handler instead of ‘actionHandler’
User prompt
In handleDragEnd, when SET_ORDER_TARGET call corresponding the action handler of the unit
Code edit (1 edits merged)
Please save this source code
User prompt
in handleDragEnd, after setting currentSelection.destinationTarget, stop the TargetMoveCursor 'move' handler
Code edit (1 edits merged)
Please save this source code
User prompt
in handleDragEnd, after setting currentSelection.destinationTarget hide the TargetMoveCursor
===================================================================
--- original.js
+++ change.js
@@ -383,8 +383,9 @@
var dy = targetPosition.y * 100 - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
var step = self.speed * delta;
if (distance < step) {
+ console.log("reached step", distance);
self.x = targetPosition.x * 100;
self.y = targetPosition.y * 100;
self.cellX = targetPosition.x;
self.cellY = targetPosition.y;
@@ -392,8 +393,9 @@
if (self.pathIndex >= self.path.length) {
self.isMoving = false;
}
} else {
+ console.log("advance by ", dx / distance * step);
self.x += dx / distance * step;
self.y += dy / distance * step;
}
};
@@ -1183,14 +1185,11 @@
gameIsRunning = true;
}
// Game tick
LK.on('tick', function () {
- // Render the map and update unit movement each tick
+ // Render the map each tick
if (gameIsRunning) {
gameMap.render();
- if (currentSelection && currentSelection.isUnit) {
- currentSelection.updateMovement(1 / 60); // Assuming tick operates at 60FPS
- }
}
});
// Start the game with Player 1 construction yard preselected
LK.setTimeout(function () {
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