Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#88 Inventory system #94

Merged
merged 49 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
96e3bed
Added inventory manager
JonaLam Apr 10, 2024
dd5c276
Gold component
JonaLam Apr 10, 2024
6db1280
Hud
JonaLam Apr 10, 2024
b3077ce
InventoryManger and components updated
JonaLam Apr 15, 2024
74fe574
Inventory tester and HUD
JonaLam Apr 15, 2024
8256cb6
Added reset function
JonaLam Apr 15, 2024
cee1d82
Moved files for clenlyness
JonaLam Apr 15, 2024
a258c98
Added TODO comments to unfinished functions in Consumable and Relic s…
JonaLam Apr 15, 2024
6c2c496
Fixed problems relating to moving files
JonaLam Apr 15, 2024
20bbb0f
Delete InventoryTester.gd
JonaLam Apr 16, 2024
b541e2b
Updated naming around consumable components
JonaLam Apr 16, 2024
b269250
Update TestingScene.tscn
JonaLam Apr 16, 2024
02554d4
Update InventoryRelicComponent.gd
JonaLam Apr 16, 2024
c53e022
Update InventoryConsumablesComponent.gd
JonaLam Apr 16, 2024
ecfcdda
Renamed functions in consumable component for clarity
JonaLam Apr 16, 2024
eee6d6f
Fixed typo in InventoryHUDConsumableSlotComponent
JonaLam Apr 16, 2024
4ba9fa1
Made function private to make less clutter
JonaLam Apr 16, 2024
07ff07b
Update ConsumableSlot.gd
JonaLam Apr 16, 2024
cb7daae
Update InventoryHUDConsumableSlotComponent.gd
JonaLam Apr 16, 2024
07520a7
Renamed Consumable_slot to make it clear what system it's for
JonaLam Apr 16, 2024
e69cbe3
Renamed various variable to fit naming conventions
JonaLam Apr 16, 2024
2f88050
Update InventoryHUD.gd
JonaLam Apr 16, 2024
753adbb
Made Debug buttons toggle able
JonaLam Apr 16, 2024
877e0f2
Renamed relic display to make it clear what system it's appart of
JonaLam Apr 16, 2024
ee0ba31
Changed how the update relic signal works
JonaLam Apr 16, 2024
f9953ee
Renamed variable in torch component
JonaLam Apr 16, 2024
2421825
Renamed functions in the various components
JonaLam Apr 16, 2024
c9a15bf
Changes to the inventory components
JonaLam Apr 16, 2024
e1ff3f8
Comented confusing code as well as made functions which aren't used i…
JonaLam Apr 16, 2024
f2a3de2
Comented confusing code
JonaLam Apr 16, 2024
9dcad69
Resolving Merge Conflicts
JonaLam Apr 18, 2024
6c33a60
Merge branch 'main' into 88#
JonaLam Apr 18, 2024
568c4af
Prevent the game from crashing
JonaLam Apr 18, 2024
5c43bae
Renamed art assets to fit naming convention
JonaLam Apr 18, 2024
59c9afe
DEBUG_VAR
JonaLam Apr 20, 2024
c88740e
Update InventoryHudRelicComponent.gd
JonaLam Apr 20, 2024
57caee6
Fixed typos and misformating in comments
JonaLam Apr 20, 2024
9eb5443
Update InventoryConsumablesComponent.gd
JonaLam Apr 20, 2024
69debc4
Turn debug_var to false
JonaLam Apr 20, 2024
6812d41
Changed names of signals
JonaLam Apr 20, 2024
d50dd34
Create test_inventory.gd
JonaLam Apr 20, 2024
f6ff277
Merge branch 'main' into 88#
JonaLam Apr 23, 2024
d83954a
Added limit to prevent negative numbers
JonaLam Apr 23, 2024
18881c7
Added more relics for testing
JonaLam Apr 23, 2024
c57652b
Small fixes
JonaLam Apr 23, 2024
fc5c657
Add warnings if gold or torches go bellow 0
JonaLam Apr 23, 2024
3d02edc
Fixed some comments
JonaLam Apr 23, 2024
4cbd492
fixed typos
JonaLam Apr 23, 2024
13eb07f
typo
JonaLam Apr 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
221 changes: 221 additions & 0 deletions #Scenes/Tes281A.tmp
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
[gd_scene load_steps=19 format=3 uid="uid://b60uabg68ra1l"]

