pause menu

This commit is contained in:
Page Asgardius 2024-06-15 14:11:43 -07:00
parent 89acf97f69
commit 4f6a5bc90c
8 changed files with 114 additions and 15 deletions

View file

@ -49,7 +49,7 @@ var firstrun
const musictracks = ["res://music/midorinoakuma.wav", "res://music/seahorse.wav", "res://music/chinesegoat.wav", "res://music/doyoufeelold.wav", "res://music/doyiuneedahealer.wav", "res://music/adayatceres.wav", "res://music/twintroublemakers.wav", "res://music/easyquiz.wav", "res://music/neowave.wav", "res://music/multivectorsubmarines.wav", "res://music/halfgeniegirls.wav", "res://music/rusianmaverickfairy.wav", "res://music/blacksmithofdestruction.wav", "res://music/shininglikefireworks.wav", "res://music/sadtrashcan.wav", "res://music/akikoletter.wav", "res://music/asadcat.wav", "res://music/lilydesire.wav", "res://music/scholartrip.wav", "res://music/quantumice.wav", "res://music/unreeeal.wav"] const musictracks = ["res://music/midorinoakuma.wav", "res://music/seahorse.wav", "res://music/chinesegoat.wav", "res://music/doyoufeelold.wav", "res://music/doyiuneedahealer.wav", "res://music/adayatceres.wav", "res://music/twintroublemakers.wav", "res://music/easyquiz.wav", "res://music/neowave.wav", "res://music/multivectorsubmarines.wav", "res://music/halfgeniegirls.wav", "res://music/rusianmaverickfairy.wav", "res://music/blacksmithofdestruction.wav", "res://music/shininglikefireworks.wav", "res://music/sadtrashcan.wav", "res://music/akikoletter.wav", "res://music/asadcat.wav", "res://music/lilydesire.wav", "res://music/scholartrip.wav", "res://music/quantumice.wav", "res://music/unreeeal.wav"]
const sfxtracks = ["res://sfx/braindamage.wav", "res://sfx/gaugefill.wav", "res://sfx/boomboombakudan.wav"] const sfxtracks = ["res://sfx/braindamage.wav", "res://sfx/gaugefill.wav", "res://sfx/boomboombakudan.wav"]
var debug = false var debug = false
const release = "R0.1.7-alpha" const release = "R0.1.7-dev"
var sk = false var sk = false
var xm = 0 var xm = 0
var ym = 0 var ym = 0

View file

