[gd_scene load_steps=17 format=1]

[ext_resource path="res://scenes/base.tscn" type="PackedScene" id=1]
[ext_resource path="res://sprites/background.png" type="Texture" id=2]
[ext_resource path="res://scenes/spawner_asteroids.tscn" type="PackedScene" id=3]
[ext_resource path="res://sprites/under.png" type="Texture" id=4]
[ext_resource path="res://sprites/over.png" type="Texture" id=5]
[ext_resource path="res://sprites/progress.png" type="Texture" id=6]
[ext_resource path="res://sprites/try_again.png" type="Texture" id=7]
[ext_resource path="res://animations/btn_in.tres" type="Animation" id=8]
[ext_resource path="res://samplelibrary.tres" type="SampleLibrary" id=9]
[ext_resource path="res://sprites/start_button.png" type="Texture" id=10]

[sub_resource type="GDScript" id=1]

script/source = "extends Label

export var template_str = \"%s %s\"
func update_text(stage, asteroids, health):
	var new_text = template_str % [stage, asteroids, health]
	set_text(new_text)
	
"

[sub_resource type="Theme" id=2]


[sub_resource type="GDScript" id=3]

script/source = "extends TextureProgress

# class member variables go here, for example:
# var a = 2
# var b = \"textvar\"
func set_max_val(max_val):
	set_max(max_val)
	
func update_value(val):
	if val > 0:
		if not is_visible(): show()
		set_value(val)
	else:
		hide()
"

[sub_resource type="GDScript" id=4]

script/source = "extends TextureButton
func _ready():
	connect(\"button_down\", self, \"restart\")
	game_manager.update_ui()
	connect(\"visibility_changed\", self, \"on_visibility_changed\")

func on_visibility_changed():
	randomize()
	print(\"WE ARE NOW VISIBLE? %s\" % is_visible())
	if is_visible():
		get_node(\"Audio\").play(\"loose_%s\" % ceil(rand_range(0.1,4)))
	
func restart():
	game_manager.reset()"

[sub_resource type="Animation" id=5]

resource/name = "default"
length = 1.0
loop = false
step = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath(".:rect/pos")
tracks/0/interp = 1
tracks/0/imported = false
tracks/0/keys = {
"times": FloatArray( 0 ),
"transitions": FloatArray( 1 ),
"update": 0,
"values": [ Vector2( 83, 54 ) ]
}

[sub_resource type="GDScript" id=6]

script/source = "extends TextureButton

func _ready():
	if not game_manager.state == game_manager.STATE_STARTUP: on_button_clicked()
	connect(\"button_down\", self, \"on_button_clicked\")
	var anim_player = get_node(\"AnimationPlayer\")
	anim_player.connect(\"finished\", self, \"anim_finished\")
	anim_player.play(\"anim_in\")
	
func anim_finished():
	print(\"SETTING QTIME SACALE\")
	OS.set_time_scale(0)
	
func _input(event):
	if(event.is_action_pressed(\"Coin\")):
		OS.set_time_scale(1)
		hide()
"

[node name="Node" type="Node"]

[node name="Base" parent="." instance=ExtResource( 1 )]

transform/pos = Vector2( 211, 240 )

[node name="Background" type="CanvasLayer" parent="."]

layer = -2
offset = Vector2( 0, 0 )
rotation = 0.0
scale = Vector2( 1, 1 )

[node name="Sprite" type="Sprite" parent="Background"]

transform/pos = Vector2( 0, -32.4442 )
transform/scale = Vector2( 0.401467, 0.376672 )
texture = ExtResource( 2 )
centered = false

[node name="Spawner Asteroids" parent="." instance=ExtResource( 3 )]

[node name="UI" type="CanvasLayer" parent="."]

layer = 1
offset = Vector2( 0, 0 )
rotation = 0.0
scale = Vector2( 1, 1 )

[node name="ScoreLabel" type="Label" parent="UI"]

focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 0
margin/left = 10.0
margin/top = 10.0
margin/right = 411.0
margin/bottom = 40.0
valign = 1
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
script/script = SubResource( 1 )
template_str = "Stage: %s Asteroids: %s Health: %s"

[node name="SlowmoBar" type="TextureProgress" parent="UI"]

visibility/visible = false
rect/scale = Vector2( 0.25, 0.25 )
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
size_flags/stretch_ratio = 2.0
theme/theme = SubResource( 2 )
margin/left = 357.0
margin/top = 21.0
margin/right = 485.0
margin/bottom = 149.0
range/min = 0.0
range/max = 100.0
range/step = 1.0
range/page = 0.0
range/value = 0.0
range/exp_edit = false
range/rounded = false
texture/under = ExtResource( 4 )
texture/over = ExtResource( 5 )
texture/progress = ExtResource( 6 )
mode = 4
radial_fill/fill_degrees = 360.0
radial_fill/center_offset = Vector2( -1, 8 )
script/script = SubResource( 3 )

[node name="Restart" type="TextureButton" parent="UI"]

visibility/visible = false
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 83.0
margin/top = 54.0
margin/right = 339.0
margin/bottom = 183.0
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
textures/normal = ExtResource( 7 )
params/resize_mode = 0
params/stretch_mode = 0
script/script = SubResource( 4 )

[node name="AnimationPlayer" type="AnimationPlayer" parent="UI/Restart"]

playback/process_mode = 1
playback/default_blend_time = 0.0
root/root = NodePath("..")
anims/anim_in = ExtResource( 8 )
anims/default = SubResource( 5 )
playback/active = true
playback/speed = 1.0
blend_times = [  ]
autoplay = ""

[node name="Audio" type="SamplePlayer2D" parent="UI/Restart"]

params/volume_db = 0.0
params/pitch_scale = 1.0
params/attenuation/min_distance = 1.0
params/attenuation/max_distance = 2048.0
params/attenuation/distance_exp = 1.0
config/polyphony = 1
config/samples = ExtResource( 9 )
config/pitch_random = 0.0

[node name="Start" type="TextureButton" parent="UI"]

focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 83.0
margin/top = 54.0
margin/right = 339.0
margin/bottom = 182.0
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
textures/normal = ExtResource( 10 )
params/resize_mode = 0
params/stretch_mode = 0
script/script = SubResource( 6 )

[node name="Label" type="Label" parent="UI/Start"]

focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 0
margin/left = 33.0
margin/top = 142.0
margin/right = 233.0
margin/bottom = 156.0
custom_colors/font_color = Color( 1, 0.533081, 0.121094, 1 )
text = "PRO TIP: Tap and drag to aim!!!!"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1

[node name="AnimationPlayer" type="AnimationPlayer" parent="UI/Start"]

playback/process_mode = 1
playback/default_blend_time = 0.0
root/root = NodePath("..")
anims/anim_in = ExtResource( 8 )
anims/default = SubResource( 5 )
playback/active = true
playback/speed = 1.0
blend_times = [  ]
autoplay = ""

[node name="WorldAudio" type="SamplePlayer2D" parent="."]

params/volume_db = 0.0
params/pitch_scale = 1.0
params/attenuation/min_distance = 1.0
params/attenuation/max_distance = 2048.0
params/attenuation/distance_exp = 1.0
config/polyphony = 10
config/samples = ExtResource( 9 )
config/pitch_random = 0.0


