diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-10-27 15:52:48 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-10-27 15:52:48 +0100 |
commit | 15a1d2a66e48324e1d560dc13b776627820f3999 (patch) | |
tree | 4c062545a4c1a750293b52d5c11258f9b4218a2a /UI/lobby.gd | |
parent | a495681453c97578cc4a408d6919c6879524a603 (diff) |
next commit
Diffstat (limited to 'UI/lobby.gd')
-rw-r--r-- | UI/lobby.gd | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/UI/lobby.gd b/UI/lobby.gd index f849d81..1cb4d5c 100644 --- a/UI/lobby.gd +++ b/UI/lobby.gd @@ -3,7 +3,7 @@ extends Control signal joined -var current_map_idx := 0 +var current_map_idx := 2 @onready var list: VBoxContainer = %PlayersList @@ -35,6 +35,10 @@ func _ready() -> void: update_players() multiplayer.peer_disconnected.connect(remove_player) + + # reset map texture for clean load + %Thumbnail.texture = null + set_map(current_map_idx) func update_players(): @@ -74,7 +78,8 @@ func _on_cancel_button_pressed() -> void: @rpc("authority", "call_local") func start(): - get_tree().change_scene_to_file("res://Stages/Wintermaul/Wintermaul.tscn") + var scene = %Maps.get_child(current_map_idx).get_meta("map_scene") + get_tree().change_scene_to_packed(scene) @rpc("authority", "call_local") @@ -82,4 +87,8 @@ func set_map(index: int): for node: Button in %Maps.get_children(): node.add_theme_color_override("font_color", Color(1.0, 1.0, 1.0, 0.5)) - %Maps.get_child(index).add_theme_color_override("font_color", Color(1.0, 1.0, 1.0, 1.0)) + var node = %Maps.get_child(index) + var thumbnail = node.get_meta("thumbnail") + + node.add_theme_color_override("font_color", Color(1.0, 1.0, 1.0, 1.0)) + %Thumbnail.texture = thumbnail |