forked from team-sg/hero-mark-2
add pause screen
This commit is contained in:
parent
1d76d93aed
commit
74288e3ec6
8 changed files with 27 additions and 4 deletions
|
@ -15,6 +15,7 @@ shader_param/scanline_opacity = Vector2( 0.4, 0.05 )
|
||||||
shader_param/brightness = 1.25
|
shader_param/brightness = 1.25
|
||||||
|
|
||||||
[node name="Control" type="Control"]
|
[node name="Control" type="Control"]
|
||||||
|
pause_mode = 2
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
margin_right = -16.0
|
margin_right = -16.0
|
||||||
|
@ -48,6 +49,7 @@ handle_input_locally = false
|
||||||
render_target_update_mode = 3
|
render_target_update_mode = 3
|
||||||
|
|
||||||
[node name="Map" parent="ViewportContainer/Viewport" instance=ExtResource( 3 )]
|
[node name="Map" parent="ViewportContainer/Viewport" instance=ExtResource( 3 )]
|
||||||
|
pause_mode = 1
|
||||||
|
|
||||||
[node name="CheatLayer" type="CanvasLayer" parent="ViewportContainer/Viewport"]
|
[node name="CheatLayer" type="CanvasLayer" parent="ViewportContainer/Viewport"]
|
||||||
layer = 127
|
layer = 127
|
||||||
|
|
4
game.gd
4
game.gd
|
@ -134,5 +134,5 @@ func _process(delta):
|
||||||
OS.set_window_fullscreen(false)
|
OS.set_window_fullscreen(false)
|
||||||
#Pause
|
#Pause
|
||||||
if Input.is_action_just_pressed("pause"):
|
if Input.is_action_just_pressed("pause"):
|
||||||
instance_node(pause_screen,0,0,get_parent())
|
var viewport = get_parent().get_node("Main/Control/ViewportContainer/Viewport")
|
||||||
get_tree().paused = true
|
instance_node(pause_screen,0,0,viewport)
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
extents = Vector2( 4, 96 )
|
extents = Vector2( 4, 96 )
|
||||||
|
|
||||||
[node name="Map" type="Node2D" groups=["map"]]
|
[node name="Map" type="Node2D" groups=["map"]]
|
||||||
|
pause_mode = 1
|
||||||
script = ExtResource( 11 )
|
script = ExtResource( 11 )
|
||||||
save_location = 2
|
save_location = 2
|
||||||
music = ExtResource( 12 )
|
music = ExtResource( 12 )
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
extents = Vector2( 8, 128 )
|
extents = Vector2( 8, 128 )
|
||||||
|
|
||||||
[node name="Map" type="Node2D" groups=["map"]]
|
[node name="Map" type="Node2D" groups=["map"]]
|
||||||
|
pause_mode = 1
|
||||||
script = ExtResource( 18 )
|
script = ExtResource( 18 )
|
||||||
target_time_any = 70
|
target_time_any = 70
|
||||||
target_time_100 = 180
|
target_time_100 = 180
|
||||||
|
|
|
@ -5,6 +5,12 @@ func _ready():
|
||||||
get_tree().paused = true
|
get_tree().paused = true
|
||||||
$Body/Resume.grab_focus()
|
$Body/Resume.grab_focus()
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
print(get_tree().paused)
|
||||||
|
#Resume with pause button
|
||||||
|
if Input.is_action_just_pressed("pause"):
|
||||||
|
get_tree().paused = false
|
||||||
|
queue_free()
|
||||||
|
|
||||||
func _on_Resume_pressed():
|
func _on_Resume_pressed():
|
||||||
get_tree().paused = false
|
get_tree().paused = false
|
||||||
|
@ -13,7 +19,11 @@ func _on_Resume_pressed():
|
||||||
|
|
||||||
func _on_Restart_pressed():
|
func _on_Restart_pressed():
|
||||||
Game.call_deferred("restart_level")
|
Game.call_deferred("restart_level")
|
||||||
|
get_tree().paused = false
|
||||||
|
queue_free()
|
||||||
|
|
||||||
|
|
||||||
func _on_ExitLevel_pressed():
|
func _on_ExitLevel_pressed():
|
||||||
|
get_tree().paused = false
|
||||||
Game.change_map(load("res://maps/level_select.tscn"))
|
Game.change_map(load("res://maps/level_select.tscn"))
|
||||||
|
queue_free()
|
||||||
|
|
|
@ -85,6 +85,8 @@ margin_bottom = 41.0
|
||||||
focus_neighbour_top = NodePath("../Settings")
|
focus_neighbour_top = NodePath("../Settings")
|
||||||
texture_focused = ExtResource( 3 )
|
texture_focused = ExtResource( 3 )
|
||||||
|
|
||||||
|
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||||
|
|
||||||
[connection signal="pressed" from="Body/Resume" to="." method="_on_Resume_pressed"]
|
[connection signal="pressed" from="Body/Resume" to="." method="_on_Resume_pressed"]
|
||||||
[connection signal="pressed" from="Body/Restart" to="." method="_on_Restart_pressed"]
|
[connection signal="pressed" from="Body/Restart" to="." method="_on_Restart_pressed"]
|
||||||
[connection signal="pressed" from="Body/ExitLevel" to="." method="_on_ExitLevel_pressed"]
|
[connection signal="pressed" from="Body/ExitLevel" to="." method="_on_ExitLevel_pressed"]
|
||||||
|
|
|
@ -29,8 +29,6 @@ var can_doublejump = true
|
||||||
var can_move_in_air = false
|
var can_move_in_air = false
|
||||||
#Positions
|
#Positions
|
||||||
var arrowpos = Vector2(5,3)
|
var arrowpos = Vector2(5,3)
|
||||||
#Tiles
|
|
||||||
onready var deathtiles = map.get_node("Death")
|
|
||||||
##Preload
|
##Preload
|
||||||
var pre_arrow = preload("res://objects/player/arrow_projectile.tscn")
|
var pre_arrow = preload("res://objects/player/arrow_projectile.tscn")
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,15 @@ ogg_vorbis={
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
|
ui_accept={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":88,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
jump={
|
jump={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":88,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":88,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue