@@ -4,13 +4,25 @@ extends Control
44var path : String
55var is_loading : bool
66
7- func _process (delta ):
7+ @export var tips : Array = [
8+ "Press shift to sprint" ,
9+ "Scroll your mousewheel to zoom" ,
10+ "Press spacebar to jump" ,
11+ "Add more tips to the tips array in loading.gd" ]
12+
13+ func _process (_delta ):
814 if is_loading :
915 var progress : Array = []
1016 var status = ResourceLoader .load_threaded_get_status (path , progress )
1117 if status == ResourceLoader .THREAD_LOAD_IN_PROGRESS :
12- get_node ("ProgressBar" ).value = progress [0 ] * 100
13- print ("status: " + str (progress [0 ] * 100 ))
18+
19+ # this should work in godot 4.1
20+ # get_node("ProgressBar").value = progress[0] * 100
21+
22+ # temporary workaround until fixed
23+ get_node ("ProgressBar" ).value += 1
24+
25+ print ("progress: " + str (progress [0 ] * 100 ))
1426 print ("this should work in godot 4.1: https://github.com/godotengine/godot/pull/75644" )
1527 elif status == ResourceLoader .THREAD_LOAD_LOADED :
1628 set_process (false )
@@ -27,9 +39,16 @@ func change_map(resource: PackedScene):
2739 queue_free ()
2840
2941
30- func load_map (path : String ):
31- self . path = path
42+ func load_map (res_path : String ):
43+ path = res_path
3244 show ()
45+ if tips != null and ! tips .is_empty ():
46+ $ Control/VBoxContainer2/tip .text = tips [randi () % tips .size ()]
47+
48+ var level_name_parts : Array = path .split ("/" )
49+ var level_name_without_extension = level_name_parts [- 1 ].split ("." )[0 ]
50+ $ Control/VBoxContainer/map_name .text = level_name_without_extension
51+
3352 if ResourceLoader .has_cached (path ):
3453 ResourceLoader .load_threaded_get (path )
3554 else :
0 commit comments