@ -51,6 +51,11 @@ func _process(delta):
Global.xm = 0 Global.xm = 0
Global.ym = 0 Global.ym = 0
var velocity = Vector2.ZERO var velocity = Vector2.ZERO
if Global.exitgame:
_exit()
#velocity = (Vector2.RIGHT.rotated(rotation) * -100 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -100 * Global.ym * delta
func _input(event):
if Global.live == 1 && !Input.is_action_pressed("schar"): if Global.live == 1 && !Input.is_action_pressed("schar"):
if Input.get_joy_axis(0,JOY_AXIS_LEFT_X) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_X) < -0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) < -0.2: if Input.get_joy_axis(0,JOY_AXIS_LEFT_X) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_X) < -0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) < -0.2:
Global.xm = Input.get_joy_axis(0,JOY_AXIS_LEFT_X) Global.xm = Input.get_joy_axis(0,JOY_AXIS_LEFT_X)
@ -64,11 +69,9 @@ func _process(delta):
Global.ym = -1 Global.ym = -1
if Input.is_action_pressed("ui_down"): if Input.is_action_pressed("ui_down"):
Global.ym = 1 Global.ym = 1
#velocity = (Vector2.RIGHT.rotated(rotation) * -100 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -100 * Global.ym * delta
func _input(event):
if Input.is_action_just_pressed("Pause") && Global.cdialog == []: if Input.is_action_just_pressed("Pause") && Global.cdialog == []:
_exit() _pausemenu()
#Global.exitgame = true
if Global.live == 1 && Input.is_action_pressed("schar") && Input.is_action_just_pressed("ui_up"): if Global.live == 1 && Input.is_action_pressed("schar") && Input.is_action_just_pressed("ui_up"):
if Global.debug: if Global.debug:
if Global.dparty[0][0] != null: if Global.dparty[0][0] != null:
@ -120,17 +123,27 @@ func _statrebase():
for j in 7: for j in 7:
Global.mstats[Global.party[i][0]][j] = Global.basestats[Global.party[i][0]][j] * Global.level[Global.dparty[i][0]] Global.mstats[Global.party[i][0]][j] = Global.basestats[Global.party[i][0]][j] * Global.level[Global.dparty[i][0]]
func _pausemenu(): func _pausemenu():
if Global.live == 4 && !ispaused: if Global.live == 1 && !ispaused:
get_tree().root.remove_child(bhud) get_tree().root.remove_child(bhud)
elif Global.live != 4 && ispaused: get_tree().root.add_child.call_deferred(pmenu)
ispaused = true
Global.live = 4
elif Global.live == 4 && ispaused:
get_tree().root.remove_child(pmenu)
get_tree().root.add_child.call_deferred(bhud) get_tree().root.add_child.call_deferred(bhud)
ispaused = false
Global.live = 1
func _exit(): func _exit():
Global.exitgame = false
ishud = false ishud = false
Global.bossready = false Global.bossready = false
Global.cboss = [null, null, null] Global.cboss = [null, null, null]
get_tree().root.remove_child(thud) if Global.live == 4:
get_tree().root.remove_child(bhud) get_tree().root.remove_child(pmenu)
get_tree().root.remove_child(player) else:
get_tree().root.remove_child(thud)
get_tree().root.remove_child(bhud)
#get_tree().root.remove_child(player)
get_tree().root.remove_child(level) get_tree().root.remove_child(level)
Global.live = 0 Global.live = 0
if Global.debug: if Global.debug:

View file

@ -11,6 +11,7 @@ func _ready():
chealthf = $CanvasLayer/HBoxContainer/VBoxContainer/HBoxContainer/Label2 chealthf = $CanvasLayer/HBoxContainer/VBoxContainer/HBoxContainer/Label2
clevel = $CanvasLayer/HBoxContainer/VBoxContainer/HBoxContainer2/Label2 clevel = $CanvasLayer/HBoxContainer/VBoxContainer/HBoxContainer2/Label2
_fetchdata() _fetchdata()
$CanvasLayer/HBoxContainer2/VBoxContainer2/Exit.grab_focus()
#pass # Replace with function body. #pass # Replace with function body.
@ -32,3 +33,8 @@ func _fetchdata():
cff.texture = load(Global.hudfaces[Global.party[Global.cpchar][0]][Global.party[Global.cpchar][1]]) 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])) chealthf.set_text(str(Global.cstats[Global.dparty[Global.cpchar][0]][0])+"/"+str(Global.mstats[Global.dparty[Global.cpchar][0]][0]))
clevel.set_text(str(Global.level[Global.party[Global.cpchar][0]])) clevel.set_text(str(Global.level[Global.party[Global.cpchar][0]]))
func _on_exit_pressed():
Global.exitgame = true
#pass # Replace with function body.

View file

