DEVLOG #1 - Grid Building and Targeting System for Godot 4
I started work on building and targeting systems that work together for Top Down 2D Godot 4 games and wanted to show a bit of what's going on behind the scenes before I release an initial version of it. I intend to start releasing it to creator level supporters once it's in a more workable state.
The goal is to be able to detect which tiles on a grid are available for building, to indicate that visually, and then when trying to use the build system you will get feedback on whether a buildable object can be placed in the targeted tile (or tiles for lager objects like a house)
This is still an early prototype but hopefully the direction I'm heading with this is pretty clear if you've tried games like Stardew Valley, Terraria, or Forager
Mouse cursor not showing in the screenshot but wherever the mouse points, you have an indicator of the tile you are hovering over. The indicator snaps to the center of a tile so any detection should be inside the bounds of that tile for whether there are existing collisions or if the tile is on an unbuildable collision layer.
Here's an example of an unbuildable tile. The player can walk over the bridge tiles but they show as unbuildable to the indicator (don't mind that the bridge is hovering over grass, they are different layers of the same tilemap ~ The system checks all tile layers for collisions as well.)
Duplicating a bunch of houses. When in build mode you will see a preview of the object you are trying to place and through a designated action (currently I'm defaulting it to ui_accept), you can place the object. You can see the preview with the grid indicator on the far right (I will probably make preview objects show partially transparent or change the color to make it more obvious)
To implement next will be writing checks for valid placement (no collision) and to expand the indicator to show multiple tiles of placement zone for large objects like houses. I would like to write the code to setup multiple validation checks where all must pass in order to place the building. For instance, in a resource based game, you often would need a certain number of resources in order to place a building down. Checking that the resources exist in the player's inventory would be needed but not every game will work like that. The more flexible these checks the more they can apply to any 2d game.
Get Grid Building Plugin for Godot 4
Grid Building Plugin for Godot 4
Place Anything with Rotate, Flip, Stacking, and Drag Build
Status | In development |
Category | Assets |
Author | Chris' Tutorials |
Tags | 2D, City Builder, Godot, godot4, Metroidvania, Side Scroller, Tilemap, Top-Down, User Interface (UI) |
More posts
- 4.1.0 Manipulate with Move & Demolish Modes61 days ago
- Upcoming Grid Builder Updates for Godot 4.389 days ago
- 4.0.3 Compatibility Fix for Godot 4.2.2Jun 09, 2024
- 4.0.2 Small Enhancements & Bug FixesJun 09, 2024
- 4.0.1 File Path HotfixJun 07, 2024
- 4.0.0 - Shared BuildingState, Save / Load HelperJun 07, 2024
- 3.2.2 Bug FixesMar 06, 2024
- 3.2.1 - Input Mapping UpdatesJan 27, 2024
- 3.2.0 - Isometric Tilemap SupportJan 20, 2024
Leave a comment
Log in with itch.io to leave a comment.