Implementing HUD & Changing HUD Style

This commit is contained in:
Jasmine
2021-11-23 23:24:48 -06:00
parent d6af0df27c
commit 74bb8d4b0a
40 changed files with 1086 additions and 211 deletions

BIN
Door.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

34
Door.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Door.png-69503ba9367bcfa2ab8de46ca34fdb85.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Door.png"
dest_files=[ "res://.import/Door.png-69503ba9367bcfa2ab8de46ca34fdb85.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=false
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
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@@ -2,66 +2,178 @@
[ext_resource path="res://NightBorne.png" type="Texture" id=1]
[sub_resource type="AtlasTexture" id=50]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 80, 80 )
[sub_resource type="AtlasTexture" id=51]
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 1 )
region = Rect2( 80, 0, 80, 80 )
[sub_resource type="AtlasTexture" id=52]
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 1 )
region = Rect2( 160, 0, 80, 80 )
[sub_resource type="AtlasTexture" id=53]
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 1 )
region = Rect2( 240, 0, 80, 80 )
[sub_resource type="AtlasTexture" id=54]
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 1 )
region = Rect2( 320, 0, 80, 80 )
[sub_resource type="AtlasTexture" id=55]
[sub_resource type="AtlasTexture" id=6]
atlas = ExtResource( 1 )
region = Rect2( 400, 0, 80, 80 )
[sub_resource type="AtlasTexture" id=56]
[sub_resource type="AtlasTexture" id=7]
atlas = ExtResource( 1 )
region = Rect2( 480, 0, 80, 80 )
[sub_resource type="AtlasTexture" id=57]
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 1 )
region = Rect2( 560, 0, 80, 80 )
[sub_resource type="AtlasTexture" id=58]
[sub_resource type="AtlasTexture" id=9]
atlas = ExtResource( 1 )
region = Rect2( 640, 0, 80, 80 )
[sub_resource type="AtlasTexture" id=59]
[sub_resource type="AtlasTexture" id=10]
atlas = ExtResource( 1 )
region = Rect2( 0, 80, 80, 80 )
[sub_resource type="AtlasTexture" id=60]
[sub_resource type="AtlasTexture" id=11]
atlas = ExtResource( 1 )
region = Rect2( 80, 80, 80, 80 )
[sub_resource type="AtlasTexture" id=61]
[sub_resource type="AtlasTexture" id=12]
atlas = ExtResource( 1 )
region = Rect2( 160, 80, 80, 80 )
[sub_resource type="AtlasTexture" id=62]
[sub_resource type="AtlasTexture" id=13]
atlas = ExtResource( 1 )
region = Rect2( 240, 80, 80, 80 )
[sub_resource type="AtlasTexture" id=63]
[sub_resource type="AtlasTexture" id=14]
atlas = ExtResource( 1 )
region = Rect2( 320, 80, 80, 80 )
[sub_resource type="AtlasTexture" id=64]
[sub_resource type="AtlasTexture" id=15]
atlas = ExtResource( 1 )
region = Rect2( 400, 80, 80, 80 )
[sub_resource type="AtlasTexture" id=16]
atlas = ExtResource( 1 )
region = Rect2( 80, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=17]
atlas = ExtResource( 1 )
region = Rect2( 160, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=18]
atlas = ExtResource( 1 )
region = Rect2( 240, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=19]
atlas = ExtResource( 1 )
region = Rect2( 320, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=20]
atlas = ExtResource( 1 )
region = Rect2( 400, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=21]
atlas = ExtResource( 1 )
region = Rect2( 0, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=22]
atlas = ExtResource( 1 )
region = Rect2( 80, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=23]
atlas = ExtResource( 1 )
region = Rect2( 160, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=24]
atlas = ExtResource( 1 )
region = Rect2( 240, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=25]
atlas = ExtResource( 1 )
region = Rect2( 320, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=26]
atlas = ExtResource( 1 )
region = Rect2( 400, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=27]
atlas = ExtResource( 1 )
region = Rect2( 480, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=28]
atlas = ExtResource( 1 )
region = Rect2( 560, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=29]
atlas = ExtResource( 1 )
region = Rect2( 640, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=30]
atlas = ExtResource( 1 )
region = Rect2( 720, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=31]
atlas = ExtResource( 1 )
region = Rect2( 800, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=32]
atlas = ExtResource( 1 )
region = Rect2( 880, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=33]
atlas = ExtResource( 1 )
region = Rect2( 960, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=34]
atlas = ExtResource( 1 )
region = Rect2( 1040, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=35]
atlas = ExtResource( 1 )
region = Rect2( 1120, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=36]
atlas = ExtResource( 1 )
region = Rect2( 1200, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=37]
atlas = ExtResource( 1 )
region = Rect2( 1280, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=38]
atlas = ExtResource( 1 )
region = Rect2( 1360, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=39]
atlas = ExtResource( 1 )
region = Rect2( 1440, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=40]
atlas = ExtResource( 1 )
region = Rect2( 1520, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=41]
atlas = ExtResource( 1 )
region = Rect2( 1600, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=42]
atlas = ExtResource( 1 )
region = Rect2( 1680, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=43]
atlas = ExtResource( 1 )
region = Rect2( 0, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=44]
atlas = ExtResource( 1 )
region = Rect2( 480, 160, 80, 80 )
@@ -86,168 +198,56 @@ region = Rect2( 800, 160, 80, 80 )
atlas = ExtResource( 1 )
region = Rect2( 880, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=65]
[sub_resource type="AtlasTexture" id=50]
atlas = ExtResource( 1 )
region = Rect2( 480, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=66]
[sub_resource type="AtlasTexture" id=51]
atlas = ExtResource( 1 )
region = Rect2( 560, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=67]
[sub_resource type="AtlasTexture" id=52]
atlas = ExtResource( 1 )
region = Rect2( 640, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=68]
[sub_resource type="AtlasTexture" id=53]
atlas = ExtResource( 1 )
region = Rect2( 720, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=69]
[sub_resource type="AtlasTexture" id=54]
atlas = ExtResource( 1 )
region = Rect2( 800, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=70]
[sub_resource type="AtlasTexture" id=55]
atlas = ExtResource( 1 )
region = Rect2( 880, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=71]
atlas = ExtResource( 1 )
region = Rect2( 0, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=72]
atlas = ExtResource( 1 )
region = Rect2( 80, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=73]
atlas = ExtResource( 1 )
region = Rect2( 160, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=74]
atlas = ExtResource( 1 )
region = Rect2( 240, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=75]
atlas = ExtResource( 1 )
region = Rect2( 320, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=76]
atlas = ExtResource( 1 )
region = Rect2( 400, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=77]
atlas = ExtResource( 1 )
region = Rect2( 480, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=78]
atlas = ExtResource( 1 )
region = Rect2( 560, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=79]
atlas = ExtResource( 1 )
region = Rect2( 640, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=80]
atlas = ExtResource( 1 )
region = Rect2( 720, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=81]
atlas = ExtResource( 1 )
region = Rect2( 800, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=82]
atlas = ExtResource( 1 )
region = Rect2( 880, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=83]
atlas = ExtResource( 1 )
region = Rect2( 960, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=84]
atlas = ExtResource( 1 )
region = Rect2( 1040, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=85]
atlas = ExtResource( 1 )
region = Rect2( 1120, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=86]
atlas = ExtResource( 1 )
region = Rect2( 1200, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=87]
atlas = ExtResource( 1 )
region = Rect2( 1280, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=88]
atlas = ExtResource( 1 )
region = Rect2( 1360, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=89]
atlas = ExtResource( 1 )
region = Rect2( 1440, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=90]
atlas = ExtResource( 1 )
region = Rect2( 1520, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=91]
atlas = ExtResource( 1 )
region = Rect2( 1600, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=92]
atlas = ExtResource( 1 )
region = Rect2( 1680, 320, 80, 80 )
[sub_resource type="AtlasTexture" id=38]
atlas = ExtResource( 1 )
region = Rect2( 0, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=39]
atlas = ExtResource( 1 )
region = Rect2( 80, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=40]
atlas = ExtResource( 1 )
region = Rect2( 160, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=41]
atlas = ExtResource( 1 )
region = Rect2( 240, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=42]
atlas = ExtResource( 1 )
region = Rect2( 320, 160, 80, 80 )
[sub_resource type="AtlasTexture" id=43]
atlas = ExtResource( 1 )
region = Rect2( 400, 160, 80, 80 )
[sub_resource type="SpriteFrames" id=93]
[sub_resource type="SpriteFrames" id=56]
animations = [ {
"frames": [ SubResource( 50 ), SubResource( 51 ), SubResource( 52 ), SubResource( 53 ), SubResource( 54 ), SubResource( 55 ), SubResource( 56 ), SubResource( 57 ), SubResource( 58 ) ],
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ) ],
"loop": true,
"name": "idle",
"speed": 10.0
}, {
"frames": [ SubResource( 59 ), SubResource( 60 ), SubResource( 61 ), SubResource( 62 ), SubResource( 63 ), SubResource( 64 ) ],
"frames": [ SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ) ],
"loop": true,
"name": "running",
"speed": 10.0
}, {
"frames": [ SubResource( 44 ), SubResource( 45 ), SubResource( 46 ), SubResource( 47 ), SubResource( 48 ), SubResource( 49 ), SubResource( 65 ), SubResource( 66 ), SubResource( 67 ), SubResource( 68 ), SubResource( 69 ), SubResource( 70 ) ],
"frames": [ SubResource( 16 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ) ],
"loop": true,
"name": "attack",
"speed": 10.0
"name": "hurt",
"speed": 5.0
}, {
"frames": [ SubResource( 71 ), SubResource( 72 ), SubResource( 73 ), SubResource( 74 ), SubResource( 75 ), SubResource( 76 ), SubResource( 77 ), SubResource( 78 ), SubResource( 79 ), SubResource( 80 ), SubResource( 81 ), SubResource( 82 ), SubResource( 83 ), SubResource( 84 ), SubResource( 85 ), SubResource( 86 ), SubResource( 87 ), SubResource( 88 ), SubResource( 89 ), SubResource( 90 ), SubResource( 91 ), SubResource( 92 ), SubResource( 38 ) ],
"frames": [ SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ), SubResource( 25 ), SubResource( 26 ), SubResource( 27 ), SubResource( 28 ), SubResource( 29 ), SubResource( 30 ), SubResource( 31 ), SubResource( 32 ), SubResource( 33 ), SubResource( 34 ), SubResource( 35 ), SubResource( 36 ), SubResource( 37 ), SubResource( 38 ), SubResource( 39 ), SubResource( 40 ), SubResource( 41 ), SubResource( 42 ), SubResource( 43 ) ],
"loop": true,
"name": "death",
"speed": 10.0
}, {
"frames": [ SubResource( 39 ), SubResource( 40 ), SubResource( 41 ), SubResource( 42 ), SubResource( 43 ) ],
"frames": [ SubResource( 44 ), SubResource( 45 ), SubResource( 46 ), SubResource( 47 ), SubResource( 48 ), SubResource( 49 ), SubResource( 50 ), SubResource( 51 ), SubResource( 52 ), SubResource( 53 ), SubResource( 54 ), SubResource( 55 ) ],
"loop": true,
"name": "hurt",
"speed": 5.0
"name": "attack",
"speed": 10.0
} ]
[node name="Node2D" type="KinematicBody2D"]
@@ -255,7 +255,7 @@ animations = [ {
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
frames = SubResource( 93 )
frames = SubResource( 56 )
animation = "idle"
frame = 6
frame = 4
playing = true

75
HUD.gd Normal file
View File

@@ -0,0 +1,75 @@
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
func _on_weapon_slot_pressed() -> void:
$'Weapon Selection'.set_visible(not $'Weapon Selection'.visible)
return
func _on_select_bow_pressed() -> void:
$'Weapon Selection/Bow'.set_visible(false)
$'Equipped Weapon/Weapon'.set_normal_texture(
$'Weapon Selection/Bow/Weapon'.get_normal_texture())
$'Weapon Selection/Javelin'.set_visible(true)
$'Weapon Selection/Staff'.set_visible(true)
$'Weapon Selection/Sword'.set_visible(true)
$'Weapon Selection'.set_visible(false)
return
func _on_select_javelin_pressed() -> void:
$'Weapon Selection/Javelin'.set_visible(false)
$'Equipped Weapon/Weapon'.set_normal_texture(
$'Weapon Selection/Javelin/Weapon'.get_normal_texture())
$'Weapon Selection/Bow'.set_visible(true)
$'Weapon Selection/Staff'.set_visible(true)
$'Weapon Selection/Sword'.set_visible(true)
$'Weapon Selection'.set_visible(false)
return
func _on_select_staff_pressed() -> void:
$'Weapon Selection/Staff'.set_visible(false)
$'Equipped Weapon/Weapon'.set_normal_texture(
$'Weapon Selection/Staff/Weapon'.get_normal_texture())
$'Weapon Selection/Bow'.set_visible(true)
$'Weapon Selection/Javelin'.set_visible(true)
$'Weapon Selection/Sword'.set_visible(true)
$'Weapon Selection'.set_visible(false)
return
func _on_select_sword_pressed() -> void:
$'Weapon Selection/Sword'.set_visible(false)
$'Equipped Weapon/Weapon'.set_normal_texture(
$'Weapon Selection/Sword/Weapon'.get_normal_texture())
$'Weapon Selection/Bow'.set_visible(true)
$'Weapon Selection/Javelin'.set_visible(true)
$'Weapon Selection/Staff'.set_visible(true)
$'Weapon Selection'.set_visible(false)
return

172
HUD.tscn Normal file
View File

@@ -0,0 +1,172 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://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]
[ext_resource path="res://Sprites/Staff.png" type="Texture" id=5]
[ext_resource path="res://Sprites/Sword.png" type="Texture" id=6]
[ext_resource path="res://HUD_Weapon_Slot.png" type="Texture" id=7]
[ext_resource path="res://Sprites/Bow.png" type="Texture" id=8]
[ext_resource path="res://Sprites/Javelin.png" type="Texture" id=9]
[node name="HUD" type="CanvasLayer"]
script = ExtResource( 1 )
[node name="Health Bar" type="TextureProgress" parent="."]
margin_top = 1.0
margin_right = 104.0
margin_bottom = 19.0
rect_min_size = Vector2( 104, 18 )
rect_scale = Vector2( 0.75, 0.75 )
value = 50.0
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="."]
visible = false
margin_left = 300.0
margin_top = 20.0
margin_right = 320.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Equipped Weapon" type="CenterContainer" parent="."]
margin_left = 275.0
margin_top = 135.0
margin_right = 315.0
margin_bottom = 175.0
rect_min_size = Vector2( 40, 40 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Slot Background" type="TextureRect" parent="Equipped Weapon"]
margin_right = 40.0
margin_bottom = 40.0
texture = ExtResource( 7 )
[node name="Weapon" type="TextureButton" parent="Equipped Weapon"]
margin_left = 7.0
margin_top = 7.0
margin_right = 32.0
margin_bottom = 32.0
rect_min_size = Vector2( 25, 25 )
texture_normal = ExtResource( 6 )
expand = true
[node name="Weapon Selection" type="HBoxContainer" parent="."]
visible = false
margin_left = 230.0
margin_top = 135.0
margin_right = 270.0
margin_bottom = 175.0
grow_horizontal = 0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Bow" type="CenterContainer" parent="Weapon Selection"]
margin_right = 40.0
margin_bottom = 40.0
rect_min_size = Vector2( 40, 40 )
[node name="Slot Background" type="TextureRect" parent="Weapon Selection/Bow"]
margin_right = 40.0
margin_bottom = 40.0
texture = ExtResource( 7 )
[node name="Weapon" type="TextureButton" parent="Weapon Selection/Bow"]
margin_left = 7.0
margin_top = 7.0
margin_right = 32.0
margin_bottom = 32.0
rect_min_size = Vector2( 25, 25 )
texture_normal = ExtResource( 8 )
expand = true
[node name="Javelin" type="CenterContainer" parent="Weapon Selection"]
margin_left = 44.0
margin_right = 84.0
margin_bottom = 40.0
rect_min_size = Vector2( 40, 40 )
[node name="Slot Background" type="TextureRect" parent="Weapon Selection/Javelin"]
margin_right = 40.0
margin_bottom = 40.0
texture = ExtResource( 7 )
[node name="Weapon" type="TextureButton" parent="Weapon Selection/Javelin"]
margin_left = 7.0
margin_top = 7.0
margin_right = 32.0
margin_bottom = 32.0
rect_min_size = Vector2( 25, 25 )
texture_normal = ExtResource( 9 )
expand = true
[node name="Staff" type="CenterContainer" parent="Weapon Selection"]
margin_left = 88.0
margin_right = 128.0
margin_bottom = 40.0
rect_min_size = Vector2( 40, 40 )
[node name="Slot Background" type="TextureRect" parent="Weapon Selection/Staff"]
margin_right = 40.0
margin_bottom = 40.0
texture = ExtResource( 7 )
[node name="Weapon" type="TextureButton" parent="Weapon Selection/Staff"]
margin_left = 7.0
margin_top = 7.0
margin_right = 32.0
margin_bottom = 32.0
rect_min_size = Vector2( 25, 25 )
texture_normal = ExtResource( 5 )
expand = true
[node name="Sword" type="CenterContainer" parent="Weapon Selection"]
visible = false
margin_left = 132.0
margin_right = 172.0
margin_bottom = 40.0
rect_min_size = Vector2( 40, 40 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Slot Background" type="TextureRect" parent="Weapon Selection/Sword"]
margin_right = 40.0
margin_bottom = 40.0
texture = ExtResource( 7 )
[node name="Weapon" type="TextureButton" parent="Weapon Selection/Sword"]
margin_left = 7.0
margin_top = 7.0
margin_right = 32.0
margin_bottom = 32.0
rect_min_size = Vector2( 25, 25 )
texture_normal = ExtResource( 6 )
expand = true
[connection signal="pressed" from="Add Currency" to="." method="_on_Add_Currency_pressed"]
[connection signal="pressed" from="Equipped Weapon/Weapon" to="." method="_on_weapon_slot_pressed"]
[connection signal="pressed" from="Weapon Selection/Bow/Weapon" to="." method="_on_select_bow_pressed"]
[connection signal="pressed" from="Weapon Selection/Javelin/Weapon" to="." method="_on_select_javelin_pressed"]
[connection signal="pressed" from="Weapon Selection/Staff/Weapon" to="." method="_on_select_staff_pressed"]
[connection signal="pressed" from="Weapon Selection/Sword/Weapon" to="." method="_on_select_sword_pressed"]

BIN
HUD_Weapon_Slot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/HUD_Weapon_Slot.png-55420041f7240ad325b59133cce1c101.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://HUD_Weapon_Slot.png"
dest_files=[ "res://.import/HUD_Weapon_Slot.png-55420041f7240ad325b59133cce1c101.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=false
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
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View 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

View 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

BIN
Ice.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 935 B

34
Ice.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Ice.png-c8b4cdbfa14e71a25c68ce0779963d26.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Ice.png"
dest_files=[ "res://.import/Ice.png-c8b4cdbfa14e71a25c68ce0779963d26.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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

45
Inventory.gd Normal file
View 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
Inventory.tscn Normal file
View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Inventory.gd" type="Script" id=1]
[node name="Inventory" type="Node"]
script = ExtResource( 1 )

35
Javelin.png.import Normal file
View File

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

View File

@@ -51,8 +51,9 @@ func free_connected_node(node: Node, connected_function: String) -> void:
func new_game() -> void:
if get_tree().change_scene(world_path) != OK:
print('ERROR: Main failed to change scene to World.')
#if get_tree().change_scene(world_path) != OK:
# print('ERROR: Main failed to change scene to World.')
get_tree().change_scene(world_path)
return

View File

@@ -1,6 +1,9 @@
extends KinematicBody2D
const ACCELERATION = 1000
var hud: CanvasLayer = null
const HEALTH_SLICES: Array = [0, 20, 35, 50, 65, 80, 100]
var health_index: int = 6
const MAX_SPEED = 120
const FRICTION = 1000
@@ -22,3 +25,11 @@ func _physics_process(delta) -> void:
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

View File

@@ -1,20 +1,21 @@
[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://Inventory.tscn" type="PackedScene" id=5]
[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 4 ) ],
"frames": [ ExtResource( 2 ) ],
"loop": false,
"name": "look_up",
"name": "look_left",
"speed": 5.0
}, {
"frames": [ ExtResource( 2 ) ],
"loop": false,
"name": "look_left",
"name": "look_right",
"speed": 5.0
}, {
"frames": [ ExtResource( 3 ) ],
@@ -22,9 +23,9 @@ animations = [ {
"name": "look_down",
"speed": 5.0
}, {
"frames": [ ExtResource( 2 ) ],
"frames": [ ExtResource( 4 ) ],
"loop": false,
"name": "look_right",
"name": "look_up",
"speed": 5.0
} ]
@@ -146,26 +147,26 @@ tracks/1/keys = {
"values": [ false ]
}
[sub_resource type="AnimationNodeAnimation" id=15]
[sub_resource type="AnimationNodeAnimation" id=8]
animation = "Look Left"
[sub_resource type="AnimationNodeAnimation" id=16]
[sub_resource type="AnimationNodeAnimation" id=9]
animation = "Look Down"
[sub_resource type="AnimationNodeAnimation" id=17]
[sub_resource type="AnimationNodeAnimation" id=10]
animation = "Look Right"
[sub_resource type="AnimationNodeAnimation" id=18]
[sub_resource type="AnimationNodeAnimation" id=11]
animation = "Look Up"
[sub_resource type="AnimationNodeBlendSpace2D" id=12]
blend_point_0/node = SubResource( 15 )
blend_point_0/node = SubResource( 8 )
blend_point_0/pos = Vector2( -1.01, 0 )
blend_point_1/node = SubResource( 16 )
blend_point_1/node = SubResource( 9 )
blend_point_1/pos = Vector2( 0, 1.1 )
blend_point_2/node = SubResource( 17 )
blend_point_2/node = SubResource( 10 )
blend_point_2/pos = Vector2( 1, 0 )
blend_point_3/node = SubResource( 18 )
blend_point_3/node = SubResource( 11 )
blend_point_3/pos = Vector2( 0, -1.1 )
min_space = Vector2( -1.01, -1.1 )
max_space = Vector2( 1, 1.1 )
@@ -210,3 +211,5 @@ 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 )]

BIN
Sprites/Bow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

34
Sprites/Bow.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Bow.png-2e372c0098797d6106e6e3767417e1ac.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/Bow.png"
dest_files=[ "res://.import/Bow.png-2e372c0098797d6106e6e3767417e1ac.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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
Sprites/Health_Bar_Over.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

View File

@@ -0,0 +1,34 @@
[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=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
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
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

View File

@@ -0,0 +1,34 @@
[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=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
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
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

View File

@@ -0,0 +1,34 @@
[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=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
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
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

BIN
Sprites/Javelin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Javelin.png-bf9f385141fd8df71540678491f44dbb.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/Javelin.png"
dest_files=[ "res://.import/Javelin.png-bf9f385141fd8df71540678491f44dbb.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
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

BIN
Sprites/Staff.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

34
Sprites/Staff.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Staff.png-fa42f43f1fe514a082f4f7fb2db50691.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/Staff.png"
dest_files=[ "res://.import/Staff.png-fa42f43f1fe514a082f4f7fb2db50691.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
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

BIN
Sprites/Sword.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

34
Sprites/Sword.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Sword.png-f1264e53af856562d5148b82ddb3fd18.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/Sword.png"
dest_files=[ "res://.import/Sword.png-f1264e53af856562d5148b82ddb3fd18.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=2
process/fix_alpha_border=false
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

BIN
Sprites/coin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

34
Sprites/coin.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/coin.png-b7fabe76c61e67396a7c0402e221b540.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/coin.png"
dest_files=[ "res://.import/coin.png-b7fabe76c61e67396a7c0402e221b540.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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

35
Staff.png.import Normal file
View File

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

35
Sword.png.import Normal file
View File

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

View File

@@ -2,4 +2,5 @@ extends Node2D
func _ready() -> void:
$YSort/Player.position = get_viewport_rect().size / 2
$YSort/Player.load_hud($HUD)
return

File diff suppressed because one or more lines are too long

View File

@@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
@@ -30,5 +30,5 @@ process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
detect_3d=false
svg/scale=1.0

View File

@@ -8,7 +8,6 @@ extents = Vector2( 13, 10 )
[node name="forestHouse" type="Node2D"]
[node name="Sprite" type="Sprite" parent="."]
modulate = Color( 0.823529, 0.34902, 0.32549, 1 )
texture = ExtResource( 1 )
offset = Vector2( 0, -8 )

View File

@@ -30,22 +30,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,"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":68,"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,"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":65,"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,"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":87,"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,"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":83,"unicode":0,"echo":false,"script":null)
]
}