From 44f4fef3cfed3ffb424c946a4825fa167f87f61c Mon Sep 17 00:00:00 2001 From: Page Asgardius Date: Thu, 29 Feb 2024 18:22:06 -0700 Subject: [PATCH] minihud --- levels/ui/tophud.gd | 171 +++++++++++++++++--------------- levels/ui/tophud.tscn | 3 + sprites/common/player/player.gd | 2 +- 3 files changed, 96 insertions(+), 80 deletions(-) diff --git a/levels/ui/tophud.gd b/levels/ui/tophud.gd index b25f590..c8aa2e2 100644 --- a/levels/ui/tophud.gd +++ b/levels/ui/tophud.gd @@ -9,6 +9,8 @@ var cf1 var cf2 var cf3 var cf4 +var cff +var cnf var focus1 var focus2 var focus3 @@ -34,6 +36,8 @@ func _ready(): focus2 = $Topleft/Character2/ColorRect2 focus3 = $Topleft/Character3/ColorRect2 focus4 = $Topleft/Character4/ColorRect2 + cnf = $Topmini/VBoxContainer/HBoxContainer/Label + cff = $Topmini/TextureRect topleft.visible = false topleftbg.visible = false if Global.mangohud: @@ -56,93 +60,102 @@ func _input(event): topleftbg.visible = false _charrefresh() func _charrefresh(): - if Global.debug: - if Global.dparty[0] != null: - cn1.set_text(Global.pcnames[Global.dparty[0]]) - cf1.texture = load(Global.hudfaces[Global.dparty[0]]) - if Global.dcpchar == 0: - focus1.set_color(Color(0, 0, 1, 1)) + if topleft.visible: + if Global.debug: + if Global.dparty[0] != null: + cn1.set_text(Global.pcnames[Global.dparty[0]]) + cf1.texture = load(Global.hudfaces[Global.dparty[0]]) + if Global.dcpchar == 0: + focus1.set_color(Color(0, 0, 1, 1)) + else: + focus1.set_color(Color(1, 1, 1, 1)) else: + cn1.set_text("") + cf1.texture = null focus1.set_color(Color(1, 1, 1, 1)) - else: - cn1.set_text("") - cf1.texture = null - focus1.set_color(Color(1, 1, 1, 1)) - if Global.dparty[1] != null: - cn2.set_text(Global.pcnames[Global.dparty[1]]) - cf2.texture = load(Global.hudfaces[Global.dparty[1]]) - if Global.dcpchar == 1: - focus2.set_color(Color(0, 0, 1, 1)) + if Global.dparty[1] != null: + cn2.set_text(Global.pcnames[Global.dparty[1]]) + cf2.texture = load(Global.hudfaces[Global.dparty[1]]) + if Global.dcpchar == 1: + focus2.set_color(Color(0, 0, 1, 1)) + else: + focus2.set_color(Color(1, 1, 1, 1)) else: + cn2.set_text("") + cf2.texture = null focus2.set_color(Color(1, 1, 1, 1)) - else: - cn2.set_text("") - cf2.texture = null - focus2.set_color(Color(1, 1, 1, 1)) - if Global.dparty[2] != null: - cn3.set_text(Global.pcnames[Global.dparty[2]]) - cf3.texture = load(Global.hudfaces[Global.dparty[2]]) - if Global.dcpchar == 2: - focus3.set_color(Color(0, 0, 1, 1)) + if Global.dparty[2] != null: + cn3.set_text(Global.pcnames[Global.dparty[2]]) + cf3.texture = load(Global.hudfaces[Global.dparty[2]]) + if Global.dcpchar == 2: + focus3.set_color(Color(0, 0, 1, 1)) + else: + focus3.set_color(Color(1, 1, 1, 1)) else: + cn3.set_text("") + cf3.texture = null focus3.set_color(Color(1, 1, 1, 1)) - else: - cn3.set_text("") - cf3.texture = null - focus3.set_color(Color(1, 1, 1, 1)) - if Global.dparty[3] != null: - cn4.set_text(Global.pcnames[Global.dparty[3]]) - cf4.texture = load(Global.hudfaces[Global.dparty[3]]) - if Global.dcpchar == 3: - focus4.set_color(Color(0, 0, 1, 1)) + if Global.dparty[3] != null: + cn4.set_text(Global.pcnames[Global.dparty[3]]) + cf4.texture = load(Global.hudfaces[Global.dparty[3]]) + if Global.dcpchar == 3: + focus4.set_color(Color(0, 0, 1, 1)) + else: + focus4.set_color(Color(1, 1, 1, 1)) else: + cn4.set_text("") + cf4.texture = null focus4.set_color(Color(1, 1, 1, 1)) else: - cn4.set_text("") - cf4.texture = null - focus4.set_color(Color(1, 1, 1, 1)) + if Global.party[0] != null: + cn1.set_text(Global.pcnames[Global.party[0]]) + cf1.texture = load(Global.hudfaces[Global.party[0]]) + if Global.dcpchar == 0: + focus1.set_color(Color(0, 0, 1, 1)) + else: + focus1.set_color(Color(1, 1, 1, 1)) + else: + cn1.set_text("") + cf1.texture = null + focus1.set_color(Color(1, 1, 1, 1)) + if Global.party[1] != null: + cn2.set_text(Global.pcnames[Global.party[1]]) + cf2.texture = load(Global.hudfaces[Global.party[1]]) + if Global.dcpchar == 1: + focus2.set_color(Color(0, 0, 1, 1)) + else: + focus2.set_color(Color(1, 1, 1, 1)) + else: + cn2.set_text("") + cf2.texture = null + focus2.set_color(Color(1, 1, 1, 1)) + if Global.party[2] != null: + cn3.set_text(Global.pcnames[Global.party[0]]) + cf3.texture = load(Global.hudfaces[Global.party[0]]) + if Global.dcpchar == 2: + focus3.set_color(Color(0, 0, 1, 1)) + else: + focus3.set_color(Color(1, 1, 1, 1)) + else: + cn3.set_text("") + cf3.texture = null + focus3.set_color(Color(1, 1, 1, 1)) + if Global.party[3] != null: + cn4.set_text(Global.pcnames[Global.party[3]]) + cf4.texture = load(Global.hudfaces[Global.party[3]]) + if Global.dcpchar == 3: + focus4.set_color(Color(0, 0, 1, 1)) + else: + focus4.set_color(Color(1, 1, 1, 1)) + else: + cn4.set_text("") + cf4.texture = null + focus4.set_color(Color(1, 1, 1, 1)) else: - if Global.party[0] != null: - cn1.set_text(Global.pcnames[Global.party[0]]) - cf1.texture = load(Global.hudfaces[Global.party[0]]) - if Global.dcpchar == 0: - focus1.set_color(Color(0, 0, 1, 1)) - else: - focus1.set_color(Color(1, 1, 1, 1)) + if Global.debug: + cnf.set_text(Global.pcnames[Global.dparty[Global.dcpchar]]) + cff.texture = load(Global.hudfaces[Global.dparty[Global.dcpchar]]) else: - cn1.set_text("") - cf1.texture = null - focus1.set_color(Color(1, 1, 1, 1)) - if Global.party[1] != null: - cn2.set_text(Global.pcnames[Global.party[1]]) - cf2.texture = load(Global.hudfaces[Global.party[1]]) - if Global.dcpchar == 1: - focus2.set_color(Color(0, 0, 1, 1)) - else: - focus2.set_color(Color(1, 1, 1, 1)) - else: - cn2.set_text("") - cf2.texture = null - focus2.set_color(Color(1, 1, 1, 1)) - if Global.party[2] != null: - cn3.set_text(Global.pcnames[Global.party[0]]) - cf3.texture = load(Global.hudfaces[Global.party[0]]) - if Global.dcpchar == 2: - focus3.set_color(Color(0, 0, 1, 1)) - else: - focus3.set_color(Color(1, 1, 1, 1)) - else: - cn3.set_text("") - cf3.texture = null - focus3.set_color(Color(1, 1, 1, 1)) - if Global.party[3] != null: - cn4.set_text(Global.pcnames[Global.party[3]]) - cf4.texture = load(Global.hudfaces[Global.party[3]]) - if Global.dcpchar == 3: - focus4.set_color(Color(0, 0, 1, 1)) - else: - focus4.set_color(Color(1, 1, 1, 1)) - else: - cn4.set_text("") - cf4.texture = null - focus4.set_color(Color(1, 1, 1, 1)) + cnf.set_text(Global.pcnames[Global.party[Global.cpchar]]) + cff.texture = load(Global.hudfaces[Global.party[Global.cpchar]]) + diff --git a/levels/ui/tophud.tscn b/levels/ui/tophud.tscn index 2042d8b..96a0ca2 100644 --- a/levels/ui/tophud.tscn +++ b/levels/ui/tophud.tscn @@ -116,14 +116,17 @@ horizontal_alignment = 2 [node name="ColorRect2" type="ColorRect" parent="Topmini"] custom_minimum_size = Vector2(12, 64) layout_mode = 2 +color = Color(0, 0, 1, 1) [node name="Topleftbg" type="ColorRect" parent="."] +visible = false layout_mode = 0 offset_right = 377.0 offset_bottom = 476.0 color = Color(0.254902, 0.254902, 0.254902, 1) [node name="Topleft" type="VBoxContainer" parent="."] +visible = false layout_mode = 0 offset_right = 377.0 offset_bottom = 476.0 diff --git a/sprites/common/player/player.gd b/sprites/common/player/player.gd index db7bc8c..3b77343 100644 --- a/sprites/common/player/player.gd +++ b/sprites/common/player/player.gd @@ -23,7 +23,6 @@ func _physics_process(delta): #var velocity = Vector2.ZERO if Global.live == 1: velocity = (Vector2.RIGHT.rotated(rotation) * 500 * Global.xm * delta)-Vector2.UP.rotated(rotation) * 500 * Global.ym * delta - _charswitch() #origmpos = get_viewport().get_mouse_position() #if Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) != 0: # velocity = Vector2.UP.rotated(rotation) * -400 * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) @@ -58,6 +57,7 @@ func _physics_process(delta): func _input(event): if Global.live == 1: + _charswitch() if Input.is_action_just_pressed("shoot") && !bpress && Global.live == 1: bpress = true var bullet