[ext_resource type="Script" path="res://#Scenes/SceneScripts/TestingScene.gd" id="1_ji0t8"]
[ext_resource type="Script" path="res://Map/MapManager.gd" id="2_50npk"]
[ext_resource type="PackedScene" uid="uid://clmg3l3n28x38" path="res://Entity/Player/Player.tscn" id="3_4psp7"]
[ext_resource type="PackedScene" uid="uid://dpjfy4pv0vxst" path="res://Cards/CardContainer.tscn" id="3_e7sws"]
[ext_resource type="Script" path="res://#Scenes/SceneScripts/TestingScene_UIcontrol.gd" id="4_h8431"]
[ext_resource type="PackedScene" uid="uid://bcpmrmofcilbn" path="res://Core/Battler.tscn" id="8_qtw1k"]
[ext_resource type="Script" path="res://UI/DrawPileUISetter.gd" id="8_voref"]
[ext_resource type="Script" path="res://UI/DiscardPileUISetter.gd" id="10_pqly7"]
[ext_resource type="Texture2D" uid="uid://caemucaya30wh" path="res://Art/Card_layout/draw_pile.png" id="11_pw70x"]
[ext_resource type="Texture2D" uid="uid://d4muqvs3etnr8" path="res://Art/Card_layout/discard_pile.png" id="12_kxw48"]
[ext_resource type="Script" path="res://UI/EndTurnButton.gd" id="14_dpe64"]
[ext_resource type="Script" path="res://UI/EnergyLabel.gd" id="14_nckre"]
[ext_resource type="Texture2D" uid="uid://hqkt8t1v2f5h" path="res://Art/Card_layout/deck_pile.png" id="18_b54hn"]
[ext_resource type="Script" path="res://#Scenes/InventoryTester.gd" id="18_duj0f"]
[ext_resource type="Texture2D" uid="uid://bl5v3bgnntoc5" path="res://Art/Card_layout/energy_count.png" id="19_spyxg"]
[ext_resource type="Script" path="res://UI/DeckPileUISetter.gd" id="19_ucc6f"]
[ext_resource type="Texture2D" uid="uid://cjlatwiw7r80d" path="res://Art/Map/icon.png" id="20_tiho6"]
[ext_resource type="Script" path="res://UI/MapButton.gd" id="22_druf4"]

[node name="TestingScene" type="Node2D"]
script = ExtResource("1_ji0t8")
metadata/_edit_vertical_guides_ = [1216.0]

[node name="Battler" parent="." instance=ExtResource("8_qtw1k")]

[node name="TestMap" type="Node2D" parent="."]
script = ExtResource("2_50npk")

[node name="Player" parent="." instance=ExtResource("3_4psp7")]
position = Vector2(595, 284)

[node name="CanvasLayer" type="CanvasLayer" parent="."]

