Added pause menu with recipes

This commit is contained in:
akshay 2022-08-20 06:11:08 -04:00
parent 1b389fc07a
commit d8cdc48c01
10 changed files with 165 additions and 5 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/item_recipes.png-907ab7408764d4990d37a0163ed0578b.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/tutorial/item_recipes.png"
dest_files=[ "res://.import/item_recipes.png-907ab7408764d4990d37a0163ed0578b.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/machine_repair.png-2fbf76229e517b31efe6af8169865532.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/tutorial/machine_repair.png"
dest_files=[ "res://.import/machine_repair.png-2fbf76229e517b31efe6af8169865532.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -186,6 +186,12 @@ open_debug={
"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":46,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}
pause_game={
"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":0,"physical_scancode":16777217,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
]
}
[layer_names]

View File

@ -1,14 +1,73 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://scripts/game_manager.gd" type="Script" id=1]
[ext_resource path="res://assets/tutorial/item_recipes.png" type="Texture" id=2]
[ext_resource path="res://assets/tutorial/machine_repair.png" type="Texture" id=3]
[node name="game_manager" type="CanvasLayer" groups=["game_manager"]]
pause_mode = 2
layer = 5
script = ExtResource( 1 )
[node name="UI" type="Control" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
rect_pivot_offset = Vector2( 1024, 600 )
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="pause_menu" type="Panel" parent="UI"]
pause_mode = 2
unique_name_in_owner = true
anchor_right = 1.0
anchor_bottom = 1.0
rect_pivot_offset = Vector2( 989, 509 )
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="resume_button" type="Button" parent="UI/pause_menu"]
pause_mode = 2
unique_name_in_owner = true
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
margin_top = -171.0
margin_right = 63.0
margin_bottom = -151.0
rect_scale = Vector2( 4, 4 )
rect_pivot_offset = Vector2( 30.7864, 9.2928 )
text = "RESUME"
icon_align = 1
expand_icon = true
[node name="machine_repair" type="TextureRect" parent="UI/pause_menu"]
anchor_left = 0.532812
anchor_top = 0.191667
anchor_right = 0.960938
anchor_bottom = 0.762037
margin_left = 6.10352e-05
rect_pivot_offset = Vector2( -754, 325 )
texture = ExtResource( 3 )
expand = true
stretch_mode = 1
__meta__ = {
"_edit_use_anchors_": true
}
[node name="item_recipe" type="TextureRect" parent="UI/pause_menu"]
anchor_left = 0.043
anchor_top = 0.27
anchor_right = 0.49
anchor_bottom = 0.718
margin_left = -0.560005
margin_top = 0.399994
margin_right = 0.199951
margin_bottom = -0.440063
rect_pivot_offset = Vector2( 1777, -206.5 )
texture = ExtResource( 2 )
expand = true
stretch_mode = 6
[node name="day_timer_text" type="Label" parent="UI"]
unique_name_in_owner = true
@ -25,6 +84,8 @@ align = 2
uppercase = true
[node name="day_timer" type="Timer" parent="."]
pause_mode = 1
unique_name_in_owner = true
[connection signal="pressed" from="UI/pause_menu/resume_button" to="." method="_on_resume_button_pressed"]
[connection signal="timeout" from="day_timer" to="." method="_on_day_timer_timeout"]

View File

