forked from unknown-horizons/godot-port
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move code to create trees from TileMap in TreesLayer
- Loading branch information
theludovyc
committed
Nov 26, 2024
1 parent
67c1e85
commit b9c7a24
Showing
3 changed files
with
20 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
extends TileMapLayer | ||
|
||
@onready var tileMap := get_parent() | ||
|
||
func create_trees(): | ||
var noise := FastNoiseLite.new() | ||
noise.frequency = 0.3 | ||
|
||
for i in range(tileMap.minimap.size()): | ||
if tileMap.minimap[i] == MyTileMap.Minimap_Cell_Type.Ground: | ||
var pos = tileMap.minimap_get_pos(i) | ||
|
||
if noise.get_noise_2dv(pos) > 0.1: | ||
set_cell(pos, 1, Vector2(0, 1)) | ||
|
||
tileMap.minimap[i] = MyTileMap.Minimap_Cell_Type.Tree |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters