try to reduce load times
This commit is contained in:
parent
c54ccb4d4f
commit
457de8dcaa
8 changed files with 66 additions and 7 deletions
Binary file not shown.
|
|
@ -1,12 +1,19 @@
|
|||
extends Node
|
||||
|
||||
@export var shatter_scenes: Array[PackedScene]
|
||||
@export var building_meshes: Array[PackedScene]
|
||||
@export var building_scales: PackedVector3Array
|
||||
|
||||
var shatter_scene: PackedScene
|
||||
|
||||
func _ready() -> void:
|
||||
var idx := randi_range(0, %Shaker.get_child_count() - 1)
|
||||
for child in %Shaker.get_children():
|
||||
child.visible = child.get_index() == idx
|
||||
var idx := randi_range(0, building_meshes.size() - 1)
|
||||
# for child in %Shaker.get_children():
|
||||
# child.visible = child.get_index() == idx
|
||||
|
||||
var building_mesh: Node3D = building_meshes[idx].instantiate()
|
||||
building_mesh.scale = building_scales[idx]
|
||||
%Shaker.add_child(building_mesh)
|
||||
shatter_scene = shatter_scenes[idx]
|
||||
|
||||
func _on_building_destroyed_from(global_pos: Vector3) -> void:
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@ collision_mask = 2
|
|||
[node name="Siren" type="AudioStreamPlayer3D" parent="." unique_id=2085366724]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("2_bfj6p")
|
||||
attenuation_model = 2
|
||||
unit_size = 12.0
|
||||
unit_size = 15.0
|
||||
autoplay = true
|
||||
max_distance = 50.0
|
||||
bus = &"Police Siren"
|
||||
|
|
|
|||
14
loading_screen.gd
Normal file
14
loading_screen.gd
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
extends Control
|
||||
|
||||
const SCENE_PATH := "res://levels/level_0.tscn"
|
||||
|
||||
func _ready() -> void:
|
||||
assert(ResourceLoader.load_threaded_request(SCENE_PATH, "", true) == OK)
|
||||
# await get_tree().process_frame
|
||||
# ResourceLoader.load_threaded_get("res://levels/level_0.tscn")
|
||||
# get_tree().change_scene_to_file("res://ui/title_screen/title_screen.tscn")
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if ResourceLoader.load_threaded_get_status(SCENE_PATH) == ResourceLoader.THREAD_LOAD_LOADED:
|
||||
print("changing scene")
|
||||
get_tree().change_scene_to_file("res://ui/title_screen/title_screen.tscn")
|
||||
1
loading_screen.gd.uid
Normal file
1
loading_screen.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c0a6hljyyj5ry
|
||||
38
loading_screen.tscn
Normal file
38
loading_screen.tscn
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
[gd_scene format=3 uid="uid://ct4qxncertpx6"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c0a6hljyyj5ry" path="res://loading_screen.gd" id="1_mggpi"]
|
||||
|
||||
[sub_resource type="FontVariation" id="FontVariation_n71f6"]
|
||||
variation_transform = Transform2D(1.01, -0.32, 0.55, 1.045, 0, 1.83)
|
||||
spacing_glyph = 13
|
||||
|
||||
[node name="LoadingScreen" type="Control" unique_id=1185076605]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_mggpi")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." unique_id=873491002]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=1034363801]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_fonts/font = SubResource("FontVariation_n71f6")
|
||||
theme_override_font_sizes/font_size = 98
|
||||
text = "Loading"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
|
@ -338,7 +338,7 @@ bus = &"SFX"
|
|||
[node name="EngineSFX" type="AudioStreamPlayer" parent="." unique_id=668897298]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("15_wodsf")
|
||||
volume_db = -6.0
|
||||
volume_db = -8.0
|
||||
bus = &"SFX"
|
||||
|
||||
[editable path="Tank"]
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ config_version=5
|
|||
[application]
|
||||
|
||||
config/name="Road Rage Tank"
|
||||
run/main_scene="uid://c04ppsrjrkxb6"
|
||||
run/main_scene="uid://ct4qxncertpx6"
|
||||
config/features=PackedStringArray("4.6")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue