Ver código fonte

Group game over panel in UI

DricomDragon 3 anos atrás
pai
commit
a03e4fba92
2 arquivos alterados com 11 adições e 8 exclusões
  1. 9 7
      godot/scenes/main.tscn
  2. 2 1
      godot/scripts/UI.gd

+ 9 - 7
godot/scenes/main.tscn

@@ -21,7 +21,7 @@ extents = Vector2( 300, 50 )
 [sub_resource type="RectangleShape2D" id=4]
 extents = Vector2( 200, 50 )
 
-[sub_resource type="RectangleShape2D" id=7]
+[sub_resource type="RectangleShape2D" id=5]
 extents = Vector2( 20.5, 10.5 )
 
 [sub_resource type="TileSet" id=6]
@@ -37,7 +37,7 @@ extents = Vector2( 20.5, 10.5 )
 "autotile_coord": Vector2( 0, 0 ),
 "one_way": false,
 "one_way_margin": 1.0,
-"shape": SubResource( 7 ),
+"shape": SubResource( 5 ),
 "shape_transform": Transform2D( 1, 0, 0, 1, 20, 10 )
 } ]
 0/z_index = 0
@@ -104,7 +104,6 @@ wait_time = 0.1
 one_shot = true
 
 [node name="UI" type="Control" parent="."]
-visible = false
 margin_right = 40.0
 margin_bottom = 40.0
 script = ExtResource( 7 )
@@ -112,7 +111,8 @@ __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="Panel" type="Panel" parent="UI"]
+[node name="GameOverPanel" type="Panel" parent="UI"]
+visible = false
 margin_left = 100.0
 margin_top = 175.0
 margin_right = 300.0
@@ -121,9 +121,11 @@ __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="GameOver" type="Label" parent="UI"]
-margin_right = 400.0
-margin_bottom = 400.0
+[node name="GameOver" type="Label" parent="UI/GameOverPanel"]
+margin_left = -100.0
+margin_top = -175.0
+margin_right = 300.0
+margin_bottom = 225.0
 text = "Game Over"
 align = 1
 valign = 1

+ 2 - 1
godot/scripts/UI.gd

@@ -1,5 +1,6 @@
 extends Control
 
+onready var game_over_panel = $GameOverPanel
 
 func _on_Catcher_game_over():
-	show()
+	game_over_panel.show()