diff --git a/global.gd b/global.gd index a51eae3..8c1c5e2 100644 --- a/global.gd +++ b/global.gd @@ -5,6 +5,7 @@ var time var origmpos var mousepos var timelimit = 15000 +var exitgame = false var wait var bossready = false var playerx diff --git a/levels/ui/gameplay.gd b/levels/ui/gameplay.gd index ef4ee83..20a4bf6 100644 --- a/levels/ui/gameplay.gd +++ b/levels/ui/gameplay.gd @@ -67,19 +67,8 @@ func _process(delta): #velocity = (Vector2.RIGHT.rotated(rotation) * -100 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -100 * Global.ym * delta func _input(event): - if (Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK)) && Global.cdialog == []: - 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: - get_tree().change_scene_to_file("res://title.tscn") + if Input.is_action_just_pressed("Pause") && Global.cdialog == []: + _exit() if Global.live == 1 && Input.is_action_pressed("schar") && Input.is_action_just_pressed("ui_up"): if Global.debug: if Global.dparty[0][0] != null: @@ -130,3 +119,21 @@ func _statrebase(): if Global.party[i][0] != null: for j in 7: Global.mstats[Global.party[i][0]][j] = Global.basestats[Global.party[i][0]][j] * Global.level[Global.dparty[i][0]] +func _pausemenu(): + if Global.live == 4 && !ispaused: + get_tree().root.remove_child(bhud) + elif Global.live != 4 && ispaused: + get_tree().root.add_child.call_deferred(bhud) +func _exit(): + 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: + get_tree().change_scene_to_file("res://title.tscn") diff --git a/levels/ui/pause.gd b/levels/ui/pause.gd index 78ee738..019c708 100644 --- a/levels/ui/pause.gd +++ b/levels/ui/pause.gd @@ -2,12 +2,14 @@ extends Control var cff var cnf var chealthf +var clevel # 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 + clevel = $CanvasLayer/HBoxContainer/VBoxContainer/HBoxContainer2/Label2 _fetchdata() #pass # Replace with function body. @@ -24,7 +26,9 @@ func _fetchdata(): 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])) + clevel.set_text(str(Global.dlevel[Global.dparty[Global.dcpchar][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])) + clevel.set_text(str(Global.level[Global.party[Global.cpchar][0]])) diff --git a/levels/ui/pause.tscn b/levels/ui/pause.tscn index 1b6cf2a..9767e46 100644 --- a/levels/ui/pause.tscn +++ b/levels/ui/pause.tscn @@ -48,3 +48,17 @@ custom_minimum_size = Vector2(123, 0) layout_mode = 2 text = "100/100" horizontal_alignment = 2 + +[node name="HBoxContainer2" type="HBoxContainer" parent="CanvasLayer/HBoxContainer/VBoxContainer"] +layout_mode = 2 + +[node name="Label" type="Label" parent="CanvasLayer/HBoxContainer/VBoxContainer/HBoxContainer2"] +custom_minimum_size = Vector2(70, 0) +layout_mode = 2 +text = "Level" + +[node name="Label2" type="Label" parent="CanvasLayer/HBoxContainer/VBoxContainer/HBoxContainer2"] +custom_minimum_size = Vector2(123, 0) +layout_mode = 2 +text = "99" +horizontal_alignment = 2 diff --git a/project.godot b/project.godot index cfcc344..03506e7 100644 --- a/project.godot +++ b/project.godot @@ -92,6 +92,12 @@ schar={ , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":false,"script":null) ] } +Pause={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":4,"pressure":0.0,"pressed":false,"script":null) +] +} [internationalization]