[gd_scene load_steps=17 format=2]

[ext_resource path="res://component/ui/message_panel/MessagePanel.tscn" type="PackedScene" id=1]
[ext_resource path="res://component/entity/launcher/TargetLine.gd" type="Script" id=2]
[ext_resource path="res://component/entity/catcher/Catcher.gd" type="Script" id=3]
[ext_resource path="res://component/ui/LifeContainer.gd" type="Script" id=4]
[ext_resource path="res://component/ui/UI.gd" type="Script" id=5]
[ext_resource path="res://component/ui/number_panel/NumberPanel.tscn" type="PackedScene" id=6]
[ext_resource path="res://component/entity/death/DeadLine.gd" type="Script" id=7]
[ext_resource path="res://component/entity/launcher/Launcher.gd" type="Script" id=8]
[ext_resource path="res://component/entity/brick/brick_tileset.tres" type="TileSet" id=9]
[ext_resource path="res://component/entity/launcher/visor.png" type="Texture" id=10]
[ext_resource path="res://component/entity/launcher/launcher.png" type="Texture" id=11]
[ext_resource path="res://component/entity/brick/Grid.gd" type="Script" id=12]

[sub_resource type="PhysicsMaterial" id=1]
friction = 0.0
bounce = 1.0

[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 50, 300 )

[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 300, 50 )

[sub_resource type="RectangleShape2D" id=4]
extents = Vector2( 200, 50 )

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

[node name="Background" type="Panel" parent="."]
margin_right = 400.0
margin_bottom = 400.0
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Walls" type="StaticBody2D" parent="."]
collision_layer = 2
physics_material_override = SubResource( 1 )

[node name="Left" type="CollisionShape2D" parent="Walls"]
position = Vector2( -50, 200 )
shape = SubResource( 2 )

[node name="Right" type="CollisionShape2D" parent="Walls"]
position = Vector2( 450, 200 )
shape = SubResource( 2 )

[node name="Top" type="CollisionShape2D" parent="Walls"]
position = Vector2( 200, -50 )
shape = SubResource( 3 )

[node name="Catcher" type="Area2D" parent="."]
position = Vector2( 200, 460 )
collision_layer = 8
collision_mask = 5
script = ExtResource( 3 )

[node name="Area" type="CollisionShape2D" parent="Catcher"]
shape = SubResource( 4 )

[node name="Launcher" type="Node2D" parent="."]
script = ExtResource( 8 )
visor_ratio = 1.6

[node name="Grid" type="TileMap" parent="Launcher" groups=[
"grid",
]]
mode = 2
tile_set = ExtResource( 9 )
cell_size = Vector2( 40, 20 )
cell_custom_transform = Transform2D( 40, 0, 0, 20, 0, 0 )
collision_layer = 4
collision_mask = 8
format = 1
script = ExtResource( 12 )

[node name="LifeContainer" type="Node2D" parent="Launcher/Grid"]
script = ExtResource( 4 )

[node name="MoveDown" type="Tween" parent="Launcher/Grid"]
__meta__ = {
"_editor_description_": "Move grid to show the new row"
}

[node name="TargetLine" type="RayCast2D" parent="Launcher"]
position = Vector2( 200, 400 )
collision_mask = 6
script = ExtResource( 2 )

[node name="TargetVisor" type="Sprite" parent="Launcher/TargetLine"]
texture = ExtResource( 10 )

[node name="Source" type="Sprite" parent="Launcher"]
position = Vector2( 200, 400 )
texture = ExtResource( 11 )

[node name="ShootDelay" type="Timer" parent="Launcher"]
wait_time = 0.1
one_shot = true

[node name="DeadLine" type="RayCast2D" parent="Launcher"]
position = Vector2( 380, 390 )
cast_to = Vector2( -360, 0 )
collision_mask = 4
script = ExtResource( 7 )

[node name="UI" type="Control" parent="."]
margin_right = 40.0
margin_bottom = 40.0
script = ExtResource( 5 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="GameOverPanel" parent="UI" instance=ExtResource( 1 )]
visible = false
message = "Game Over!"

[node name="TutorialPanel" parent="UI" instance=ExtResource( 1 )]
message = "Click to shoot a ball!"

[node name="ScoreCounter" parent="UI" instance=ExtResource( 6 )]
margin_left = 350.0
margin_top = 360.0
margin_right = 390.0
margin_bottom = 390.0
title = "Score"

[node name="BallCounter" parent="UI" instance=ExtResource( 6 )]
margin_left = 10.0
margin_top = 360.0
margin_right = 50.0
margin_bottom = 390.0
title = "Balls"
[connection signal="ready" from="." to="UI/BallCounter" method="increase_counter"]
[connection signal="body_entered" from="Catcher" to="Catcher" method="_on_Catcher_body_entered"]
[connection signal="game_over" from="Catcher" to="UI" method="_on_Catcher_game_over"]
[connection signal="gain_new_bullet" from="Launcher" to="UI/BallCounter" method="increase_counter"]
[connection signal="get_firing" from="Launcher" to="UI" method="_on_Launcher_get_firing"]
[connection signal="get_firing" from="Launcher" to="Launcher" method="_on_Launcher_get_firing"]
[connection signal="is_full" from="Launcher" to="Launcher/Grid" method="_on_Launcher_is_full"]
[connection signal="move_visor" from="Launcher" to="Launcher/TargetLine" method="_on_Launcher_move_visor"]
[connection signal="has_moved" from="Launcher/Grid" to="Launcher" method="_on_Grid_has_moved"]
[connection signal="has_moved" from="Launcher/Grid" to="Launcher/DeadLine" method="_on_Grid_has_moved"]
[connection signal="kace_broken" from="Launcher/Grid" to="Launcher" method="_on_Grid_kace_broken"]
[connection signal="kace_damaged" from="Launcher/Grid" to="UI/ScoreCounter" method="increase_counter"]
[connection signal="tween_all_completed" from="Launcher/Grid/MoveDown" to="Launcher/Grid" method="_on_MoveDown_tween_all_completed"]
[connection signal="timeout" from="Launcher/ShootDelay" to="Launcher" method="_on_ShootDelay_timeout"]
[connection signal="game_lost" from="Launcher/DeadLine" to="UI" method="_on_DeadLine_game_lost"]
[connection signal="game_lost" from="Launcher/DeadLine" to="Launcher" method="_on_DeadLine_game_lost"]