End of chapter 4, World map scripts.

This commit is contained in:
Penelope 2025-04-05 16:36:08 -03:00
parent fc038ba113
commit d6ef6289ea
6 changed files with 39 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,27 @@
extends TileMap
class_name Map2d
enum TerrainDataTypes { TerrainType }
func getTerrainDataForTile(layer, data, x, y):
var tile: TileData = get_cell_tile_data(layer, Vector2i(x, y))
if tile != null:
return tile.get_custom_data(TerrainDataTypes.keys()[data])
else:
return null
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
print(getTerrainDataForTile(0, TerrainDataTypes.TerrainType, 39, 17))
print(getTerrainDataForTile(0, TerrainDataTypes.TerrainType, 0, 0))
print(getTerrainDataForTile(0, TerrainDataTypes.TerrainType, 11, 11))
print(getTerrainDataForTile(0, TerrainDataTypes.TerrainType, 6, 9))
print(getTerrainDataForTile(0, TerrainDataTypes.TerrainType, 22, 22))
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View File

@ -0,0 +1 @@
uid://cri7fu2duxk0j

View File

@ -0,0 +1,6 @@
extends Map2d
func _ready() -> void:
super._ready()

View File

@ -0,0 +1 @@
uid://bbrwrbwsxt32g

View File

@ -11,7 +11,7 @@ func loadScene(caller: Node, path: String):
get_tree().root.add_child(loadingScene)
ResourceLoader.load_threaded_request(scenePath)
print(scenePath)
#print(scenePath)
caller.queue_free()