Added tilemap example
|
@ -0,0 +1,24 @@
|
||||||
|
# Attribution
|
||||||
|
## Collaborators
|
||||||
|
|
||||||
|
### Art
|
||||||
|
[Cup Nooble](https://cupnooble.itch.io/)
|
||||||
|
|
||||||
|
### Code and Documentation
|
||||||
|
[Maaack](https://maaack.itch.io/)
|
||||||
|
|
||||||
|
## Tools
|
||||||
|
#### Godot
|
||||||
|
Author: [Juan Linietsky, Ariel Manzur, and contributors](https://godotengine.org/contact)
|
||||||
|
Source: [godotengine.org](https://godotengine.org/)
|
||||||
|
License: [MIT License](https://github.com/godotengine/godot/blob/master/LICENSE.txt)
|
||||||
|
|
||||||
|
#### Visual Studio Code
|
||||||
|
Author: [Microsoft](https://opensource.microsoft.com/)
|
||||||
|
Source: [github: vscode](https://github.com/microsoft/vscode)
|
||||||
|
License: [MIT License](https://github.com/microsoft/vscode/blob/main/LICENSE.txt)
|
||||||
|
|
||||||
|
#### Git
|
||||||
|
Author: [Linus Torvalds](https://github.com/torvalds)
|
||||||
|
Source: [git-scm.com](https://git-scm.com/downloads)
|
||||||
|
License: [GNU General Public License version 2](https://opensource.org/licenses/GPL-2.0)
|
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (c) 2024-present Marek Belski.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
|
@ -0,0 +1,56 @@
|
||||||
|
# Sprout Lands Tilemap
|
||||||
|
For Godot 4.3. Made in collaboration with [Cup Nooble](https://cupnooble.itch.io/).
|
||||||
|
|
||||||
|
[Example on itch.io](https://maaack.itch.io/harvest-hill-gwj-62-edition)
|
||||||
|
![Example Screenshot](/addons/sprout_lands_tilemap/media/Example_Screenshot_1.png)
|
||||||
|
|
||||||
|
## Use Case
|
||||||
|
Start building worlds with the free [Sprout Lands Asset Pack](https://cupnooble.itch.io/sprout-lands-asset-pack) right away.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
1. Download and run [Godot](https://godotengine.org/).
|
||||||
|
2. Start a new project and have it open.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### GitHub
|
||||||
|
|
||||||
|
|
||||||
|
1. Download the latest release version from [GitHub](https://github.com/Maaack/Sprout-Lands-Tilemap/releases/latest).
|
||||||
|
2. Extract the contents of the archive.
|
||||||
|
3. Move the `addons/sprout_lands_tilemap` folder into your project's `addons/` folder.
|
||||||
|
4. Open/Reload the project.
|
||||||
|
5. Enable the plugin from the Project Settings > Plugins tab.
|
||||||
|
If it's enabled for the first time,
|
||||||
|
1. A dialogue window will appear asking to copy the example scenes out of `addons/`.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The example scene can be opened and worked in directly. If you'd rather start from scratch, here are the instructions.
|
||||||
|
|
||||||
|
1. Start a new scene with a Node2D.
|
||||||
|
![Clicking on 2D Scene](/addons/sprout_lands_tilemap/media/Usage_Screenshot_1.png)
|
||||||
|
2. Instantiate a custom scene as a node.
|
||||||
|
![Instatiate a Custom Scene](/addons/sprout_lands_tilemap/media/Usage_Screenshot_2.png)
|
||||||
|
3. Locate `SproutLandsTileMap.tscn` and open it.
|
||||||
|
![Open Custom Scene](/addons/sprout_lands_tilemap/media/Usage_Screenshot_4.png)
|
||||||
|
4. Confirm the new node is added and selected in the scene tree.
|
||||||
|
![Confirm new node](/addons/sprout_lands_tilemap/media/Usage_Screenshot_5.png)
|
||||||
|
5. Open the TileMap editor, (if it is not open already).
|
||||||
|
![Selecting TileMap Editor](/addons/sprout_lands_tilemap/media/Usage_Screenshot_6.png)
|
||||||
|
6. Select to draw terrains.
|
||||||
|
![Selecting to draw terrains](/addons/sprout_lands_tilemap/media/Usage_Screenshot_7.png)
|
||||||
|
7. Select a terrain to draw (ex. Grass)
|
||||||
|
![Selecting Grass Terrain](/addons/sprout_lands_tilemap/media/Usage_Screenshot_8.png)
|
||||||
|
8. Draw the terrain (ex. Grass) in the scene view.
|
||||||
|
![Drawing Grass](/addons/sprout_lands_tilemap/media/Usage_Screenshot_9.png)
|
||||||
|
|
||||||
|
### Intermediate Usage
|
||||||
|
|
||||||
|
You may noticed that only one kind of tile can occupy any given space, while some tiles have transparency and should be placed over others. For this, there are layers that can be changed in the TileMap editor.
|
||||||
|
![Changing TileMap Layers](/addons/sprout_lands_tilemap/media/Usage_Screenshot_10.png)
|
||||||
|
The names are merely for convenience and do not enforce any rules themselves.
|
||||||
|
|
||||||
|
## Links
|
||||||
|
[Attribution](/addons/sprout_lands_tilemap/ATTRIBUTION.md)
|
||||||
|
[Code License](/addons/sprout_lands_tilemap/LICENSE.txt)
|
After Width: | Height: | Size: 3.3 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b3846xma3tu8x"
|
||||||
|
path="res://.godot/imported/Basic Furniture.png-6fadfe6630bddca6b2ba965ab8016a77.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Objects/Basic Furniture.png"
|
||||||
|
dest_files=["res://.godot/imported/Basic Furniture.png-6fadfe6630bddca6b2ba965ab8016a77.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 6.0 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cn7oug0kk5tkd"
|
||||||
|
path="res://.godot/imported/Basic Grass Biom things 1.png-7226e7131ed87e0d7cf06d3a59e8b753.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Objects/Basic Grass Biom things 1.png"
|
||||||
|
dest_files=["res://.godot/imported/Basic Grass Biom things 1.png-7226e7131ed87e0d7cf06d3a59e8b753.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 2.2 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://m0j0oacx0vki"
|
||||||
|
path="res://.godot/imported/Basic Plants.png-78263bb85f5ccec89e350e03473eae81.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Objects/Basic Plants.png"
|
||||||
|
dest_files=["res://.godot/imported/Basic Plants.png-78263bb85f5ccec89e350e03473eae81.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 1.4 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b8o37isqmwiws"
|
||||||
|
path="res://.godot/imported/Basic tools and meterials.png-6515e0c1abe9d0f36c946a96d170fe49.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Objects/Basic tools and meterials.png"
|
||||||
|
dest_files=["res://.godot/imported/Basic tools and meterials.png-6515e0c1abe9d0f36c946a96d170fe49.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 1.7 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bhjytby2ycvpn"
|
||||||
|
path="res://.godot/imported/Chest.png-2f31bb26b650bc6d11e8b5f4f339983b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Objects/Chest.png"
|
||||||
|
dest_files=["res://.godot/imported/Chest.png-2f31bb26b650bc6d11e8b5f4f339983b.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 270 B |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://droul8ku4n0e8"
|
||||||
|
path="res://.godot/imported/Egg item.png-5e7445936adf637d254ff825ddb01e57.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Objects/Egg item.png"
|
||||||
|
dest_files=["res://.godot/imported/Egg item.png-5e7445936adf637d254ff825ddb01e57.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://u6j17ar14roc"
|
||||||
|
path="res://.godot/imported/Free_Chicken_House.png-9fdf508140ccb896e3546f926081d3bc.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Objects/Free_Chicken_House.png"
|
||||||
|
dest_files=["res://.godot/imported/Free_Chicken_House.png-9fdf508140ccb896e3546f926081d3bc.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 622 B |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cvemyer4jq6we"
|
||||||
|
path="res://.godot/imported/Paths.png-c2fa1b0a7048a676341c4f78195df77c.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Objects/Paths.png"
|
||||||
|
dest_files=["res://.godot/imported/Paths.png-c2fa1b0a7048a676341c4f78195df77c.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 628 B |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dmwitnt28vkpf"
|
||||||
|
path="res://.godot/imported/Simple Milk and grass item.png-ea8828b3b3a3578ed123b310d8de5d78.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Objects/Simple Milk and grass item.png"
|
||||||
|
dest_files=["res://.godot/imported/Simple Milk and grass item.png-ea8828b3b3a3578ed123b310d8de5d78.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 706 B |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://wv1f6vqgbdgy"
|
||||||
|
path="res://.godot/imported/Wood Bridge.png-bc921a43893eaceae0734dab7439fbc6.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Objects/Wood Bridge.png"
|
||||||
|
dest_files=["res://.godot/imported/Wood Bridge.png-bc921a43893eaceae0734dab7439fbc6.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 483 B |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://2bsfgjphvmox"
|
||||||
|
path="res://.godot/imported/Fences.png-0510e11555b38734a32b06b767c24468.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Tilesets/Fences.png"
|
||||||
|
dest_files=["res://.godot/imported/Fences.png-0510e11555b38734a32b06b767c24468.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 3.9 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bngfh7nslvij1"
|
||||||
|
path="res://.godot/imported/Grass.png-d716d8e072bc0866700719df692c3a51.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Tilesets/Grass.png"
|
||||||
|
dest_files=["res://.godot/imported/Grass.png-d716d8e072bc0866700719df692c3a51.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 2.7 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b0xa5ivsbc470"
|
||||||
|
path="res://.godot/imported/Hills.png-82d06eacf3c76092fbe51fb75a16631a.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Tilesets/Hills.png"
|
||||||
|
dest_files=["res://.godot/imported/Hills.png-82d06eacf3c76092fbe51fb75a16631a.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 2.0 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://d1c7tdeg77os"
|
||||||
|
path="res://.godot/imported/Tilled Dirt.png-cda4da5891632798f5eeef9f6d82adfd.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Tilesets/Tilled Dirt.png"
|
||||||
|
dest_files=["res://.godot/imported/Tilled Dirt.png-cda4da5891632798f5eeef9f6d82adfd.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 251 B |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bif0n5c12bwrh"
|
||||||
|
path="res://.godot/imported/Water.png-e8ab9e641ff7e64c5be0268db5b717fb.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Tilesets/Water.png"
|
||||||
|
dest_files=["res://.godot/imported/Water.png-e8ab9e641ff7e64c5be0268db5b717fb.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
After Width: | Height: | Size: 1.7 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bkmnb6mm8tpyu"
|
||||||
|
path="res://.godot/imported/Wooden House.png-087d02cd3fbbfa998061af6583a8094a.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/assets/Tilesets/Wooden House.png"
|
||||||
|
dest_files=["res://.godot/imported/Wooden House.png-087d02cd3fbbfa998061af6583a8094a.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=false
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
|
@ -0,0 +1,14 @@
|
||||||
|
Heyo! Thanks for downloading the Sprout Lands asset pack. -Made by: Cup Nooble
|
||||||
|
|
||||||
|
This asset pack is the start of a series of different asset packs, so let me know if there's any specific sprites you'd like in future packs.
|
||||||
|
|
||||||
|
License - Free Basic Pack
|
||||||
|
- You can modify the assets.
|
||||||
|
- You can not redistribute or resale, even if modified.
|
||||||
|
- You can only use these assets in non-commercial projects. [ Also No NFT's pls ]
|
||||||
|
(If you want to make something commercial with these sprites contact me or buy the premium version)
|
||||||
|
|
||||||
|
Follow Sprout Lands on Twitter for future updates :
|
||||||
|
https://twitter.com/Sprout_Lands
|
||||||
|
|
||||||
|
If you enjoy this then leave a rating and comment. It helps to support this project! :D
|
|
@ -0,0 +1,5 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://cmvnsoetr3ume"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://csv8m50kp3gk4" path="res://addons/sprout_lands_tilemap/base/scenes/sprout_lands_tile_map.tscn" id="1_rfumu"]
|
||||||
|
|
||||||
|
[node name="BlankSproutLandsTileMap" instance=ExtResource("1_rfumu")]
|
After Width: | Height: | Size: 5.1 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bjtkevhya3qsd"
|
||||||
|
path="res://.godot/imported/icon.png-7534bc49ccd8e5814ac2de1576365b83.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/sprout_lands_tilemap/icon.png"
|
||||||
|
dest_files=["res://.godot/imported/icon.png-7534bc49ccd8e5814ac2de1576365b83.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
|
@ -0,0 +1,13 @@
|
||||||
|
[gd_scene format=3 uid="uid://cyx4i4v30bw4o"]
|
||||||
|
|
||||||
|
[node name="CopyConfirmationDialog" type="ConfirmationDialog"]
|
||||||
|
initial_position = 2
|
||||||
|
size = Vector2i(400, 210)
|
||||||
|
visible = true
|
||||||
|
exclusive = false
|
||||||
|
ok_button_text = "Yes"
|
||||||
|
dialog_text = "Plugin enabled. It is recommended to copy the example scenes to a destination outside of the addons/ folder before editing them.
|
||||||
|
|
||||||
|
Would you like to copy the examples now?"
|
||||||
|
dialog_autowrap = true
|
||||||
|
cancel_button_text = "No"
|
|
@ -0,0 +1,11 @@
|
||||||
|
[gd_scene format=3 uid="uid://ckx50am7thhd2"]
|
||||||
|
|
||||||
|
[node name="DestinationDialog" type="FileDialog"]
|
||||||
|
title = "Select a Destination"
|
||||||
|
initial_position = 2
|
||||||
|
size = Vector2i(400, 400)
|
||||||
|
visible = true
|
||||||
|
exclusive = false
|
||||||
|
ok_button_text = "Select Current Folder"
|
||||||
|
mode_overrides_title = false
|
||||||
|
file_mode = 2
|
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 10 KiB |
|
@ -0,0 +1,9 @@
|
||||||
|
[plugin]
|
||||||
|
|
||||||
|
name="Sprout Lands TileMap"
|
||||||
|
description="Test of the Sprout Lands asset pack in Godot tilemaps.
|
||||||
|
|
||||||
|
Made in collaboration with Cup Nooble - cupnooble.itch.io"
|
||||||
|
author="Marek Belski"
|
||||||
|
version="0.2.0"
|
||||||
|
script="sprout_lands_tilemap.gd"
|
|
@ -0,0 +1,167 @@
|
||||||
|
@tool
|
||||||
|
extends EditorPlugin
|
||||||
|
|
||||||
|
const PLUGIN_NAME = "Sprout Lands TileMap"
|
||||||
|
const PROJECT_SETTINGS_PATH = "sprout_lands_tilemap/"
|
||||||
|
|
||||||
|
const EXAMPLES_RELATIVE_PATH = "examples/"
|
||||||
|
const UID_PREG_MATCH = r'uid="uid:\/\/[0-9a-z]+" '
|
||||||
|
const RESAVING_DELAY : float = 0.5
|
||||||
|
const REIMPORT_FILE_DELAY : float = 0.2
|
||||||
|
const OPEN_EDITOR_DELAY : float = 0.1
|
||||||
|
|
||||||
|
func _get_plugin_name():
|
||||||
|
return PLUGIN_NAME
|
||||||
|
|
||||||
|
func get_plugin_path() -> String:
|
||||||
|
return get_script().resource_path.get_base_dir() + "/"
|
||||||
|
|
||||||
|
func get_plugin_examples_path() -> String:
|
||||||
|
return get_plugin_path() + EXAMPLES_RELATIVE_PATH
|
||||||
|
|
||||||
|
func _update_main_scene(main_scene_path : String):
|
||||||
|
ProjectSettings.set_setting("application/run/main_scene", main_scene_path)
|
||||||
|
ProjectSettings.save()
|
||||||
|
|
||||||
|
func _replace_file_contents(file_path : String, target_path : String):
|
||||||
|
var extension : String = file_path.get_extension()
|
||||||
|
if extension == "import":
|
||||||
|
# skip import files
|
||||||
|
return OK
|
||||||
|
var file = FileAccess.open(file_path, FileAccess.READ)
|
||||||
|
var regex = RegEx.new()
|
||||||
|
regex.compile(UID_PREG_MATCH)
|
||||||
|
if file == null:
|
||||||
|
push_error("plugin error - null file: `%s`" % file_path)
|
||||||
|
return
|
||||||
|
var original_content = file.get_as_text()
|
||||||
|
var replaced_content = regex.sub(original_content, "", true)
|
||||||
|
replaced_content = replaced_content.replace(get_plugin_examples_path(), target_path)
|
||||||
|
file.close()
|
||||||
|
if replaced_content == original_content: return
|
||||||
|
file = FileAccess.open(file_path, FileAccess.WRITE)
|
||||||
|
file.store_string(replaced_content)
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
func _save_resource(resource_path : String, resource_destination : String, whitelisted_extensions : PackedStringArray = []) -> Error:
|
||||||
|
var extension : String = resource_path.get_extension()
|
||||||
|
if whitelisted_extensions.size() > 0:
|
||||||
|
if not extension in whitelisted_extensions:
|
||||||
|
return OK
|
||||||
|
if extension == "import":
|
||||||
|
# skip import files
|
||||||
|
return OK
|
||||||
|
var file_object = load(resource_path)
|
||||||
|
if file_object is Resource:
|
||||||
|
var possible_extensions = ResourceSaver.get_recognized_extensions(file_object)
|
||||||
|
if possible_extensions.has(extension):
|
||||||
|
return ResourceSaver.save(file_object, resource_destination, ResourceSaver.FLAG_CHANGE_PATH)
|
||||||
|
else:
|
||||||
|
return ERR_FILE_UNRECOGNIZED
|
||||||
|
else:
|
||||||
|
return ERR_FILE_UNRECOGNIZED
|
||||||
|
return OK
|
||||||
|
|
||||||
|
func _delayed_reimporting_file(file_path : String):
|
||||||
|
var timer: Timer = Timer.new()
|
||||||
|
var callable := func():
|
||||||
|
timer.stop()
|
||||||
|
var file_system = EditorInterface.get_resource_filesystem()
|
||||||
|
file_system.reimport_files([file_path])
|
||||||
|
timer.queue_free()
|
||||||
|
timer.timeout.connect(callable)
|
||||||
|
add_child(timer)
|
||||||
|
timer.start(REIMPORT_FILE_DELAY)
|
||||||
|
|
||||||
|
func _raw_copy_file_path(file_path : String, destination_path : String) -> Error:
|
||||||
|
var dir := DirAccess.open("res://")
|
||||||
|
var error := dir.copy(file_path, destination_path)
|
||||||
|
if not error:
|
||||||
|
EditorInterface.get_resource_filesystem().update_file(destination_path)
|
||||||
|
return error
|
||||||
|
|
||||||
|
func _copy_file_path(file_path : String, destination_path : String, target_path : String, raw_copy_file_extensions : PackedStringArray = []) -> Error:
|
||||||
|
if file_path.get_extension() in raw_copy_file_extensions:
|
||||||
|
# Markdown file format
|
||||||
|
return _raw_copy_file_path(file_path, destination_path)
|
||||||
|
var error = _save_resource(file_path, destination_path)
|
||||||
|
if error == ERR_FILE_UNRECOGNIZED:
|
||||||
|
# Copy image files and other assets
|
||||||
|
error = _raw_copy_file_path(file_path, destination_path)
|
||||||
|
# Reimport image files to create new .import
|
||||||
|
if not error:
|
||||||
|
_delayed_reimporting_file(destination_path)
|
||||||
|
return error
|
||||||
|
if not error:
|
||||||
|
_replace_file_contents(destination_path, target_path)
|
||||||
|
return error
|
||||||
|
|
||||||
|
func _copy_directory_path(dir_path : String, target_path : String, raw_copy_file_extensions : PackedStringArray = []):
|
||||||
|
if not dir_path.ends_with("/"):
|
||||||
|
dir_path += "/"
|
||||||
|
var dir = DirAccess.open(dir_path)
|
||||||
|
if dir:
|
||||||
|
dir.list_dir_begin()
|
||||||
|
var file_name = dir.get_next()
|
||||||
|
var error : Error
|
||||||
|
while file_name != "" and error == 0:
|
||||||
|
var relative_path = dir_path.trim_prefix(get_plugin_examples_path())
|
||||||
|
var destination_path = target_path + relative_path + file_name
|
||||||
|
var full_file_path = dir_path + file_name
|
||||||
|
if dir.current_is_dir():
|
||||||
|
if not dir.dir_exists(destination_path):
|
||||||
|
error = dir.make_dir(destination_path)
|
||||||
|
_copy_directory_path(full_file_path, target_path, raw_copy_file_extensions)
|
||||||
|
else:
|
||||||
|
error = _copy_file_path(full_file_path, destination_path, target_path, raw_copy_file_extensions)
|
||||||
|
file_name = dir.get_next()
|
||||||
|
if error:
|
||||||
|
push_error("plugin error - copying path: %s" % error)
|
||||||
|
else:
|
||||||
|
push_error("plugin error - accessing path: %s" % dir_path)
|
||||||
|
|
||||||
|
func _delayed_saving(target_path : String):
|
||||||
|
var timer: Timer = Timer.new()
|
||||||
|
var callable := func():
|
||||||
|
timer.stop()
|
||||||
|
EditorInterface.get_resource_filesystem().scan()
|
||||||
|
EditorInterface.save_all_scenes()
|
||||||
|
timer.queue_free()
|
||||||
|
timer.timeout.connect(callable)
|
||||||
|
add_child(timer)
|
||||||
|
timer.start(RESAVING_DELAY)
|
||||||
|
|
||||||
|
func _copy_to_directory(target_path : String):
|
||||||
|
ProjectSettings.set_setting(PROJECT_SETTINGS_PATH + "copy_path", target_path)
|
||||||
|
ProjectSettings.save()
|
||||||
|
if not target_path.ends_with("/"):
|
||||||
|
target_path += "/"
|
||||||
|
_copy_directory_path(get_plugin_examples_path(), target_path, ["md"])
|
||||||
|
_delayed_saving(target_path)
|
||||||
|
|
||||||
|
func _open_path_dialog():
|
||||||
|
var destination_scene : PackedScene = load(get_plugin_path() + "installer/DestinationDialog.tscn")
|
||||||
|
var destination_instance : FileDialog = destination_scene.instantiate()
|
||||||
|
destination_instance.dir_selected.connect(_copy_to_directory)
|
||||||
|
add_child(destination_instance)
|
||||||
|
|
||||||
|
func _open_confirmation_dialog():
|
||||||
|
var confirmation_scene : PackedScene = load(get_plugin_path() + "installer/CopyConfirmationDialog.tscn")
|
||||||
|
var confirmation_instance : ConfirmationDialog = confirmation_scene.instantiate()
|
||||||
|
confirmation_instance.confirmed.connect(_open_path_dialog)
|
||||||
|
add_child(confirmation_instance)
|
||||||
|
|
||||||
|
func _show_plugin_dialogues():
|
||||||
|
if ProjectSettings.has_setting(PROJECT_SETTINGS_PATH + "disable_plugin_dialogues") :
|
||||||
|
if ProjectSettings.get_setting(PROJECT_SETTINGS_PATH + "disable_plugin_dialogues") :
|
||||||
|
return
|
||||||
|
_open_confirmation_dialog()
|
||||||
|
ProjectSettings.set_setting(PROJECT_SETTINGS_PATH + "disable_plugin_dialogues", true)
|
||||||
|
ProjectSettings.save()
|
||||||
|
|
||||||
|
func _enter_tree():
|
||||||
|
add_tool_menu_item("Copy " + _get_plugin_name() + " Examples...", _open_path_dialog)
|
||||||
|
_show_plugin_dialogues()
|
||||||
|
|
||||||
|
func _exit_tree():
|
||||||
|
remove_tool_menu_item("Copy " + _get_plugin_name() + " Examples...",)
|
|
@ -1,21 +1,20 @@
|
||||||
extends CharacterBody2D
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
const MAX_SPEED: float = 300.0
|
||||||
const MAX_SPEED = 300.0
|
const ACCELERATION: int = 30
|
||||||
const ACCELERATION = 30
|
|
||||||
|
|
||||||
@export var nav: NavigationAgent2D
|
@export var nav: NavigationAgent2D
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
var movement: Vector2 = Vector2()
|
var movement: Vector2 = Vector2()
|
||||||
|
|
||||||
nav.target_position = get_global_mouse_position()
|
nav.target_position = get_global_mouse_position()
|
||||||
|
|
||||||
movement = nav.get_next_path_position() - global_position
|
movement = nav.get_next_path_position() - global_position
|
||||||
movement = movement.normalized() * ACCELERATION
|
movement = movement.normalized() * ACCELERATION
|
||||||
|
|
||||||
velocity += movement
|
velocity += movement
|
||||||
if velocity.length() > MAX_SPEED:
|
if velocity.length() > MAX_SPEED:
|
||||||
velocity = velocity.normalized() * MAX_SPEED
|
velocity = velocity.normalized() * MAX_SPEED
|
||||||
|
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
|
|
@ -11,6 +11,6 @@ config_version=5
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="pathfinding-algorithms"
|
config/name="pathfinding-algorithms"
|
||||||
run/main_scene="res://main.tscn"
|
run/main_scene="res://scenes/tilemap_nav.tscn"
|
||||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
[gd_scene load_steps=6 format=3 uid="uid://dau1xpov0ke0n"]
|
[gd_scene load_steps=6 format=3 uid="uid://dau1xpov0ke0n"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dy22higrwdqs6" path="res://scenes/wall.tscn" id="1_me3nh"]
|
[ext_resource type="PackedScene" uid="uid://dy22higrwdqs6" path="res://scenes/wall.tscn" id="1_thuyn"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c53ftc05so8rx" path="res://icon.svg" id="2_n113n"]
|
[ext_resource type="Script" path="res://character.gd" id="2_1xg74"]
|
||||||
[ext_resource type="Script" path="res://character.gd" id="2_yf8gw"]
|
[ext_resource type="Texture2D" uid="uid://c53ftc05so8rx" path="res://icon.svg" id="3_4ng2x"]
|
||||||
|
|
||||||
[sub_resource type="NavigationPolygon" id="NavigationPolygon_6menk"]
|
[sub_resource type="NavigationPolygon" id="NavigationPolygon_6menk"]
|
||||||
vertices = PackedVector2Array(771.227, 352.719, 859.359, 629.172, 10.9531, 639.867, 8.04688, 12.8594, 716.352, 232.773, 1102.45, 103.406, 1144.2, 472.531, 892.82, 355.148, 942.891, 552.5, 667.352, 67.3984)
|
vertices = PackedVector2Array(771.227, 352.719, 859.359, 629.172, 10.9531, 639.867, 8.04688, 12.8594, 716.352, 232.773, 1102.45, 103.406, 1144.2, 472.531, 892.82, 355.148, 942.891, 552.5, 667.352, 67.3984)
|
||||||
|
@ -19,18 +19,18 @@ navigation_polygon = SubResource("NavigationPolygon_6menk")
|
||||||
|
|
||||||
[node name="walls" type="Node2D" parent="."]
|
[node name="walls" type="Node2D" parent="."]
|
||||||
|
|
||||||
[node name="Wall1" parent="walls" instance=ExtResource("1_me3nh")]
|
[node name="Wall1" parent="walls" instance=ExtResource("1_thuyn")]
|
||||||
position = Vector2(348, 498)
|
position = Vector2(348, 498)
|
||||||
scale = Vector2(20, 1)
|
scale = Vector2(20, 1)
|
||||||
|
|
||||||
[node name="Wall2" parent="walls" instance=ExtResource("1_me3nh")]
|
[node name="Wall2" parent="walls" instance=ExtResource("1_thuyn")]
|
||||||
position = Vector2(174, 253)
|
position = Vector2(174, 253)
|
||||||
scale = Vector2(10, 1)
|
scale = Vector2(10, 1)
|
||||||
|
|
||||||
[node name="CharacterBody2D" type="CharacterBody2D" parent="." node_paths=PackedStringArray("nav")]
|
[node name="CharacterBody2D" type="CharacterBody2D" parent="." node_paths=PackedStringArray("nav")]
|
||||||
position = Vector2(486, 349)
|
position = Vector2(486, 349)
|
||||||
collision_mask = 3
|
collision_mask = 3
|
||||||
script = ExtResource("2_yf8gw")
|
script = ExtResource("2_1xg74")
|
||||||
nav = NodePath("NavigationAgent2D")
|
nav = NodePath("NavigationAgent2D")
|
||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ debug_enabled = true
|
||||||
|
|
||||||
[node name="Icon" type="Sprite2D" parent="CharacterBody2D"]
|
[node name="Icon" type="Sprite2D" parent="CharacterBody2D"]
|
||||||
scale = Vector2(0.4, 0.4)
|
scale = Vector2(0.4, 0.4)
|
||||||
texture = ExtResource("2_n113n")
|
texture = ExtResource("3_4ng2x")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
|
||||||
shape = SubResource("RectangleShape2D_axamc")
|
shape = SubResource("RectangleShape2D_axamc")
|
|
@ -0,0 +1,45 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
var physics_tilemap = $Fence
|
||||||
|
var navigation_tilemap = $Grass
|
||||||
|
var tile_set = physics_tilemap.tile_set
|
||||||
|
if not tile_set:
|
||||||
|
print("Failed to find tile_set on physics_tilemap")
|
||||||
|
return
|
||||||
|
|
||||||
|
var tile_size = tile_set.get_tile_size()
|
||||||
|
var used_rect = physics_tilemap.get_used_rect()
|
||||||
|
print(used_rect)
|
||||||
|
|
||||||
|
for x in range(used_rect.position.x, used_rect.size.x):
|
||||||
|
for y in range(used_rect.position.y, used_rect.size.y):
|
||||||
|
var tile_id = physics_tilemap.get_cell(x, y)
|
||||||
|
if tile_id == -1:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Get the collision shapes for the current tile
|
||||||
|
var collision_shapes = tile_set.tile_get_shapes(tile_id)
|
||||||
|
if not collision_shapes:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Convert collision shapes into NavigationPolygon cut-outs
|
||||||
|
for shape in collision_shapes:
|
||||||
|
if shape.shape.is_class("RectangleShape2D"): # assuming rectangle shapes for simplicity
|
||||||
|
var rect = Rect2(
|
||||||
|
Vector2(x, y) * tile_size,
|
||||||
|
Vector2(shape.shape.extents) * 2
|
||||||
|
)
|
||||||
|
cut_navigation_polygon(navigation_tilemap, rect)
|
||||||
|
# Expand this if-else for other shapes like CircleShape2D, etc.
|
||||||
|
|
||||||
|
func cut_navigation_polygon(navigation_tilemap: TileMapLayer, rect: Rect2):
|
||||||
|
for nav_polygon in navigation_tilemap.get_children():
|
||||||
|
if nav_polygon.is_class("NavigationPolygonInstance"):
|
||||||
|
# This is a crude example - in practice, create new polygons to adjust the navigation mesh
|
||||||
|
var nav_rect = nav_polygon.get_item_rect()
|
||||||
|
if nav_rect.intersects(rect):
|
||||||
|
# Here, define logic to cut rect from nav_rect, adjusting navigation mesh
|
||||||
|
# Example: Remove affected navigation polygon and recreate it around `rect`
|
||||||
|
nav_polygon.remove() # remove or edit as per your exact cutout needs
|
||||||
|
# Note: Fine-tuning would involve more detailed polygon edits or re-creation.
|