@ -250,9 +250,6 @@ script = ExtResource( 8 )
target = NodePath("../Player")
size = 4.0
[node name="game_manager" parent="." instance=ExtResource( 7 )]
time_per_day = 300.0
[node name="power_station" parent="." instance=ExtResource( 14 )]
transform = Transform( 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 1, 0 )
time_to_generate = 5.0
@ -402,9 +399,14 @@ transform = Transform( -0.707107, 0, 0.707107, 0, 1, 0, -0.707107, 0, -0.707107,
start_broken = true
[node name="CanvasLayer" type="CanvasLayer" parent="."]
pause_mode = 1
visible = false
[node name="cheat_menu" parent="CanvasLayer" instance=ExtResource( 18 )]
[node name="game_manager" parent="." instance=ExtResource( 7 )]
time_per_day = 300.0
[connection signal="player_entered" from="cameras/camera_room_center" to="cameras" method="_on_camera_room_player_entered"]
[connection signal="player_exited" from="cameras/camera_room_center" to="cameras" method="_on_camera_room_player_exited"]
[connection signal="area_entered" from="cameras/camera_room_center/hitbox" to="cameras/camera_room_center" method="_on_hitbox_area_entered"]

View File

@ -714,7 +714,7 @@ mesh = SubResource( 1 )
skin = SubResource( 2 )
[node name="head_bone" type="BoneAttachment" parent="model_transform/DungMan/Armature/Skeleton" index="1"]
transform = Transform( 1, -2.20707e-16, -2.35891e-17, 2.74492e-19, -0.105045, 0.994467, -2.21964e-16, -0.994467, -0.105045, -3.31838e-16, -0.0380623, -1.50372 )
transform = Transform( 1, -2.22118e-16, -9.47951e-19, -2.04242e-19, -0.00518723, 0.999986, -2.2212e-16, -0.999986, -0.00518723, -3.33247e-16, 0.00719897, -1.50005 )
bone_name = "Item"
[node name="ItemSpawn" type="Spatial" parent="model_transform/DungMan/Armature/Skeleton/head_bone"]
@ -774,14 +774,17 @@ pause_mode = 2
[node name="Control" type="Control" parent="UI"]
margin_right = 40.0
margin_bottom = 40.0
mouse_filter = 2
[node name="TextureRect" type="TextureRect" parent="UI/Control"]
margin_right = 565.0
margin_bottom = 164.0
mouse_filter = 2
texture = SubResource( 21 )
expand = true
[node name="MarginContainer" type="MarginContainer" parent="UI/Control"]
mouse_filter = 2
custom_constants/margin_right = 16
custom_constants/margin_top = 16
custom_constants/margin_left = 16
@ -793,12 +796,14 @@ margin_left = 16.0
margin_top = 16.0
margin_right = 540.0
margin_bottom = 144.0
mouse_filter = 2
[node name="stomach0" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"]
material = SubResource( 28 )
margin_right = 128.0
margin_bottom = 128.0
rect_pivot_offset = Vector2( 128, 821 )
mouse_filter = 2
texture = ExtResource( 3 )
[node name="stomach1" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"]
@ -807,6 +812,7 @@ margin_left = 132.0
margin_right = 260.0
margin_bottom = 128.0
rect_pivot_offset = Vector2( 128, 821 )
mouse_filter = 2
texture = ExtResource( 3 )
[node name="stomach2" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"]
@ -815,6 +821,7 @@ margin_left = 264.0
margin_right = 392.0
margin_bottom = 128.0
rect_pivot_offset = Vector2( 128, 821 )
mouse_filter = 2
texture = ExtResource( 3 )
[node name="stomach3" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"]
@ -823,12 +830,14 @@ margin_left = 396.0
margin_right = 524.0
margin_bottom = 128.0
rect_pivot_offset = Vector2( 128, 821 )
mouse_filter = 2
texture = ExtResource( 3 )
[node name="blackout" type="ColorRect" parent="UI"]
modulate = Color( 1, 1, 1, 0 )
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 2
color = Color( 0, 0, 0, 1 )
[node name="ZZZ" type="Label" parent="UI"]

View File

@ -5,6 +5,7 @@ export var time_per_day : float = 600.0
onready var player = get_tree().get_nodes_in_group("player")[0]
onready var day_timer = $"%day_timer"
onready var day_timer_text = $"%day_timer_text"
onready var pause_menu = $"%pause_menu"
func _ready():
player.connect("starved_to_death", self, "_on_player_starved_to_death")
@ -17,6 +18,10 @@ func _process(delta):
var seconds : int = time_left % 60
day_timer_text.text = "Time Left: %0*d:%0*d" % [2, minutes, 2, seconds]
func _unhandled_input(event):
if event.is_action_pressed("pause_game"):
toggle_pause_menu()
func _on_player_starved_to_death():
var node = Dialogic.start("starve")
node.pause_mode = PAUSE_MODE_PROCESS
@ -31,3 +36,10 @@ func reset_day_timer():
func _on_day_timer_timeout():
player.sleep(false, null)
func toggle_pause_menu():
pause_menu.visible = !pause_menu.visible
get_tree().paused = pause_menu.visible
func _on_resume_button_pressed():
toggle_pause_menu()