Browse Source

:truck: Move border walls into a dedicated scene

DricomDragon 3 years ago
parent
commit
f3e71752a1
2 changed files with 30 additions and 26 deletions
  1. 27 0
      godot/component/entity/border/Border.tscn
  2. 3 26
      godot/main.tscn

+ 27 - 0
godot/component/entity/border/Border.tscn

@@ -0,0 +1,27 @@
+[gd_scene load_steps=4 format=2]
+
+[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 )
+
+[node name="Walls" type="StaticBody2D"]
+collision_layer = 2
+physics_material_override = SubResource( 1 )
+
+[node name="Left" type="CollisionShape2D" parent="."]
+position = Vector2( -50, 200 )
+shape = SubResource( 2 )
+
+[node name="Right" type="CollisionShape2D" parent="."]
+position = Vector2( 450, 200 )
+shape = SubResource( 2 )
+
+[node name="Top" type="CollisionShape2D" parent="."]
+position = Vector2( 200, -50 )
+shape = SubResource( 3 )

+ 3 - 26
godot/main.tscn

@@ -1,4 +1,4 @@
-[gd_scene load_steps=17 format=2]
+[gd_scene load_steps=15 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]
@@ -12,16 +12,7 @@
 [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 )
+[ext_resource path="res://component/entity/border/Border.tscn" type="PackedScene" id=13]
 
 [sub_resource type="RectangleShape2D" id=4]
 extents = Vector2( 200, 50 )
@@ -35,21 +26,7 @@ __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="Border" parent="." instance=ExtResource( 13 )]
 
 [node name="Catcher" type="Area2D" parent="."]
 position = Vector2( 200, 460 )