[node name="UIControl" type="Control" parent="CanvasLayer"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
script = ExtResource("4_h8431")

[node name="CardContainer" parent="CanvasLayer/UIControl" node_paths=PackedStringArray("draw_pile_ui", "discard_pile_ui") instance=ExtResource("3_e7sws")]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 0
starting_hand_size = 10
max_hand_width = 900.0
min_card_separation = 90.0
max_card_separation = 120.0
hover_offset_max = 100.0
max_rotation = 40.0
draw_pile_ui = NodePath("../DrawPile")
discard_pile_ui = NodePath("../DiscardPile")
play_at_height = 500.0

[node name="EndTurnButton" type="Button" parent="CanvasLayer/UIControl"]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -145.0
offset_top = -141.0
offset_right = -35.0
offset_bottom = -109.0
grow_horizontal = 0
grow_vertical = 0
text = "end turn"
script = ExtResource("14_dpe64")

[node name="TextureRect" type="TextureRect" parent="CanvasLayer/UIControl"]
layout_mode = 1
anchors_preset = -1
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 17.0
offset_top = -159.0
offset_right = 257.0
offset_bottom = 32.0
scale = Vector2(0.38, 0.38)
texture = ExtResource("19_spyxg")

[node name="EnergyLabel" type="Label" parent="CanvasLayer/UIControl/TextureRect"]
layout_mode = 0
offset_left = 82.1705
offset_top = 72.8682
offset_right = 92.1705
offset_bottom = 95.8682
scale = Vector2(3.93058, 3.1094)
text = "0"
horizontal_alignment = 1
vertical_alignment = 1
script = ExtResource("14_nckre")

[node name="DrawPile" type="TextureButton" parent="CanvasLayer/UIControl" node_paths=PackedStringArray("pile_count_label")]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 30.0
offset_top = -69.0
offset_right = 70.0
offset_bottom = -29.0
grow_vertical = 0
texture_normal = ExtResource("11_pw70x")
texture_pressed = ExtResource("11_pw70x")
texture_hover = ExtResource("11_pw70x")
texture_disabled = ExtResource("11_pw70x")
texture_focused = ExtResource("11_pw70x")
stretch_mode = 0
script = ExtResource("8_voref")
pile_count_label = NodePath("DrawPileCount")

[node name="DrawPileCount" type="Label" parent="CanvasLayer/UIControl/DrawPile"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
text = "0"
horizontal_alignment = 1
vertical_alignment = 1

[node name="DiscardPile" type="TextureButton" parent="CanvasLayer/UIControl" node_paths=PackedStringArray("pile_count_label")]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -64.0
offset_top = -72.0
offset_right = -24.0
offset_bottom = -32.0
grow_horizontal = 0
grow_vertical = 0
texture_normal = ExtResource("12_kxw48")
texture_pressed = ExtResource("12_kxw48")
texture_hover = ExtResource("12_kxw48")
texture_disabled = ExtResource("12_kxw48")
texture_focused = ExtResource("12_kxw48")
stretch_mode = 0
script = ExtResource("10_pqly7")
pile_count_label = NodePath("DrawPileCount")

[node name="DrawPileCount" type="Label" parent="CanvasLayer/UIControl/DiscardPile"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
text = "0"
horizontal_alignment = 1
vertical_alignment = 1

[node name="DeckPile" type="TextureButton" parent="CanvasLayer/UIControl"]
layout_mode = 1
anchors_preset = -1
anchor_left = 1.00078
anchor_right = 1.00078
offset_left = -62.0
offset_top = 35.0
offset_right = -22.0
offset_bottom = 75.0
texture_normal = ExtResource("18_b54hn")
texture_pressed = ExtResource("18_b54hn")
texture_hover = ExtResource("18_b54hn")
texture_disabled = ExtResource("18_b54hn")
texture_focused = ExtResource("18_b54hn")
stretch_mode = 0
script = ExtResource("19_ucc6f")
metadata/_edit_use_anchors_ = true

[node name="MapIcon" type="TextureButton" parent="CanvasLayer/UIControl"]
layout_mode = 0
offset_left = 1174.0
offset_top = 31.0
offset_right = 1214.0
offset_bottom = 71.0
texture_normal = ExtResource("20_tiho6")
texture_pressed = ExtResource("20_tiho6")
texture_hover = ExtResource("20_tiho6")
texture_disabled = ExtResource("20_tiho6")
texture_focused = ExtResource("20_tiho6")
ignore_texture_size = true
stretch_mode = 0
script = ExtResource("22_druf4")

[node name="back_to_main_menu" type="Button" parent="CanvasLayer/UIControl"]
layout_mode = 0
offset_left = 29.0
offset_top = 22.0
offset_right = 148.0
offset_bottom = 86.0
theme_override_font_sizes/font_size = 20
text = "Go back to
main menu"

[node name="Button" type="Button" parent="."]
offset_left = 138.0
offset_top = 257.0
offset_right = 146.0
offset_bottom = 265.0
scale = Vector2(22.96, 18.44)
script = ExtResource("18_duj0f")

[connection signal="pressed" from="CanvasLayer/UIControl/EndTurnButton" to="CanvasLayer/UIControl/EndTurnButton" method="_on_pressed"]
[connection signal="pressed" from="CanvasLayer/UIControl/back_to_main_menu" to="CanvasLayer/UIControl" method="_on_back_to_main_menu_pressed"]
[connection signal="pressed" from="Button" to="Button" method="_on_pressed"]
28 changes: 27 additions & 1 deletion #Scenes/TestingScene.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=3 uid="uid://b60uabg68ra1l"]
[gd_scene load_steps=20 format=3 uid="uid://b60uabg68ra1l"]

[ext_resource type="Script" path="res://#Scenes/SceneScripts/TestingScene.gd" id="1_ji0t8"]
[ext_resource type="Script" path="res://Managers/MapManager.gd" id="2_50npk"]
Expand All @@ -13,11 +13,24 @@
[ext_resource type="Script" path="res://UI/EndTurnButton.gd" id="14_dpe64"]
[ext_resource type="Script" path="res://UI/EnergyLabel.gd" id="14_nckre"]
[ext_resource type="Texture2D" uid="uid://hqkt8t1v2f5h" path="res://Art/Card_layout/deck_pile.png" id="18_b54hn"]
[ext_resource type="Resource" uid="uid://c5fh7bnfh3l4u" path="res://Items/test_relic.tres" id="19_prw12"]
[ext_resource type="Texture2D" uid="uid://bl5v3bgnntoc5" path="res://Art/Card_layout/energy_count.png" id="19_spyxg"]
[ext_resource type="Script" path="res://UI/DeckPileUISetter.gd" id="19_ucc6f"]
[ext_resource type="Texture2D" uid="uid://cjlatwiw7r80d" path="res://Art/Map/icon.png" id="20_tiho6"]
[ext_resource type="Script" path="res://UI/MapButton.gd" id="22_druf4"]

[sub_resource type="GDScript" id="GDScript_g5yv1"]
script/source = "extends Button

@export var con : Relic


func _on_pressed() -> void:
InventoryManager.toggle_inventory_HUD()
pass # Replace with function body.

"

[node name="TestingScene" type="Node2D"]
script = ExtResource("1_ji0t8")
metadata/_edit_vertical_guides_ = [1216.0]
Expand Down Expand Up @@ -207,5 +220,18 @@ theme_override_font_sizes/font_size = 20
text = "Go back to
main menu"

[node name="Button" type="Button" parent="."]
offset_left = 30.0
offset_top = 108.0
offset_right = 436.0
offset_bottom = 204.0
scale = Vector2(0.308897, 0.681828)
theme_override_font_sizes/font_size = 31
text = "Toggle
Inventory HUD"
script = SubResource("GDScript_g5yv1")
con = ExtResource("19_prw12")

[connection signal="pressed" from="CanvasLayer/UIControl/EndTurnButton" to="CanvasLayer/UIControl/EndTurnButton" method="_on_pressed"]
[connection signal="pressed" from="CanvasLayer/UIControl/back_to_main_menu" to="CanvasLayer/UIControl" method="_on_back_to_main_menu_pressed"]
[connection signal="pressed" from="Button" to="Button" method="_on_pressed"]
2 changes: 1 addition & 1 deletion .gut_editor_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
"suffix": ".gd",
"tests": [],
"unit_test_name": null
}
}
Binary file added Art/Items/consumable-empty_consumable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Art/Items/consumable-empty_consumable.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://cdax6fkgolhd2"
path="res://.godot/imported/consumable-empty_consumable.png-99a0f375ce31ffa233dae50c35220663.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Art/Items/consumable-empty_consumable.png"
dest_files=["res://.godot/imported/consumable-empty_consumable.png-99a0f375ce31ffa233dae50c35220663.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file added Art/Items/consumable-golden_apple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Art/Items/consumable-golden_apple.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dsg6gvseaw6b5"
path="res://.godot/imported/consumable-golden_apple.png-b93d3ddc99771760aac9e76868d95114.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Art/Items/consumable-golden_apple.png"
dest_files=["res://.godot/imported/consumable-golden_apple.png-b93d3ddc99771760aac9e76868d95114.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
4 changes: 2 additions & 2 deletions Cards/CardSets/DefaultDeck.tres
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[ext_resource type="Script" path="res://Cards/CardSetBase.gd" id="1_pnxc0"]
[ext_resource type="Resource" uid="uid://dam752rc15nu5" path="res://Cards/Resource/Card_Buff_Poison_Duration.tres" id="1_to4gc"]
[ext_resource type="Resource" uid="uid://dxgoopi1roxu4" path="res://Cards/Resource/Card_Damage.tres" id="2_q7qqo"]
[ext_resource type="Resource" uid="uid://0x385c3nuq8f" path="res://Cards/Resource/Card_DamageAllEnemies.tres" id="3_v5ynn"]
[ext_resource type="Resource" uid="uid://0x385c3nuq8f" path="res://Cards/Resource/Card_DamageAllEnemies.tres" id="3_4ka0y"]
[ext_resource type="Resource" uid="uid://boodcfdepyk5i" path="res://Cards/Resource/Card_DamageHealth.tres" id="4_es3ma"]
[ext_resource type="Resource" uid="uid://3s4aet1ciesh" path="res://Cards/Resource/Card_damage_and_poison.tres" id="5_giy28"]
[ext_resource type="Resource" uid="uid://uv2rili0xf3x" path="res://Cards/Resource/Card_Damage_EVERYTHING.tres" id="6_gr534"]
Expand All @@ -20,4 +20,4 @@

[resource]
script = ExtResource("1_pnxc0")
card_set = Array[Resource("res://Cards/CardBase.gd")]([ExtResource("1_to4gc"), ExtResource("2_q7qqo"), ExtResource("3_v5ynn"), ExtResource("4_es3ma"), ExtResource("5_giy28"), ExtResource("6_gr534"), ExtResource("7_y1gya"), ExtResource("8_haia1"), ExtResource("9_1tkbv"), ExtResource("10_7m46u"), ExtResource("11_0eivv"), ExtResource("12_lo5f6"), ExtResource("13_v3qs7"), ExtResource("14_ghttq"), ExtResource("15_ie3pe"), ExtResource("16_jluts")])
card_set = Array[Resource("res://Cards/CardBase.gd")]([ExtResource("1_to4gc"), ExtResource("2_q7qqo"), ExtResource("3_4ka0y"), ExtResource("4_es3ma"), ExtResource("5_giy28"), ExtResource("6_gr534"), ExtResource("7_y1gya"), ExtResource("8_haia1"), ExtResource("9_1tkbv"), ExtResource("10_7m46u"), ExtResource("11_0eivv"), ExtResource("12_lo5f6"), ExtResource("13_v3qs7"), ExtResource("14_ghttq"), ExtResource("15_ie3pe"), ExtResource("16_jluts")])
7 changes: 6 additions & 1 deletion Global/DEBUG_VAR.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ extends Node
## Player can move freely on the map without having to finish the current event or move in the range of its normal movement
const DEBUG_FREE_MOVEMENT: bool = false

## Allow player to add and remove items from the inventory with buttons [br]
## in the inventory UI

const DEBUG_ACTIVE_INVENTORY_DEBUG_BUTTONS : bool = false

## List of all debug variables [br]
## This is used to run the tests checking that every DEBUG is set to false
## ! If you add a new DEBUG variable, add it to this list
const LIST_OF_DEBUG: Array[bool] = [DEBUG_FREE_MOVEMENT]
const LIST_OF_DEBUG: Array[bool] = [DEBUG_FREE_MOVEMENT, DEBUG_ACTIVE_INVENTORY_DEBUG_BUTTONS]
Turtyo marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading