Code edit (5 edits merged)
Please save this source code
User prompt
character cannot spawn on a wall tile
User prompt
tint the tile floor with light grey
Code edit (3 edits merged)
Please save this source code
User prompt
preserve the original size of the shadow
User prompt
add a shadow blob on the feet of the character
User prompt
character is not moving to the selected tile, debug it
User prompt
animate the character with an idle animation
User prompt
Please fix the bug: 'ReferenceError: moveCharacter is not defined' in or related to this line: 'moveCharacter(path);' Line Number: 204
User prompt
rename the asset mouse to character
User prompt
using path finding move the mouse to the mouse selectedTile, mouse must move following the grid
User prompt
on the start of the game spawn the mouse on a random tile
User prompt
clear tile tint when a new tile is selected, save the selected tile in a variable call the variable selectedTile
User prompt
highlight the tile that is under toiuch input
User prompt
add a border of wall tiles around the map, call the asset and variable wallTile
Code edit (1 edits merged)
Please save this source code
User prompt
create a grid that covers all the screen, expose the grid size variable
User prompt
delete all, start from fresh
User prompt
remove all but one floor tile
Code edit (1 edits merged)
Please save this source code
User prompt
add a border to the map
User prompt
add 2 more floor tile assets and randomize them on the grid
Code edit (4 edits merged)
Please save this source code
User prompt
remove all walls
User prompt
delete all references for the wall asset
/**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Define the grid size var gridSize = 25; // Create a 2D array to represent the grid var grid = new Array(gridSize); for (var i = 0; i < gridSize; i++) { grid[i] = new Array(gridSize); } // Calculate the size of each cell in the grid var cellWidth = 2048 / gridSize; var cellHeight = 2048 / gridSize; // Populate the grid with cells for (var x = 0; x < gridSize; x++) { for (var y = 0; y < gridSize; y++) { var tile; if (x == 0 || y == 0 || x == gridSize - 1 || y == gridSize - 1) { tile = LK.getAsset('wallTile', { anchorX: 0.0, anchorY: 0.0, scaleX: cellWidth / 100, scaleY: cellHeight / 100, x: x * cellWidth, y: y * cellHeight }); } else { tile = LK.getAsset('floorTile', { anchorX: 0.0, anchorY: 0.0, scaleX: cellWidth / 100, scaleY: cellHeight / 100, x: x * cellWidth, y: y * cellHeight }); } game.addChild(tile); grid[x][y] = tile; } } var selectedTile; // Handle touch events on the game stage game.on('down', function (obj) { // Get the position of the touch event var pos = obj.event.getLocalPosition(game); // Calculate the grid coordinates of the touch event var gridX = Math.floor(pos.x / cellWidth); var gridY = Math.floor(pos.y / cellHeight); // Clear the tint of the previously selected tile if (selectedTile) { selectedTile.tint = 0xFFFFFF; } // Highlight the tile under the touch event var tile = grid[gridX][gridY]; tile.tint = 0x00ff00; // Save the selected tile selectedTile = tile; });
===================================================================
--- original.js
+++ change.js
@@ -44,15 +44,22 @@
game.addChild(tile);
grid[x][y] = tile;
}
}
+var selectedTile;
// Handle touch events on the game stage
game.on('down', function (obj) {
// Get the position of the touch event
var pos = obj.event.getLocalPosition(game);
// Calculate the grid coordinates of the touch event
var gridX = Math.floor(pos.x / cellWidth);
var gridY = Math.floor(pos.y / cellHeight);
+ // Clear the tint of the previously selected tile
+ if (selectedTile) {
+ selectedTile.tint = 0xFFFFFF;
+ }
// Highlight the tile under the touch event
var tile = grid[gridX][gridY];
tile.tint = 0x00ff00;
+ // Save the selected tile
+ selectedTile = tile;
});
\ No newline at end of file
grey square, black border. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
simple light yellow button front view game console, clean, rounded edges, high resolution, graphic. Single Game Texture. In-Game asset. 2d. Blank background. High contrast.
Worn out sticker for a video game, 90s style, cheese, simple, vintage. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
wall view from top-down, game asset videogame, black color, simple. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. worn out sticker. 90's style. vintage. simple. top-down view. poster. sticker
top-down view, videogame character enemy, roomba, 90s style sticker, flat, no perspective, silhouette, black and white, cartoon, fun, simple, from above. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
top-down view, videogame heart, 90s style sticker, flat, no perspective, silhouette, white, cartoon, fun, simple, from above. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Black square with white outline. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.