From bfab4399957d9d08893fccec8a52ecb40d94866f Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Wed, 1 Feb 2023 21:26:30 -0500 Subject: [PATCH] Re-organize HUD scene to remove redundant control node --- maps/abyss.tscn | 36 ++++++++++++++++++++ maps/canopy.tscn | 2 +- maps/cave.tscn | 2 +- objects/hud/hud.gd | 2 +- objects/hud/hud.tscn | 78 +++++++++++++++++++++----------------------- 5 files changed, 76 insertions(+), 44 deletions(-) create mode 100644 maps/abyss.tscn diff --git a/maps/abyss.tscn b/maps/abyss.tscn new file mode 100644 index 0000000..d8dfddc --- /dev/null +++ b/maps/abyss.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://maps/map.gd" type="Script" id=1] +[ext_resource path="res://objects/hud/hud.tscn" type="PackedScene" id=2] +[ext_resource path="res://graphics/backgrounds/abyss.png" type="Texture" id=3] +[ext_resource path="res://scripts/water_ripple.gdshader" type="Shader" id=4] +[ext_resource path="res://audio/music/moon_trail.ogg" type="AudioStream" id=5] + +[sub_resource type="ShaderMaterial" id=1] +shader = ExtResource( 4 ) +shader_param/offset = 1.5 +shader_param/speed = 0.5 +shader_param/waves = 2.0 + +[node name="Map" type="Node2D" groups=["map"]] +script = ExtResource( 1 ) +target_time_any = 60 +target_time_100 = 120 +music = ExtResource( 5 ) + +[node name="BackgroundLayer" type="CanvasLayer" parent="."] +layer = -50 + +[node name="Sprite" type="Sprite" parent="BackgroundLayer"] +texture = ExtResource( 3 ) +centered = false + +[node name="WaterEffect" type="CanvasLayer" parent="."] +layer = 50 + +[node name="ColorRect" type="ColorRect" parent="WaterEffect"] +material = SubResource( 1 ) +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="HUD" parent="." instance=ExtResource( 2 )] diff --git a/maps/canopy.tscn b/maps/canopy.tscn index bb7e865..d5ed29c 100644 --- a/maps/canopy.tscn +++ b/maps/canopy.tscn @@ -509,7 +509,7 @@ color = 3 position = Vector2( 496, 16 ) color = 4 -[node name="CanvasLayer" parent="." instance=ExtResource( 7 )] +[node name="HUD" parent="." instance=ExtResource( 7 )] [node name="ColorRect" type="ColorRect" parent="."] margin_left = 256.0 diff --git a/maps/cave.tscn b/maps/cave.tscn index 4086676..0638429 100644 --- a/maps/cave.tscn +++ b/maps/cave.tscn @@ -45,7 +45,7 @@ __meta__ = { "_edit_lock_": true } -[node name="CanvasLayer" parent="." instance=ExtResource( 4 )] +[node name="HUD" parent="." instance=ExtResource( 4 )] [node name="Ground" type="TileMap" parent="."] tile_set = ExtResource( 2 ) diff --git a/objects/hud/hud.gd b/objects/hud/hud.gd index 6dc1b2b..64ea1d0 100644 --- a/objects/hud/hud.gd +++ b/objects/hud/hud.gd @@ -1,4 +1,4 @@ -extends Control +extends CanvasLayer onready var gold_counter = $GoldCounter onready var shard_counter = $ShardCounter diff --git a/objects/hud/hud.tscn b/objects/hud/hud.tscn index 302d0a6..65b0f95 100644 --- a/objects/hud/hud.tscn +++ b/objects/hud/hud.tscn @@ -9,118 +9,114 @@ [sub_resource type="ShaderMaterial" id=2] -[node name="CanvasLayer" type="CanvasLayer"] +[node name="HUD" type="CanvasLayer"] layer = 100 - -[node name="HUD" type="Control" parent="."] -margin_top = 1.0 -margin_bottom = 1.0 script = ExtResource( 6 ) bonus_color = Color( 0.478431, 1, 0.47451, 1 ) -[node name="Back" type="Sprite" parent="HUD"] -position = Vector2( 128, 95 ) +[node name="Back" type="Sprite" parent="."] +position = Vector2( 128, 96 ) texture = ExtResource( 3 ) -[node name="GoldCounter" type="Label" parent="HUD"] +[node name="GoldCounter" type="Label" parent="."] margin_left = 12.0 -margin_top = -2.0 +margin_top = -1.0 margin_right = 52.0 -margin_bottom = 18.0 +margin_bottom = 19.0 theme = ExtResource( 10 ) text = "00 " -[node name="ShardCounter" type="Label" parent="HUD"] +[node name="ShardCounter" type="Label" parent="."] margin_left = 41.0 -margin_top = -2.0 +margin_top = -1.0 margin_right = 81.0 -margin_bottom = 18.0 +margin_bottom = 19.0 theme = ExtResource( 10 ) text = "0" -[node name="RedStar" type="Sprite" parent="HUD"] +[node name="RedStar" type="Sprite" parent="."] visible = false material = SubResource( 1 ) -position = Vector2( 83, 5 ) +position = Vector2( 83, 6 ) texture = ExtResource( 1 ) region_enabled = true region_rect = Rect2( 0, 0, 8, 8 ) -[node name="YellowStar" type="Sprite" parent="HUD"] +[node name="YellowStar" type="Sprite" parent="."] visible = false material = SubResource( 2 ) -position = Vector2( 93, 5 ) +position = Vector2( 93, 6 ) texture = ExtResource( 1 ) region_enabled = true region_rect = Rect2( 8, 0, 8, 8 ) -[node name="GreenStar" type="Sprite" parent="HUD"] +[node name="GreenStar" type="Sprite" parent="."] visible = false -position = Vector2( 103, 5 ) +position = Vector2( 103, 6 ) texture = ExtResource( 1 ) region_enabled = true region_rect = Rect2( 16, 0, 8, 8 ) -[node name="BlueStar" type="Sprite" parent="HUD"] +[node name="BlueStar" type="Sprite" parent="."] visible = false -position = Vector2( 113, 5 ) +position = Vector2( 113, 6 ) texture = ExtResource( 1 ) region_enabled = true region_rect = Rect2( 24, 0, 8, 8 ) -[node name="MagentaStar" type="Sprite" parent="HUD"] +[node name="MagentaStar" type="Sprite" parent="."] visible = false -position = Vector2( 123, 5 ) +position = Vector2( 123, 6 ) texture = ExtResource( 1 ) region_enabled = true region_rect = Rect2( 32, 0, 8, 8 ) -[node name="ScoreText" type="Label" parent="HUD"] +[node name="ScoreText" type="Label" parent="."] margin_left = 137.0 -margin_top = -2.0 +margin_top = -1.0 margin_right = 221.0 -margin_bottom = 18.0 +margin_bottom = 19.0 theme = ExtResource( 10 ) text = "SCORE:" -[node name="ScoreCounter" type="Label" parent="HUD"] +[node name="ScoreCounter" type="Label" parent="."] margin_left = 179.0 -margin_top = -2.0 +margin_top = -1.0 margin_right = 263.0 -margin_bottom = 18.0 +margin_bottom = 19.0 theme = ExtResource( 10 ) text = "00000" -[node name="HighCounter" type="Label" parent="HUD"] +[node name="HighCounter" type="Label" parent="."] visible = false margin_left = 178.0 -margin_top = 178.0 +margin_top = 179.0 margin_right = 262.0 -margin_bottom = 198.0 +margin_bottom = 199.0 theme = ExtResource( 10 ) text = "High:000000" -[node name="LivesCounter" type="Label" parent="HUD"] +[node name="LivesCounter" type="Label" parent="."] margin_left = 240.0 -margin_top = -2.0 +margin_top = -1.0 margin_right = 324.0 -margin_bottom = 18.0 +margin_bottom = 19.0 theme = ExtResource( 10 ) text = "2" -[node name="ArrowCounter" type="Label" parent="HUD"] +[node name="ArrowCounter" type="Label" parent="."] margin_left = 61.0 -margin_top = -2.0 +margin_top = -1.0 margin_right = 145.0 -margin_bottom = 18.0 +margin_bottom = 19.0 theme = ExtResource( 10 ) text = "0" -[node name="TimeCounter" type="Label" parent="HUD"] +[node name="TimeCounter" type="Label" parent="."] margin_left = 1.0 -margin_top = 178.0 +margin_top = 179.0 margin_right = 57.0 -margin_bottom = 198.0 +margin_bottom = 199.0 theme = ExtResource( 10 ) text = "0:00:00"