New features and plenty of code still in testing. This includes a level select, basic inventory, and a basic HUD.

This commit is contained in:
VoidTwo
2021-11-15 22:29:42 -06:00
parent bbb245f7b7
commit 2c98c112bd
47 changed files with 753 additions and 68 deletions

18
GUI/HUD.gd Normal file
View File

@@ -0,0 +1,18 @@
extends CanvasLayer
signal add_currency(amount)
func _on_Add_Currency_pressed() -> void:
emit_signal('add_currency', 1)
return
func update_currency(amount: int) -> void:
$Currency.set_text(String(amount))
return
func update_health(value: int) -> void:
$'Health Bar'.value = value
return

40
GUI/HUD.tscn Normal file
View File

@@ -0,0 +1,40 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://GUI/HUD.gd" type="Script" id=1]
[ext_resource path="res://Sprites/Health_Bar_Under.png" type="Texture" id=2]
[ext_resource path="res://Sprites/Health_Bar_Progress.png" type="Texture" id=3]
[ext_resource path="res://Sprites/Health_Bar_Over.png" type="Texture" id=4]
[node name="HUD" type="CanvasLayer"]
script = ExtResource( 1 )
[node name="Health Bar" type="TextureProgress" parent="."]
margin_right = 104.0
margin_bottom = 18.0
rect_min_size = Vector2( 104, 18 )
texture_under = ExtResource( 2 )
texture_over = ExtResource( 4 )
texture_progress = ExtResource( 3 )
tint_progress = Color( 0.431373, 1, 0.737255, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Currency" type="Label" parent="."]
margin_left = 220.0
margin_right = 320.0
align = 2
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Add Currency" type="Button" parent="."]
margin_left = 300.0
margin_top = 20.0
margin_right = 320.0
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="Add Currency" to="." method="_on_Add_Currency_pressed"]

33
GUI/Level Select Menu.gd Normal file
View File

@@ -0,0 +1,33 @@
extends Node
signal complete(option)
func _on_hub_world_button_pressed() -> void:
emit_signal('complete', 'H')
return
func _on_level_1_button_pressed() -> void:
emit_signal('complete', '1')
return
func _on_level_2_button_pressed() -> void:
emit_signal('complete', '2')
return
func _on_level_3_button_pressed() -> void:
emit_signal('complete', '3')
return
func _on_level_4_button_pressed() -> void:
emit_signal('complete', '4')
return
func _on_level_5_button_pressed() -> void:
emit_signal('complete', '5')
return

View File

