Added new font. Created main menu and completed the game loop. Added bounce on item balloons

This commit is contained in:
akshay 2022-08-21 01:53:37 -04:00
parent 50ab2c2579
commit 2bd6bc1c4e
20 changed files with 215 additions and 51 deletions

Binary file not shown.

BIN
assets/UI/Menu_Recipes.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Menu_Recipes.png-bafc812259ffc5e37891cc8023a7e6bd.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/UI/Menu_Recipes.png"
dest_files=[ "res://.import/Menu_Recipes.png-bafc812259ffc5e37891cc8023a7e6bd.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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -123,7 +123,7 @@ _global_script_class_icons={
[application] [application]
config/name="Dungee" config/name="Dungee"
run/main_scene="res://scenes/main.tscn" run/main_scene="res://scenes/main_menu.tscn"
config/icon="res://assets/icons/icon.png" config/icon="res://assets/icons/icon.png"
config/windows_native_icon="res://assets/icons/icon.ico" config/windows_native_icon="res://assets/icons/icon.ico"

View File

@ -1,8 +1,22 @@
[gd_scene load_steps=4 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://scripts/game_manager.gd" type="Script" id=1] [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/UI/Menu_Recipes.png" type="Texture" id=2]
[ext_resource path="res://assets/tutorial/machine_repair.png" type="Texture" id=3] [ext_resource path="res://assets/tutorial/machine_repair.png" type="Texture" id=3]
[ext_resource path="res://assets/Fonts/AlphaProta-Wy7VE.ttf" type="DynamicFontData" id=4]
[sub_resource type="DynamicFont" id=2]
size = 50
font_data = ExtResource( 4 )
[sub_resource type="DynamicFont" id=1]
size = 75
font_data = ExtResource( 4 )
[sub_resource type="StyleBoxFlat" id=3]
bg_color = Color( 0, 0.282353, 0.721569, 1 )
border_color = Color( 0, 0, 0, 1 )
border_blend = true
[node name="game_manager" type="CanvasLayer" groups=["game_manager"]] [node name="game_manager" type="CanvasLayer" groups=["game_manager"]]
pause_mode = 2 pause_mode = 2
@ -26,27 +40,11 @@ rect_pivot_offset = Vector2( 989, 509 )
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 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"] [node name="machine_repair" type="TextureRect" parent="UI/pause_menu"]
anchor_left = 0.532812 anchor_left = 0.466146
anchor_top = 0.191667 anchor_top = 0.0962963
anchor_right = 0.960938 anchor_right = 0.894272
anchor_bottom = 0.762037 anchor_bottom = 0.666666
margin_left = 6.10352e-05 margin_left = 6.10352e-05
rect_pivot_offset = Vector2( -754, 325 ) rect_pivot_offset = Vector2( -754, 325 )
texture = ExtResource( 3 ) texture = ExtResource( 3 )
@ -56,30 +54,66 @@ __meta__ = {
"_edit_use_anchors_": true "_edit_use_anchors_": true
} }
[node name="item_recipe" type="TextureRect" parent="UI/pause_menu"] [node name="recipes" type="TextureRect" parent="UI/pause_menu"]
anchor_left = 0.043 anchor_left = 0.0427083
anchor_top = 0.27 anchor_top = 0.0592593
anchor_right = 0.49 anchor_right = 0.323438
anchor_bottom = 0.718 anchor_bottom = 0.925926
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 ) texture = ExtResource( 2 )
expand = true expand = true
stretch_mode = 6 __meta__ = {
"_edit_use_anchors_": true
}
[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_left = 166.0
margin_top = -303.0
margin_right = 529.0
margin_bottom = -217.0
rect_pivot_offset = Vector2( 30.7864, 9.2928 )
custom_fonts/font = SubResource( 2 )
text = "RESUME"
icon_align = 1
expand_icon = true
[node name="main_menu_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_left = 166.0
margin_top = -184.0
margin_right = 529.0
margin_bottom = -98.0
rect_pivot_offset = Vector2( 30.7864, 9.2928 )
custom_fonts/font = SubResource( 2 )
text = "MAIN MENU"
icon_align = 1
expand_icon = true
[node name="day_timer_text" type="Label" parent="UI"] [node name="day_timer_text" type="Label" parent="UI"]
unique_name_in_owner = true unique_name_in_owner = true
anchor_left = 1.0 anchor_left = 1.0
anchor_right = 1.0 anchor_right = 1.0
margin_left = -67.8719 margin_left = -520.0
margin_right = 39.1281 margin_bottom = 51.0
margin_bottom = 14.0
grow_horizontal = 0 grow_horizontal = 0
rect_scale = Vector2( 5, 5 )
rect_pivot_offset = Vector2( 116.901, -0.362253 ) rect_pivot_offset = Vector2( 116.901, -0.362253 )
custom_colors/font_color = Color( 0.0235294, 0.792157, 0, 1 )
custom_colors/font_outline_modulate = Color( 0, 0, 0, 1 )
custom_colors/font_color_shadow = Color( 0, 0, 0, 1 )
custom_constants/shadow_offset_x = -2
custom_constants/shadow_offset_y = 2
custom_fonts/font = SubResource( 1 )
custom_styles/normal = SubResource( 3 )
text = "Time Left: 00:20" text = "Time Left: 00:20"
align = 2 align = 2
uppercase = true uppercase = true
@ -89,4 +123,5 @@ pause_mode = 1
unique_name_in_owner = true unique_name_in_owner = true
[connection signal="pressed" from="UI/pause_menu/resume_button" to="." method="_on_resume_button_pressed"] [connection signal="pressed" from="UI/pause_menu/resume_button" to="." method="_on_resume_button_pressed"]
[connection signal="pressed" from="UI/pause_menu/main_menu_button" to="." method="_on_main_menu_button_pressed"]
[connection signal="timeout" from="day_timer" to="." method="_on_day_timer_timeout"] [connection signal="timeout" from="day_timer" to="." method="_on_day_timer_timeout"]

View File

@ -31,3 +31,7 @@ transform = Transform( 0.901009, -0.433801, 0, 0.433801, 0.901009, 0, 0, 0, 1, -
[node name="two_item_balloon2" parent="two_item" instance=ExtResource( 2 )] [node name="two_item_balloon2" parent="two_item" instance=ExtResource( 2 )]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform( 0.901009, 0.433801, 0, -0.433801, 0.901009, 0, 0, 0, 1, 1, 2.691, 0 ) transform = Transform( 0.901009, 0.433801, 0, -0.433801, 0.901009, 0, 0, 0, 1, 1, 2.691, 0 )
[connection signal="player_failed_interact" from="." to="one_item/one_item_balloon" method="_on_item_dump_player_failed_interact"]
[connection signal="player_failed_interact" from="." to="two_item/two_item_balloon1" method="_on_item_dump_player_failed_interact"]
[connection signal="player_failed_interact" from="." to="two_item/two_item_balloon2" method="_on_item_dump_player_failed_interact"]

81
scenes/main_menu.tscn Normal file
View File

@ -0,0 +1,81 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://assets/icons/icon.png" type="Texture" id=1]
[ext_resource path="res://assets/Fonts/AlphaProta-Wy7VE.ttf" type="DynamicFontData" id=2]
[ext_resource path="res://scripts/main_menu.gd" type="Script" id=3]
[sub_resource type="DynamicFont" id=1]
size = 150
font_data = ExtResource( 2 )
[sub_resource type="DynamicFont" id=2]
size = 50
font_data = ExtResource( 2 )
[node name="MainMenu" type="CanvasLayer"]
pause_mode = 2
script = ExtResource( 3 )
[node name="Panel" type="Panel" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
[node name="DungeeImage" type="TextureRect" parent="Panel"]
anchor_left = 0.370833
anchor_top = 0.0555556
anchor_right = 0.63125
anchor_bottom = 0.518519
texture = ExtResource( 1 )
expand = true
__meta__ = {
"_edit_use_anchors_": true
}
[node name="DungeeText" type="RichTextLabel" parent="Panel"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -312.0
margin_top = 70.0
margin_right = 366.0
margin_bottom = 224.0
rect_pivot_offset = Vector2( 342, 83 )
custom_fonts/normal_font = SubResource( 1 )
text = "DUNGEE"
scroll_active = false
[node name="BeginButton" type="Button" parent="Panel"]
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
margin_left = -122.0
margin_top = -284.0
margin_right = 148.0
margin_bottom = -206.0
custom_fonts/font = SubResource( 2 )
text = "BEGIN"
expand_icon = true
__meta__ = {
"_edit_use_anchors_": true
}
[node name="ExitButton" type="Button" parent="Panel"]
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
margin_left = -122.0
margin_top = -169.0
margin_right = 148.0
margin_bottom = -91.0
custom_fonts/font = SubResource( 2 )
text = "EXIT"
expand_icon = true
__meta__ = {
"_edit_use_anchors_": true
}
[connection signal="pressed" from="Panel/BeginButton" to="." method="_on_BeginButton_pressed"]
[connection signal="pressed" from="Panel/ExitButton" to="." method="_on_ExitButton_pressed"]

View File

@ -1,4 +1,5 @@
extends Node extends Node
const MainMenuScenePath : String = "res://scenes/main_menu.tscn"
export var time_per_day : float = 600.0 export var time_per_day : float = 600.0
@ -29,7 +30,7 @@ func _on_player_starved_to_death():
get_tree().paused = true get_tree().paused = true
yield(node, "timeline_end") yield(node, "timeline_end")
get_tree().paused = false get_tree().paused = false
get_tree().quit() # go back to main menu when such a thing exists get_tree().change_scene(MainMenuScenePath)
func reset_day_timer(): func reset_day_timer():
day_timer.start() day_timer.start()
@ -43,3 +44,6 @@ func toggle_pause_menu():
func _on_resume_button_pressed(): func _on_resume_button_pressed():
toggle_pause_menu() toggle_pause_menu()
func _on_main_menu_button_pressed():
get_tree().change_scene(MainMenuScenePath)

View File

@ -5,7 +5,6 @@ class_name ItemBalloon
const ItemScene = preload("res://scenes/item.tscn") const ItemScene = preload("res://scenes/item.tscn")
onready var anim_tree : AnimationTree = $"%AnimationTree" onready var anim_tree : AnimationTree = $"%AnimationTree"
onready var bounce_timer : Timer = $"%bounce_timer"
onready var attached_item = $"%attached_item" onready var attached_item = $"%attached_item"
var anim_playback : AnimationNodeStateMachinePlayback = null var anim_playback : AnimationNodeStateMachinePlayback = null
@ -15,21 +14,12 @@ var is_bouncing : bool = false
func _ready(): func _ready():
anim_playback = anim_tree["parameters/playback"] anim_playback = anim_tree["parameters/playback"]
anim_playback.travel("idle") anim_playback.travel("idle")
bounce_timer.one_shot = true
func attach_item(item : Resource): func attach_item(item : Resource):
attached_item.set_item_type(item) attached_item.set_item_type(item)
func bounce(): func bounce():
if is_bouncing:
return
is_bouncing = true
anim_playback.travel("bounce") anim_playback.travel("bounce")
bounce_timer.start(anim_playback.get_current_length())
func _on_bounce_timer_timeout(): func _on_item_dump_player_failed_interact():
pass bounce()
# assert(is_bouncing)
# anim_playback.start("Balloon Reset")
# anim_playback.travel("Ballon Idle")
# is_bouncing = false

View File

@ -1,6 +1,7 @@
extends Spatial extends Spatial
signal item_dump_completed signal item_dump_completed
signal item_dumped signal item_dumped
signal player_failed_interact
export var enabled = true export var enabled = true
export (Array,Resource) var items_required export (Array,Resource) var items_required
@ -27,12 +28,16 @@ func reset():
func on_player_interact(player) -> bool: func on_player_interact(player) -> bool:
if not enabled: if not enabled:
emit_signal("player_failed_interact")
return false return false
if items_remaining.empty(): if items_remaining.empty():
emit_signal("player_failed_interact")
return false return false
if not player.has_item(): if not player.has_item():
emit_signal("player_failed_interact")
return false return false
if not items_remaining.has(player.item_in_hand.item_type): if not items_remaining.has(player.item_in_hand.item_type):
emit_signal("player_failed_interact")
return false return false
# Remove the player's item and mark off the item on the remaining list # Remove the player's item and mark off the item on the remaining list

10
scripts/main_menu.gd Normal file
View File

@ -0,0 +1,10 @@
extends CanvasLayer
const MainScene = preload("res://scenes/main.tscn")
func _on_BeginButton_pressed():
get_tree().paused = false
get_tree().change_scene_to(MainScene)
func _on_ExitButton_pressed():
get_tree().quit()