User prompt
I don't see the log : console.log("Building selected", self); when 1 click on a building
Code edit (1 edits merged)
Please save this source code
User prompt
when an empty cell of the map is clicked currentSelection is set back to null
User prompt
Now can you handle the UI system ? set a currentSelection global variable, when a building is clicked, set this variable
Code edit (18 edits merged)
Please save this source code
User prompt
Do you have a more 'royal' font for player1SpiceText ?
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
add anchors to player1SpiceText
Code edit (6 edits merged)
Please save this source code
User prompt
add a black text at the top right with player1 spice level
User prompt
This game is Dune 2, so the objective is to harvest spice. add a 'spice' property to Player class with a value of 1000
Code edit (1 edits merged)
Please save this source code
User prompt
add a function getTint(playerId) to the Player class that take the playerId and returns its tint
Code edit (2 edits merged)
Please save this source code
User prompt
give each player a tint color 1 => blue, 2 => Red
User prompt
Introduce the Player class and player1 and player2 global variables.
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '15')' in or related to this line: 'gameMap.cells[rockIlot1Center.x][rockIlot1Center.y].building = new ConstructionYard(rockIlot1Center.x, rockIlot1Center.y);' Line Number: 196
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'cells')' in or related to this line: 'gameMap.cells[rockIlot1Center.x][rockIlot1Center.y].building = new ConstructionYard(rockIlot1Center.x, rockIlot1Center.y);' Line Number: 194
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '0')' in or related to this line: 'self.cells[x][y] = {' Line Number: 22
Code edit (6 edits merged)
Please save this source code
User prompt
is it possible to use `mousedown`, `mousemove`, `mouseup` for mouse events and `touchstart`, `touchmove`, `touchend` for touch events instead of 'up', down, move ?
===================================================================
--- original.js
+++ change.js
@@ -56,9 +56,9 @@
//building.x = screenX;
//building.y = screenY;
building.asset.x = screenX;
building.asset.y = screenY;
- //if (!building.asset.parent)
+ //if (!building.asset.parent)
{
self.addChild(building.asset);
}
//console.log("Building at " + x + ',' + y, building);
@@ -196,15 +196,14 @@
globalTerrain[x][y] = 1;
}
}
}
+// The instantiation of ConstructionYard is now moved after gameMap has been initialized and added to the game
console.log("rockIlot2Center at " + rockIlot2Center.x + ',' + rockIlot2Center.y);
-gameMap.cells[rockIlot2Center.x][rockIlot2Center.y].building = new ConstructionYard(rockIlot2Center.x, rockIlot2Center.y);
-console.log('ConstructionYard cell :', gameMap.cells[rockIlot2Center.x][rockIlot2Center.y]);
-// Add the map to the game
+// Instantiate and initialize the Map
var gameMap = new Map();
-gameMap.init(mapXSize, mapYSize); // Initialize with a 20x20 grid
-// This should be done after the map is fully initialized and ready to render
+gameMap.init(mapXSize, mapYSize); // Initialize with a 50x30 grid
+// Add the map to the game after it is fully initialized and ready to render
game.addChild(gameMap);
var isPressing = false;
var dragStart = null;
function handleDragStart(obj) {
@@ -230,8 +229,14 @@
game.on('move', handleDragMove);
game.on('up', handleDragEnd);
// Instantiate CommandPanel
var commandPanel = game.addChild(new CommandPanel());
+// Instantiate ConstructionYard buildings after the map has been initialized and added to the game
+console.log("rockIlot1Center at " + rockIlot1Center.x + ',' + rockIlot1Center.y);
+gameMap.cells[rockIlot1Center.x][rockIlot1Center.y].building = new ConstructionYard(rockIlot1Center.x, rockIlot1Center.y);
+console.log("rockIlot2Center at " + rockIlot2Center.x + ',' + rockIlot2Center.y);
+gameMap.cells[rockIlot2Center.x][rockIlot2Center.y].building = new ConstructionYard(rockIlot2Center.x, rockIlot2Center.y);
+console.log('ConstructionYard cell :', gameMap.cells[rockIlot2Center.x][rockIlot2Center.y]);
// Game tick
LK.on('tick', function () {
// Render the map each tick
gameMap.render();
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