diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2025-03-10 18:22:09 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2025-03-10 18:22:09 +0100 |
commit | 440020e642f539079867577435a9f8b02075699b (patch) | |
tree | 99acccfc1574a8ffc656d6f64ff934949edb1f52 /map/map.gd |
Diffstat (limited to 'map/map.gd')
-rw-r--r-- | map/map.gd | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/map/map.gd b/map/map.gd new file mode 100644 index 0000000..dfc2e51 --- /dev/null +++ b/map/map.gd @@ -0,0 +1,27 @@ +class_name Map +extends Node2D + + +@export var is_indoor := false + +@onready var player: Player = Game.world.player + + +func _ready() -> void: + if is_indoor: + Game.set_indoor() + else: + Game.set_outdoor() + + #if not has_node("Player"): + #add_child(load("res://player/player.tscn").instantiate()) + + var current_map_entry = get_node_or_null(NodePath(Game.current_map_entry)) + if current_map_entry: + player.global_position = current_map_entry.global_position + + if Game.current_direction: + player.current_direction = Game.current_direction + + # re-set state to trigger enter again after setting position and direction + player.current_state = player.current_state |