@ -1,6 +1,10 @@
[gd_scene load_steps=2 format=3 uid="uid://5ilscynpg61o"] [gd_scene load_steps=4 format=3 uid="uid://5ilscynpg61o"]
[ext_resource type="Script" path="res://levels/ui/pause.gd" id="1_x3t1h"] [ext_resource type="Script" path="res://levels/ui/pause.gd" id="1_x3t1h"]
[ext_resource type="PackedScene" uid="uid://d31udhuuwrajn" path="res://levels/bottomhud.tscn" id="2_jnb0v"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yb7nc"]
bg_color = Color(0, 0.8, 0, 1)
[node name="Pause" type="Control"] [node name="Pause" type="Control"]
layout_mode = 3 layout_mode = 3
@ -19,6 +23,8 @@ offset_right = 1280.0
offset_bottom = 720.0 offset_bottom = 720.0
color = Color(0, 0, 0, 1) color = Color(0, 0, 0, 1)
[node name="Bottomhud" parent="CanvasLayer" instance=ExtResource("2_jnb0v")]
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer"] [node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer"]
offset_right = 40.0 offset_right = 40.0
offset_bottom = 40.0 offset_bottom = 40.0
@ -62,3 +68,77 @@ custom_minimum_size = Vector2(123, 0)
layout_mode = 2 layout_mode = 2
text = "99" text = "99"
horizontal_alignment = 2 horizontal_alignment = 2
[node name="HBoxContainer2" type="HBoxContainer" parent="CanvasLayer"]
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -264.0
offset_top = 133.0
offset_right = 264.0
offset_bottom = 357.0
grow_horizontal = 2
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/HBoxContainer2"]
layout_mode = 2
[node name="Character" type="Button" parent="CanvasLayer/HBoxContainer2/VBoxContainer"]
visible = false
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_yb7nc")
text = "Character"
[node name="Team" type="Button" parent="CanvasLayer/HBoxContainer2/VBoxContainer"]
visible = false
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_yb7nc")
text = "Team"
[node name="Warp" type="Button" parent="CanvasLayer/HBoxContainer2/VBoxContainer"]
visible = false
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_yb7nc")
text = "Warp
"
[node name="Settings" type="Button" parent="CanvasLayer/HBoxContainer2/VBoxContainer"]
visible = false
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_yb7nc")
text = "Settings"
[node name="VBoxContainer2" type="VBoxContainer" parent="CanvasLayer/HBoxContainer2"]
layout_mode = 2
[node name="Journal" type="Button" parent="CanvasLayer/HBoxContainer2/VBoxContainer2"]
visible = false
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_yb7nc")
text = "Journal"
[node name="Challenges" type="Button" parent="CanvasLayer/HBoxContainer2/VBoxContainer2"]
visible = false
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_yb7nc")
text = "Challenges"
[node name="Backpack" type="Button" parent="CanvasLayer/HBoxContainer2/VBoxContainer2"]
visible = false
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_yb7nc")
text = "Backpack"
[node name="Exit" type="Button" parent="CanvasLayer/HBoxContainer2/VBoxContainer2"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_yb7nc")
text = "Exit"
[connection signal="pressed" from="CanvasLayer/HBoxContainer2/VBoxContainer2/Exit" to="." method="_on_exit_pressed"]

View file

@ -25,7 +25,7 @@ func _process(delta):
pass pass
func _physics_process(delta): func _physics_process(delta):
if isvisible.is_on_screen(): if isvisible.is_on_screen() && Global.live != 4:
if direction == null: if direction == null:
position += velocity * delta position += velocity * delta
else: else:

View file

@ -18,7 +18,7 @@ func _process(delta):
pass pass
func _physics_process(delta): func _physics_process(delta):
if isvisible.is_on_screen(): if isvisible.is_on_screen() && Global.live != 4:
if direction == null: if direction == null:
position += velocity * delta position += velocity * delta
else: else:

View file

@ -18,7 +18,7 @@ func _process(delta):
pass pass
func _physics_process(delta): func _physics_process(delta):
if isvisible.is_on_screen(): if isvisible.is_on_screen() && Global.live != 4:
if direction == null: if direction == null:
position += velocity * delta position += velocity * delta
else: else:

View file

@ -61,7 +61,7 @@ func _physics_process(delta):
func _input(event): func _input(event):
if Global.live == 1: if Global.live == 1:
if Input.is_action_pressed("schar"): if Input.is_action_pressed("schar") && (Input.is_action_just_released("ui_up") || Input.is_action_just_released("ui_down") || Input.is_action_just_released("ui_left") || Input.is_action_just_released("ui_right")):
_charswitch() _charswitch()
if Input.is_action_just_pressed("shoot") && !bpress && Global.live == 1: if Input.is_action_just_pressed("shoot") && !bpress && Global.live == 1:
bpress = true bpress = true