@@ -0,0 +1,74 @@
[gd_scene load_steps=8 format=2]
[ext_resource path="res://Levels/Level_3_Button_Normal.png" type="Texture" id=1]
[ext_resource path="res://Levels/Level_1_Button_Normal.png" type="Texture" id=2]
[ext_resource path="res://Levels/Level_4_Button_Normal.png" type="Texture" id=3]
[ext_resource path="res://Levels/Level_2_Button_Normal.png" type="Texture" id=4]
[ext_resource path="res://Levels/Level_5_Button_Normal.png" type="Texture" id=5]
[ext_resource path="res://Levels/Hub_World_Button_Normal.png" type="Texture" id=6]
[ext_resource path="res://GUI/Level Select Menu.gd" type="Script" id=7]
[node name="Level Select Menu" type="Node"]
script = ExtResource( 7 )
[node name="MarginContainer" type="MarginContainer" parent="."]
margin_left = 10.0
margin_top = 10.0
margin_right = 310.0
margin_bottom = 170.0
rect_min_size = Vector2( 300, 160 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer"]
margin_right = 300.0
margin_bottom = 160.0
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/CenterContainer"]
margin_left = 20.0
margin_top = 60.0
margin_right = 280.0
margin_bottom = 100.0
[node name="Hub World" type="TextureButton" parent="MarginContainer/CenterContainer/HBoxContainer"]
margin_right = 40.0
margin_bottom = 40.0
texture_normal = ExtResource( 6 )
[node name="Level 1" type="TextureButton" parent="MarginContainer/CenterContainer/HBoxContainer"]
margin_left = 44.0
margin_right = 84.0
margin_bottom = 40.0
texture_normal = ExtResource( 2 )
[node name="Level 2" type="TextureButton" parent="MarginContainer/CenterContainer/HBoxContainer"]
margin_left = 88.0
margin_right = 128.0
margin_bottom = 40.0
texture_normal = ExtResource( 4 )
[node name="Level 3" type="TextureButton" parent="MarginContainer/CenterContainer/HBoxContainer"]
margin_left = 132.0
margin_right = 172.0
margin_bottom = 40.0
texture_normal = ExtResource( 1 )
[node name="Level 4" type="TextureButton" parent="MarginContainer/CenterContainer/HBoxContainer"]
margin_left = 176.0
margin_right = 216.0
margin_bottom = 40.0
texture_normal = ExtResource( 3 )
[node name="Level 5" type="TextureButton" parent="MarginContainer/CenterContainer/HBoxContainer"]
margin_left = 220.0
margin_right = 260.0
margin_bottom = 40.0
texture_normal = ExtResource( 5 )
[connection signal="pressed" from="MarginContainer/CenterContainer/HBoxContainer/Hub World" to="." method="_on_hub_world_button_pressed"]
[connection signal="pressed" from="MarginContainer/CenterContainer/HBoxContainer/Level 1" to="." method="_on_level_1_button_pressed"]
[connection signal="pressed" from="MarginContainer/CenterContainer/HBoxContainer/Level 2" to="." method="_on_level_2_button_pressed"]
[connection signal="pressed" from="MarginContainer/CenterContainer/HBoxContainer/Level 3" to="." method="_on_level_3_button_pressed"]
[connection signal="pressed" from="MarginContainer/CenterContainer/HBoxContainer/Level 4" to="." method="_on_level_4_button_pressed"]
[connection signal="pressed" from="MarginContainer/CenterContainer/HBoxContainer/Level 5" to="." method="_on_level_5_button_pressed"]

13
GUI/Main Menu.gd Normal file
View File

@@ -0,0 +1,13 @@
extends Node
signal complete(option)
func _on_new_game_button_pressed() -> void:
emit_signal('complete', 'new game')
return
func _on_quit_button_pressed() -> void:
emit_signal('complete', 'quit')
return

126
GUI/Main Menu.tscn Normal file
View File

@@ -0,0 +1,126 @@
[gd_scene load_steps=16 format=2]
[ext_resource path="res://Sprites/Settings_Button_Normal.png" type="Texture" id=1]
[ext_resource path="res://Sprites/Continue_Button_Hover.png" type="Texture" id=2]
[ext_resource path="res://Sprites/Credits_Button_Normal.png" type="Texture" id=3]
[ext_resource path="res://Sprites/Continue_Button_Normal.png" type="Texture" id=4]
[ext_resource path="res://Sprites/New_Game_Button_Normal.png" type="Texture" id=5]
[ext_resource path="res://Sprites/Continue_Button_Disabled.png" type="Texture" id=6]
[ext_resource path="res://Sprites/New_Game_Button_Hover.png" type="Texture" id=7]
[ext_resource path="res://Sprites/Quit_Button_Normal.png" type="Texture" id=8]
[ext_resource path="res://Sprites/Credits_Button_Hover.png" type="Texture" id=9]
[ext_resource path="res://Sprites/Settings_Button_Hover.png" type="Texture" id=10]
[ext_resource path="res://Sprites/Quit_Button_Hover.png" type="Texture" id=11]
[ext_resource path="res://Sprites/Main_Menu_Background.png" type="Texture" id=12]
[ext_resource path="res://Resources/Ash.tres" type="DynamicFontData" id=13]
[ext_resource path="res://GUI/Main Menu.gd" type="Script" id=14]
[sub_resource type="DynamicFont" id=1]
size = 20
use_mipmaps = true
extra_spacing_bottom = 15
font_data = ExtResource( 13 )
[node name="Main Menu" type="Node"]
script = ExtResource( 14 )
[node name="Background" type="Sprite" parent="."]
texture = ExtResource( 12 )
centered = false
[node name="Menu Items" type="MarginContainer" parent="."]
margin_left = 10.0
margin_top = 10.0
margin_right = 310.0
margin_bottom = 170.0
rect_min_size = Vector2( 300, 160 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="Menu Items"]
margin_right = 300.0
margin_bottom = 160.0
alignment = 2
[node name="Title" type="Label" parent="Menu Items/VBoxContainer"]
margin_top = 23.0
margin_right = 300.0
margin_bottom = 62.0
custom_fonts/font = SubResource( 1 )
text = "Embodiment"
align = 1
valign = 1
[node name="CenterContainer" type="CenterContainer" parent="Menu Items/VBoxContainer"]
margin_top = 66.0
margin_right = 300.0
margin_bottom = 160.0
[node name="Menu Options" type="VBoxContainer" parent="Menu Items/VBoxContainer/CenterContainer"]
margin_left = 108.0
margin_right = 191.0
margin_bottom = 94.0
[node name="CenterContainer" type="CenterContainer" parent="Menu Items/VBoxContainer/CenterContainer/Menu Options"]
margin_right = 83.0
margin_bottom = 15.0
[node name="Continue Button" type="TextureButton" parent="Menu Items/VBoxContainer/CenterContainer/Menu Options/CenterContainer"]
margin_left = 7.0
margin_right = 75.0
margin_bottom = 15.0
disabled = true
texture_normal = ExtResource( 4 )
texture_hover = ExtResource( 2 )
texture_disabled = ExtResource( 6 )
[node name="CenterContainer2" type="CenterContainer" parent="Menu Items/VBoxContainer/CenterContainer/Menu Options"]
margin_top = 19.0
margin_right = 83.0
margin_bottom = 33.0
[node name="New Game Button" type="TextureButton" parent="Menu Items/VBoxContainer/CenterContainer/Menu Options/CenterContainer2"]
margin_right = 83.0
margin_bottom = 14.0
texture_normal = ExtResource( 5 )
texture_hover = ExtResource( 7 )
[node name="CenterContainer3" type="CenterContainer" parent="Menu Items/VBoxContainer/CenterContainer/Menu Options"]
margin_top = 37.0
margin_right = 83.0
margin_bottom = 56.0
[node name="Settings Button" type="TextureButton" parent="Menu Items/VBoxContainer/CenterContainer/Menu Options/CenterContainer3"]
margin_left = 11.0
margin_right = 72.0
margin_bottom = 19.0
texture_normal = ExtResource( 1 )
texture_hover = ExtResource( 10 )
[node name="CenterContainer4" type="CenterContainer" parent="Menu Items/VBoxContainer/CenterContainer/Menu Options"]
margin_top = 60.0
margin_right = 83.0
margin_bottom = 75.0
[node name="Credits Button" type="TextureButton" parent="Menu Items/VBoxContainer/CenterContainer/Menu Options/CenterContainer4"]
margin_left = 16.0
margin_right = 67.0
margin_bottom = 15.0
texture_normal = ExtResource( 3 )
texture_hover = ExtResource( 9 )
[node name="CenterContainer5" type="CenterContainer" parent="Menu Items/VBoxContainer/CenterContainer/Menu Options"]
margin_top = 79.0
margin_right = 83.0
margin_bottom = 94.0
[node name="Quit Button" type="TextureButton" parent="Menu Items/VBoxContainer/CenterContainer/Menu Options/CenterContainer5"]
margin_left = 24.0
margin_right = 58.0
margin_bottom = 15.0
texture_normal = ExtResource( 8 )
texture_hover = ExtResource( 11 )
[connection signal="pressed" from="Menu Items/VBoxContainer/CenterContainer/Menu Options/CenterContainer2/New Game Button" to="." method="_on_new_game_button_pressed"]
[connection signal="pressed" from="Menu Items/VBoxContainer/CenterContainer/Menu Options/CenterContainer5/Quit Button" to="." method="_on_quit_button_pressed"]

29
GUI/Splash Screen.gd Normal file
View File

@@ -0,0 +1,29 @@
extends Sprite
signal complete
func _ready() -> void:
# Fade in
if not $Tween.interpolate_property(self, 'self_modulate:a', 0, 1, 3, Tween.TRANS_LINEAR, Tween.EASE_IN):
print('ERROR: Splash Screen fade in animation has errors.')
if not $Tween.start():
print('ERROR: Splash Screen fade in animation failed to start.')
yield($Tween, 'tween_completed') # Wait for fade in to complete
# Fade out
if not $Tween.interpolate_property(self, 'self_modulate:a', 1, 0, 3, Tween.TRANS_LINEAR, Tween.EASE_OUT, 2):
print('ERROR: Splash Screen fade out animation has errors.')
if not $Tween.start():
print('ERROR: Splash Screen fade out animation failed to start.')
yield($Tween, 'tween_completed') # Wait for fade out to complete
emit_signal('complete')
return
func _input(event: InputEvent) -> void:
if event.is_action_pressed('ui_accept'):
emit_signal('complete')
return

12
GUI/Splash Screen.tscn Normal file
View File

@@ -0,0 +1,12 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Sprites/Splash_Screen.png" type="Texture" id=1]
[ext_resource path="res://GUI/Splash Screen.gd" type="Script" id=2]
[node name="Splash Screen" type="Sprite"]
self_modulate = Color( 1, 1, 1, 0 )
texture = ExtResource( 1 )
centered = false
script = ExtResource( 2 )
[node name="Tween" type="Tween" parent="."]