Implement save and loading games (#8)

This commit is contained in:
Julian Murgia
2021-07-02 23:08:43 +02:00
committed by GitHub
parent 58d880101d
commit bd4c33cf77
66 changed files with 1268 additions and 736 deletions

View File

@@ -5,8 +5,8 @@ This script is totally user-defined. It does exactly what the user wants the
inventory to look like. It only requires 4 functions to be defined:
- is_empty() -> bool
- get_items() -> Array
- add_item(inventory_item : ESCInventoryItem)
- remove_item(inventory_item : ESCInventoryItem)
- add_item(inventory_item: ESCInventoryItem)
- remove_item(inventory_item: ESCInventoryItem)
The user is free to implement these methods the way s-he likes.
"""
@@ -18,7 +18,7 @@ func is_empty() -> bool:
func get_items() -> Array:
return current_nodes_in_container.keys()
func add_item(inventory_item : ESCInventoryItem):
func add_item(inventory_item: ESCInventoryItem):
var center_container = CenterContainer.new()
center_container.size_flags_horizontal = SIZE_EXPAND_FILL
center_container.connect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
@@ -28,7 +28,7 @@ func add_item(inventory_item : ESCInventoryItem):
add_child(center_container)
current_nodes_in_container[inventory_item] = center_container
func remove_item(inventory_item : ESCInventoryItem):
func remove_item(inventory_item: ESCInventoryItem):
var node_to_remove = current_nodes_in_container[inventory_item]
current_nodes_in_container.erase(node_to_remove)
node_to_remove.disconnect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")