New features and plenty of code still in testing. This includes a level select, basic inventory, and a basic HUD.
19
Enemies/Enemy.tscn
Normal file
@@ -0,0 +1,19 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Sprites/Enemy.png" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=2]
|
||||
radius = 3.0
|
||||
height = 2.0
|
||||
|
||||
[node name="Enemy" type="KinematicBody2D" groups=["enemies"]]
|
||||
collision_mask = 0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
position = Vector2( 0, -3 )
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="Hitbox" type="CollisionShape2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2( 0, -3 )
|
||||
shape = SubResource( 2 )
|
18
GUI/HUD.gd
Normal 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
@@ -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
@@ -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
|
74
GUI/Level Select Menu.tscn
Normal 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,7 +13,7 @@
|
||||
[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://Main Menu.gd" type="Script" id=14]
|
||||
[ext_resource path="res://GUI/Main Menu.gd" type="Script" id=14]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 20
|
||||
@@ -31,6 +31,8 @@ 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
|
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Sprites/Splash_Screen.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Splash Screen.gd" type="Script" id=2]
|
||||
[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 )
|
14
Item.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
# Item Class
|
||||
|
||||
var name: String
|
||||
var type: String
|
||||
|
||||
func _init(name: String, type: String) -> void:
|
||||
self.name = name
|
||||
self.type = type
|
||||
return
|
||||
|
||||
func equals(other) -> bool:
|
||||
if(self.name == other.name and self.type == other.type):
|
||||
return true
|
||||
return false
|
@@ -2,4 +2,5 @@ extends Node2D
|
||||
|
||||
func _ready() -> void:
|
||||
$YSort/Player.position = get_viewport_rect().size / 2
|
||||
$YSort/Player.load_hud($HUD)
|
||||
return
|
21
Levels/Hub World.tscn
Normal file
@@ -0,0 +1,21 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Levels/Hub World.gd" type="Script" id=2]
|
||||
[ext_resource path="res://GUI/HUD.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://Enemies/Enemy.tscn" type="PackedScene" id=4]
|
||||
|
||||
[node name="World" type="Node2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="YSort" type="YSort" parent="."]
|
||||
|
||||
[node name="Player" parent="YSort" instance=ExtResource( 1 )]
|
||||
collision_mask = 2
|
||||
|
||||
[node name="Enemies" type="YSort" parent="YSort"]
|
||||
|
||||
[node name="Enemy" parent="YSort/Enemies" instance=ExtResource( 4 )]
|
||||
position = Vector2( 204, 95.8129 )
|
||||
|
||||
[node name="HUD" parent="." instance=ExtResource( 3 )]
|
BIN
Levels/Hub_World_Button_Normal.png
Normal file
After Width: | Height: | Size: 141 B |
35
Levels/Hub_World_Button_Normal.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Hub_World_Button_Normal.png-e0e0c92697e93b1432bd2175db9ce2c3.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Levels/Hub_World_Button_Normal.png"
|
||||
dest_files=[ "res://.import/Hub_World_Button_Normal.png-e0e0c92697e93b1432bd2175db9ce2c3.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=3
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=0
|
||||
process/fix_alpha_border=false
|
||||
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=false
|
||||
svg/scale=1.0
|
BIN
Levels/Level_1_Button_Normal.png
Normal file
After Width: | Height: | Size: 121 B |
35
Levels/Level_1_Button_Normal.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Level_1_Button_Normal.png-aabb94677b90d525ea57c43e1e096b4c.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Levels/Level_1_Button_Normal.png"
|
||||
dest_files=[ "res://.import/Level_1_Button_Normal.png-aabb94677b90d525ea57c43e1e096b4c.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=3
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=0
|
||||
process/fix_alpha_border=false
|
||||
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=false
|
||||
svg/scale=1.0
|
BIN
Levels/Level_2_Button_Normal.png
Normal file
After Width: | Height: | Size: 150 B |
35
Levels/Level_2_Button_Normal.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Level_2_Button_Normal.png-fc84a3c0989fcc3c8e21d71dd29dae79.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Levels/Level_2_Button_Normal.png"
|
||||
dest_files=[ "res://.import/Level_2_Button_Normal.png-fc84a3c0989fcc3c8e21d71dd29dae79.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=3
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=0
|
||||
process/fix_alpha_border=false
|
||||
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=false
|
||||
svg/scale=1.0
|
BIN
Levels/Level_3_Button_Normal.png
Normal file
After Width: | Height: | Size: 160 B |
35
Levels/Level_3_Button_Normal.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Level_3_Button_Normal.png-13bd64d9d3b134bf83ed84336204422d.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Levels/Level_3_Button_Normal.png"
|
||||
dest_files=[ "res://.import/Level_3_Button_Normal.png-13bd64d9d3b134bf83ed84336204422d.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=3
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=0
|
||||
process/fix_alpha_border=false
|
||||
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=false
|
||||
svg/scale=1.0
|
BIN
Levels/Level_4_Button_Normal.png
Normal file
After Width: | Height: | Size: 158 B |
35
Levels/Level_4_Button_Normal.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Level_4_Button_Normal.png-07ee7e0ee4d69f43e44a957232f5dcd0.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Levels/Level_4_Button_Normal.png"
|
||||
dest_files=[ "res://.import/Level_4_Button_Normal.png-07ee7e0ee4d69f43e44a957232f5dcd0.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=3
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=0
|
||||
process/fix_alpha_border=false
|
||||
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=false
|
||||
svg/scale=1.0
|
BIN
Levels/Level_5_Button_Normal.png
Normal file
After Width: | Height: | Size: 148 B |
35
Levels/Level_5_Button_Normal.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Level_5_Button_Normal.png-5692bf663ad3e725c957095a5773b43c.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Levels/Level_5_Button_Normal.png"
|
||||
dest_files=[ "res://.import/Level_5_Button_Normal.png-5692bf663ad3e725c957095a5773b43c.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=3
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=0
|
||||
process/fix_alpha_border=false
|
||||
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=false
|
||||
svg/scale=1.0
|
38
Main.gd
@@ -2,6 +2,7 @@ extends Node
|
||||
|
||||
export var splash_screen_path: String
|
||||
export var main_menu_path: String
|
||||
export var level_select_menu_path: String
|
||||
export var world_path: String
|
||||
|
||||
|
||||
@@ -19,7 +20,8 @@ func _ready() -> void:
|
||||
|
||||
func play_splash_screen() -> Node:
|
||||
var splash_screen: Node = load(splash_screen_path).instance()
|
||||
if splash_screen.connect('complete', self, 'free_connected_node', [splash_screen, 'free_connected_node']) != OK:
|
||||
if splash_screen.connect('complete', self, 'free_connected_node',
|
||||
[splash_screen, 'free_connected_node']) != OK:
|
||||
print('ERROR: Splash Screen "complete" signal already connected.')
|
||||
|
||||
add_child(splash_screen)
|
||||
@@ -29,7 +31,7 @@ func play_splash_screen() -> Node:
|
||||
func play_main_menu() -> Node:
|
||||
var main_menu: Node = load(main_menu_path).instance()
|
||||
if main_menu.connect('complete', self, 'main_menu_option') != OK:
|
||||
print('ERROR: Main Menu "quit" signal already connected.')
|
||||
print('ERROR: Main Menu "complete" signal already connected.')
|
||||
|
||||
add_child(main_menu)
|
||||
return main_menu
|
||||
@@ -37,12 +39,35 @@ func play_main_menu() -> Node:
|
||||
|
||||
func main_menu_option(option: String) -> void:
|
||||
if option == 'new game':
|
||||
new_game()
|
||||
var level_select_menu: Node = play_level_select_menu()
|
||||
yield(level_select_menu, 'complete')
|
||||
free_connected_node(level_select_menu, 'level_select_menu_option')
|
||||
level_select_menu = null
|
||||
elif option == 'quit':
|
||||
quit_game()
|
||||
return
|
||||
|
||||
|
||||
func play_level_select_menu() -> Node:
|
||||
var level_select_menu: Node = load(level_select_menu_path).instance()
|
||||
if level_select_menu.connect('complete', self, 'level_select_menu_option') != OK:
|
||||
print('ERROR: Level Select Menu "complete" signal already connected.')
|
||||
|
||||
add_child(level_select_menu)
|
||||
return level_select_menu
|
||||
|
||||
|
||||
func level_select_menu_option(option: String) -> void:
|
||||
var level: String = 'res://Levels/'
|
||||
if option == 'H':
|
||||
level += 'Hub World.tscn'
|
||||
elif option == '1':
|
||||
level += 'Level 1.tscn'
|
||||
|
||||
new_game(level)
|
||||
return
|
||||
|
||||
|
||||
func free_connected_node(node: Node, connected_function: String) -> void:
|
||||
node.disconnect('complete', self, connected_function)
|
||||
remove_child(node)
|
||||
@@ -50,9 +75,10 @@ func free_connected_node(node: Node, connected_function: String) -> void:
|
||||
return
|
||||
|
||||
|
||||
func new_game() -> void:
|
||||
if get_tree().change_scene(world_path) != OK:
|
||||
print('ERROR: Main failed to change scene to World.')
|
||||
func new_game(level: String) -> void:
|
||||
if get_tree().change_scene(level) != OK:
|
||||
print('ERROR: Main failed to change scene to Level.')
|
||||
queue_free()
|
||||
return
|
||||
|
||||
|
||||
|
@@ -5,9 +5,10 @@
|
||||
|
||||
[node name="Main" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
splash_screen_path = "res://Splash Screen.tscn"
|
||||
main_menu_path = "res://Main Menu.tscn"
|
||||
world_path = "res://World.tscn"
|
||||
splash_screen_path = "res://GUI/Splash Screen.tscn"
|
||||
main_menu_path = "res://GUI/Main Menu.tscn"
|
||||
level_select_menu_path = "res://GUI/Level Select Menu.tscn"
|
||||
world_path = "res://Levels/Hub World.tscn"
|
||||
|
||||
[node name="Background" type="Sprite" parent="."]
|
||||
texture = ExtResource( 3 )
|
||||
|
24
Player.gd
@@ -1,24 +0,0 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
const ACCELERATION = 1000
|
||||
const MAX_SPEED = 120
|
||||
const FRICTION = 1000
|
||||
|
||||
var velocity: Vector2 = Vector2.ZERO
|
||||
|
||||
|
||||
func _physics_process(delta) -> void:
|
||||
var input_vector: Vector2 = Vector2.ZERO
|
||||
|
||||
input_vector.x = Input.get_action_strength('player_right') - Input.get_action_strength('player_left')
|
||||
input_vector.y = Input.get_action_strength('player_down') - Input.get_action_strength('player_up')
|
||||
input_vector = input_vector.normalized()
|
||||
|
||||
if input_vector != Vector2.ZERO:
|
||||
$AnimationTree.set('parameters/Idle/blend_position', input_vector)
|
||||
velocity = velocity.move_toward(input_vector * MAX_SPEED, ACCELERATION * delta)
|
||||
else:
|
||||
velocity = velocity.move_toward(Vector2.ZERO, FRICTION * delta)
|
||||
|
||||
velocity = move_and_slide(velocity)
|
||||
return
|
45
Player/Inventory.gd
Normal file
@@ -0,0 +1,45 @@
|
||||
extends Node
|
||||
|
||||
signal update_currency(amount)
|
||||
|
||||
var __currency: int
|
||||
|
||||
var __weapons: Array
|
||||
var __accessories: Array
|
||||
var __categories: Dictionary
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
self.__currency = 100
|
||||
|
||||
self.__weapons = []
|
||||
self.__accessories = []
|
||||
self.__categories = {
|
||||
'Weapon': self.__weapons,
|
||||
'Accessory': self.__accessories}
|
||||
return
|
||||
|
||||
|
||||
func get_currency() -> int:
|
||||
return self.__currency
|
||||
|
||||
|
||||
func add_currency(amount: int) -> void:
|
||||
self.__currency += amount
|
||||
emit_signal('update_currency', self.__currency)
|
||||
return
|
||||
|
||||
|
||||
func add(item) -> void:
|
||||
self.__categories[item.type].append(item)
|
||||
return
|
||||
|
||||
|
||||
func discard(item) -> void:
|
||||
var index: int = 0
|
||||
for itr in self.__categories[item.type]:
|
||||
if itr.equals(item):
|
||||
self.__categories[item.type].remove(index)
|
||||
break
|
||||
index += 1
|
||||
return
|
6
Player/Inventory.tscn
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Player/Inventory.gd" type="Script" id=1]
|
||||
|
||||
[node name="Inventory" type="Node"]
|
||||
script = ExtResource( 1 )
|
59
Player/Player.gd
Normal file
@@ -0,0 +1,59 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
const ACCELERATION: int = 1000
|
||||
const MAX_SPEED: int = 120
|
||||
const FRICTION: int = 1000
|
||||
const HEALTH_SLICES: Array = [0, 20, 35, 50, 65, 80, 100]
|
||||
|
||||
var health_index: int = 6
|
||||
var hud: CanvasLayer = null
|
||||
var velocity: Vector2 = Vector2.ZERO
|
||||
|
||||
|
||||
func _physics_process(delta) -> void:
|
||||
var input_vector: Vector2 = Vector2.ZERO
|
||||
|
||||
input_vector.x = Input.get_action_strength('player_right') \
|
||||
- Input.get_action_strength('player_left')
|
||||
input_vector.y = Input.get_action_strength('player_down') \
|
||||
- Input.get_action_strength('player_up')
|
||||
input_vector = input_vector.normalized()
|
||||
|
||||
if input_vector != Vector2.ZERO:
|
||||
$AnimationTree.set('parameters/Idle/blend_position', input_vector)
|
||||
velocity = velocity.move_toward(input_vector * MAX_SPEED, ACCELERATION * delta)
|
||||
else:
|
||||
velocity = velocity.move_toward(Vector2.ZERO, FRICTION * delta)
|
||||
|
||||
velocity = move_and_slide(velocity)
|
||||
return
|
||||
|
||||
|
||||
func load_hud(node: CanvasLayer) -> void:
|
||||
hud = node
|
||||
if hud.connect('add_currency', self, 'add_currency') != OK:
|
||||
print('ERROR: HUD "add_currency" signal already connected.')
|
||||
|
||||
hud.update_health(HEALTH_SLICES[health_index])
|
||||
hud.update_currency($Inventory.get_currency())
|
||||
return
|
||||
|
||||
|
||||
func add_currency(amount: int) -> void:
|
||||
$Inventory.add_currency(amount)
|
||||
return
|
||||
|
||||
|
||||
func _on_Inventory_update_currency(amount: int) -> void:
|
||||
hud.update_currency(amount)
|
||||
return
|
||||
|
||||
|
||||
func _on_Hitbox_body_entered(body: Node) -> void:
|
||||
if not 'enemies' in body.get_groups():
|
||||
return
|
||||
|
||||
if health_index != 0:
|
||||
health_index -= 1
|
||||
hud.update_health(HEALTH_SLICES[health_index])
|
||||
return
|
Before Width: | Height: | Size: 173 B After Width: | Height: | Size: 173 B |
@@ -2,15 +2,15 @@
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Player.png-0662117005c6b9039deb63a286c8efe4.stex"
|
||||
path="res://.import/Player.png-3d0801c65bdfc563657cfa304115f1c7.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Player.png"
|
||||
dest_files=[ "res://.import/Player.png-0662117005c6b9039deb63a286c8efe4.stex" ]
|
||||
source_file="res://Player/Player.png"
|
||||
dest_files=[ "res://.import/Player.png-3d0801c65bdfc563657cfa304115f1c7.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=false
|
||||
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=false
|
@@ -1,9 +1,10 @@
|
||||
[gd_scene load_steps=19 format=2]
|
||||
[gd_scene load_steps=20 format=2]
|
||||
|
||||
[ext_resource path="res://Player.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Sprites/Player.png" type="Texture" id=2]
|
||||
[ext_resource path="res://Sprites/Player_Down.png" type="Texture" id=3]
|
||||
[ext_resource path="res://Sprites/Player_Up.png" type="Texture" id=4]
|
||||
[ext_resource path="res://Player/Player.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Player/Player.png" type="Texture" id=2]
|
||||
[ext_resource path="res://Player/Player_Down.png" type="Texture" id=3]
|
||||
[ext_resource path="res://Player/Player_Up.png" type="Texture" id=4]
|
||||
[ext_resource path="res://Player/Inventory.tscn" type="PackedScene" id=5]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
animations = [ {
|
||||
@@ -14,12 +15,12 @@ animations = [ {
|
||||
}, {
|
||||
"frames": [ ExtResource( 2 ) ],
|
||||
"loop": false,
|
||||
"name": "look_right",
|
||||
"name": "look_left",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 2 ) ],
|
||||
"loop": false,
|
||||
"name": "look_left",
|
||||
"name": "look_right",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 3 ) ],
|
||||
@@ -192,7 +193,9 @@ visible = false
|
||||
rotation = 1.5708
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Hitbox" type="CollisionShape2D" parent="."]
|
||||
[node name="Hitbox" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
|
||||
visible = false
|
||||
position = Vector2( 0, -5 )
|
||||
shape = SubResource( 3 )
|
||||
@@ -210,3 +213,8 @@ anim_player = NodePath("../AnimationPlayer")
|
||||
active = true
|
||||
parameters/playback = SubResource( 14 )
|
||||
parameters/Idle/blend_position = Vector2( 0.993787, 0.0189655 )
|
||||
|
||||
[node name="Inventory" parent="." instance=ExtResource( 5 )]
|
||||
|
||||
[connection signal="body_entered" from="Hitbox" to="." method="_on_Hitbox_body_entered"]
|
||||
[connection signal="update_currency" from="Inventory" to="." method="_on_Inventory_update_currency"]
|
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 183 B |
35
Player/Player_Down.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Player_Down.png-0720a85ec5e36101f691c750d323946c.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Player/Player_Down.png"
|
||||
dest_files=[ "res://.import/Player_Down.png-0720a85ec5e36101f691c750d323946c.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=3
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=0
|
||||
process/fix_alpha_border=false
|
||||
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=false
|
||||
svg/scale=1.0
|
Before Width: | Height: | Size: 175 B After Width: | Height: | Size: 175 B |
@@ -2,15 +2,15 @@
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Player_Up.png-3bef5e9a80b83b2419123f6e36070755.stex"
|
||||
path="res://.import/Player_Up.png-889a827868f4dc454da2bef028bdec76.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Player_Up.png"
|
||||
dest_files=[ "res://.import/Player_Up.png-3bef5e9a80b83b2419123f6e36070755.stex" ]
|
||||
source_file="res://Player/Player_Up.png"
|
||||
dest_files=[ "res://.import/Player_Up.png-889a827868f4dc454da2bef028bdec76.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=false
|
||||
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=false
|
BIN
Sprites/Enemy.png
Normal file
After Width: | Height: | Size: 141 B |
@@ -2,15 +2,15 @@
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Player_Down.png-6af5789aad25d026ca2bc30eb096b98e.stex"
|
||||
path="res://.import/Enemy.png-4f2f37ccc9d782f4030225b9d1bff284.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Player_Down.png"
|
||||
dest_files=[ "res://.import/Player_Down.png-6af5789aad25d026ca2bc30eb096b98e.stex" ]
|
||||
source_file="res://Sprites/Enemy.png"
|
||||
dest_files=[ "res://.import/Enemy.png-4f2f37ccc9d782f4030225b9d1bff284.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
@@ -28,6 +28,7 @@ process/fix_alpha_border=false
|
||||
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=false
|
BIN
Sprites/Health_Bar_Over.png
Normal file
After Width: | Height: | Size: 138 B |
35
Sprites/Health_Bar_Over.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Health_Bar_Over.png-eb296b5f718c04ea700ee8c8b642b2c2.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Health_Bar_Over.png"
|
||||
dest_files=[ "res://.import/Health_Bar_Over.png-eb296b5f718c04ea700ee8c8b642b2c2.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=3
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=0
|
||||
process/fix_alpha_border=false
|
||||
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=false
|
||||
svg/scale=1.0
|
BIN
Sprites/Health_Bar_Progress.png
Normal file
After Width: | Height: | Size: 83 B |
35
Sprites/Health_Bar_Progress.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Health_Bar_Progress.png-117323bbc852614a5961413bb8cfea0f.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Health_Bar_Progress.png"
|
||||
dest_files=[ "res://.import/Health_Bar_Progress.png-117323bbc852614a5961413bb8cfea0f.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=3
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=0
|
||||
process/fix_alpha_border=false
|
||||
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=false
|
||||
svg/scale=1.0
|
BIN
Sprites/Health_Bar_Under.png
Normal file
After Width: | Height: | Size: 83 B |
35
Sprites/Health_Bar_Under.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Health_Bar_Under.png-6cd4d04ee9e2525df9d3281f17cae308.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Health_Bar_Under.png"
|
||||
dest_files=[ "res://.import/Health_Bar_Under.png-6cd4d04ee9e2525df9d3281f17cae308.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=3
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=0
|
||||
process/fix_alpha_border=false
|
||||
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=false
|
||||
svg/scale=1.0
|
12
World.tscn
@@ -1,12 +0,0 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Player.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://World.gd" type="Script" id=2]
|
||||
|
||||
[node name="World" type="Node2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="YSort" type="YSort" parent="."]
|
||||
|
||||
[node name="Player" parent="YSort" instance=ExtResource( 1 )]
|
||||
collision_mask = 2
|
@@ -12,6 +12,7 @@ config_version=4
|
||||
|
||||
config/name="Embodiment"
|
||||
run/main_scene="res://Main.tscn"
|
||||
run/delta_sync_after_draw=true
|
||||
boot_splash/image="res://Sprites/Black_Background.png"
|
||||
boot_splash/use_filter=false
|
||||
boot_splash/bg_color=Color( 0, 0, 0, 1 )
|
||||
@@ -30,22 +31,22 @@ window/stretch/aspect="keep"
|
||||
|
||||
player_right={
|
||||
"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":68,"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":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
player_left={
|
||||
"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":65,"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":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
player_up={
|
||||
"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":87,"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":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
player_down={
|
||||
"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":83,"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":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
|