pause menu (wip)

This commit is contained in:
Page Asgardius 2024-06-08 15:09:54 -07:00
parent 6eefbe36dd
commit c9d81729df
4 changed files with 89 additions and 3 deletions

View file

@ -581,6 +581,9 @@ For inspiring my own art
My father
For let me know that humanity is awful
Kuro Games
For creating Yinlin as a tribute to my best character: Kimberly arch
Hans Asperger
For let me know that i'm not alone in this universe

View file

@ -7,6 +7,8 @@ var sfx1 := AudioStreamPlayer.new()
var musictrack
var bhud = load("res://levels/bottomhud.tscn").instantiate()
var thud = load("res://levels/ui/tophud.tscn").instantiate()
var pmenu = load("res://levels/ui/pause.tscn").instantiate()
var ispaused = false
var ishud = true
# Called when the node enters the scene tree for the first time.
@ -66,13 +68,14 @@ func _process(delta):
func _input(event):
if (Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK)) && Global.cdialog == []:
Global.live = 0
ishud = false
Global.bossready = false
Global.cboss = [null, null, null]
get_tree().root.remove_child(thud)
get_tree().root.remove_child(bhud)
get_tree().root.remove_child(player)
get_tree().root.remove_child(level)
Global.live = 0
if Global.debug:
get_tree().change_scene_to_file("res://levels/ui/scene.tscn")
else:
@ -110,10 +113,10 @@ func _input(event):
sfx1.stream = load(Global.sfxtracks[1])
sfx1.play(0)
bgsound.play(0)
if Global.cdialog.size() != 0 && ishud:
if Global.live != 1 && ishud:
get_tree().root.remove_child(thud)
ishud = false
elif Global.cdialog.size() == 0&& !ishud:
elif Global.live == 1 && !ishud:
get_tree().root.add_child.call_deferred(thud)
ishud = true
func _statrebase():

30
levels/ui/pause.gd Normal file
View file

@ -0,0 +1,30 @@
extends Control
var cff
var cnf
var chealthf
# Called when the node enters the scene tree for the first time.
func _ready():
cff = $CanvasLayer/HBoxContainer/TextureRect
cnf = $CanvasLayer/HBoxContainer/VBoxContainer/Cname
chealthf = $CanvasLayer/HBoxContainer/VBoxContainer/HBoxContainer/Label2
_fetchdata()
#pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _input(event):
_fetchdata()
func _fetchdata():
if Global.debug:
cnf.set_text(Global.pcnames[Global.dparty[Global.dcpchar][0]])
cff.texture = load(Global.hudfaces[Global.dparty[Global.dcpchar][0]][Global.dparty[Global.dcpchar][1]])
chealthf.set_text(str(Global.dstats[Global.dparty[Global.dcpchar][0]][0])+"/"+str(Global.mstats[Global.dparty[Global.dcpchar][0]][0]))
else:
cnf.set_text(Global.pcnames[Global.party[Global.cpchar][0]])
cff.texture = load(Global.hudfaces[Global.party[Global.cpchar][0]][Global.party[Global.cpchar][1]])
chealthf.set_text(str(Global.cstats[Global.dparty[Global.cpchar][0]][0])+"/"+str(Global.mstats[Global.dparty[Global.cpchar][0]][0]))

50
levels/ui/pause.tscn Normal file
View file

@ -0,0 +1,50 @@
[gd_scene load_steps=2 format=3 uid="uid://5ilscynpg61o"]
[ext_resource type="Script" path="res://levels/ui/pause.gd" id="1_x3t1h"]
[node name="Pause" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_x3t1h")
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="ColorRect" type="ColorRect" parent="CanvasLayer"]
custom_minimum_size = Vector2(1280, 720)
offset_right = 1280.0
offset_bottom = 720.0
color = Color(0, 0, 0, 1)
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer"]
offset_right = 40.0
offset_bottom = 40.0
[node name="TextureRect" type="TextureRect" parent="CanvasLayer/HBoxContainer"]
custom_minimum_size = Vector2(116, 116)
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/HBoxContainer"]
layout_mode = 2
[node name="Cname" type="Label" parent="CanvasLayer/HBoxContainer/VBoxContainer"]
custom_minimum_size = Vector2(174, 0)
layout_mode = 2
text = "Name"
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/HBoxContainer/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="CanvasLayer/HBoxContainer/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(70, 0)
layout_mode = 2
text = "Health"
[node name="Label2" type="Label" parent="CanvasLayer/HBoxContainer/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(123, 0)
layout_mode = 2
text = "100/100"
horizontal_alignment = 2