From 440020e642f539079867577435a9f8b02075699b Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Mon, 10 Mar 2025 18:22:09 +0100 Subject: initial commit --- map/map.gd | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 map/map.gd (limited to 'map/map.gd') 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 -- cgit v1.2.3