From 0cb827a981a2441273944a93c32e3b9ecca8fa64 Mon Sep 17 00:00:00 2001 From: Nitsud Yarg Date: Sat, 8 Jun 2024 23:46:15 -0700 Subject: [PATCH] UI impovements. --- Main.tscn | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/UI_Layer.gd | 11 +++++++++++ 2 files changed, 59 insertions(+) diff --git a/Main.tscn b/Main.tscn index 49e56d7..9d0b337 100644 --- a/Main.tscn +++ b/Main.tscn @@ -149,10 +149,17 @@ scroll_limit_end = Vector2( 1300, 0 ) [node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"] motion_mirroring = Vector2( 500, 0 ) +__meta__ = { +"_edit_group_": true, +"_edit_lock_": true +} [node name="Bgmuck" type="Sprite" parent="ParallaxBackground/ParallaxLayer"] texture = ExtResource( 1 ) centered = false +__meta__ = { +"_edit_lock_": true +} [node name="TileMap" type="TileMap" parent="."] tile_set = SubResource( 1 ) @@ -170,17 +177,27 @@ position = Vector2( 137, 54 ) [node name="CameraControl" type="Position2D" parent="."] process_priority = 1 script = ExtResource( 5 ) +__meta__ = { +"_edit_group_": true, +"_edit_lock_": true +} [node name="Line2D" type="Line2D" parent="CameraControl"] visible = false points = PoolVector2Array( 0, 0, 160, 160, 241, 217, 406, 261, 358, 359, 43, 412, 53, 279, 250, 121, 355, -64, -4, 167, -141, -162, -274, -190, -321, 55, -211, 196, 564, 205, -325, -173, 174, -15 ) width = 3.0 +__meta__ = { +"_edit_lock_": true +} [node name="Camera2D" type="Camera2D" parent="CameraControl"] process_priority = 1 anchor_mode = 0 current = true smoothing_speed = 30.0 +__meta__ = { +"_edit_lock_": true +} [node name="Left" type="RayCast2D" parent="CameraControl"] position = Vector2( 160, 90 ) @@ -189,6 +206,9 @@ cast_to = Vector2( -160, 0 ) collision_mask = 256 collide_with_areas = true collide_with_bodies = false +__meta__ = { +"_edit_lock_": true +} [node name="Right" type="RayCast2D" parent="CameraControl"] position = Vector2( 160, 90 ) @@ -197,33 +217,55 @@ cast_to = Vector2( 160, 0 ) collision_mask = 256 collide_with_areas = true collide_with_bodies = false +__meta__ = { +"_edit_lock_": true +} [node name="CameraBoundaries" type="Area2D" parent="."] collision_layer = 256 collision_mask = 0 +__meta__ = { +"_edit_lock_": true +} [node name="CollisionShape2D" type="CollisionShape2D" parent="CameraBoundaries"] position = Vector2( 0, 66 ) shape = SubResource( 13 ) +__meta__ = { +"_edit_lock_": true +} [node name="CollisionShape2D2" type="CollisionShape2D" parent="CameraBoundaries"] position = Vector2( 1281, 68 ) shape = SubResource( 13 ) +__meta__ = { +"_edit_lock_": true +} [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] stream = ExtResource( 4 ) [node name="EnemyC" parent="." instance=ExtResource( 7 )] position = Vector2( 394, 47 ) +__meta__ = { +"_edit_lock_": true +} [node name="EnemyC2" parent="." instance=ExtResource( 7 )] position = Vector2( 492, 27 ) +__meta__ = { +"_edit_lock_": true +} [node name="ActorTemplate" parent="." instance=ExtResource( 6 )] position = Vector2( 262, 44 ) +__meta__ = { +"_edit_lock_": true +} actor_type = "NPC" [node name="UI_Layer" type="CanvasLayer" parent="."] +pause_mode = 2 layer = 2 script = ExtResource( 9 ) @@ -258,6 +300,12 @@ custom_fonts/font = ExtResource( 8 ) text = "In a world where danger lurks in your plumbing. One thing decides to do another thing and we all determine it wasn't worth it. Hello World" autowrap = true +[node name="Polygon2D" type="Polygon2D" parent="UI_Layer/PanelContainer"] +position = Vector2( 75, 16.5 ) +scale = Vector2( 0.769547, 0.833333 ) +color = Color( 0.533333, 0.533333, 0.533333, 1 ) +polygon = PoolVector2Array( 294, 63, 300.177, 63, 307, 63, 300.503, 69 ) + [node name="HealthBar" type="TextureProgress" parent="UI_Layer"] margin_left = 2.0 margin_top = 2.0 diff --git a/src/UI_Layer.gd b/src/UI_Layer.gd index 84f3974..eeea52d 100644 --- a/src/UI_Layer.gd +++ b/src/UI_Layer.gd @@ -12,10 +12,14 @@ onready var DialogContainerPortrait = $PanelContainer/HSplitContainer/TextureRec onready var DialogContainerText = $PanelContainer/HSplitContainer/Label +onready var DialogIndicator = $PanelContainer/Polygon2D + onready var HUD = $HealthBar var current_pane +var tween + # Called when the node enters the scene tree for the first time. func _ready(): # How to change to a differant portrait picture. @@ -23,9 +27,14 @@ func _ready(): #DialogContainerText.text = UiManager.dialog_text UiManager.current_pane = UiManager.UI_PANES.HUD #DialogContainer.visible = false + tween = get_tree().create_tween().set_loops() + tween.tween_property(DialogIndicator, "modulate", Color.darkgray, 1) + tween.tween_property(DialogIndicator, "modulate", Color.white , 1) + ##tween.tween_property(DialogIndicator, "modulate", Color.RED, 1) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): + if (UiManager.current_pane != current_pane): print("UI Switch detected") current_pane = UiManager.current_pane @@ -40,6 +49,7 @@ func _process(delta): DialogContainerPortrait.texture = UiManager.dialog_portrait DialogContainerText.text = UiManager.dialog_text DialogContainer.visible = true + #get_tree().paused = true _: # Implicitly off print("UI Turned off") @@ -47,3 +57,4 @@ func _process(delta): func _unhandled_input(event): if current_pane == UiManager.UI_PANES.DIALOG and Input.is_action_just_pressed("ui_accept"): UiManager.current_pane = UiManager.UI_PANES.HUD + #get_tree().paused = false