Added a new character and modified the way :setup and :ready events are run.

This commit is contained in:
Julian Murgia
2020-12-26 21:53:00 +01:00
parent f26d96f115
commit af8a9ea086
58 changed files with 1259 additions and 340 deletions

View File

@@ -21,6 +21,7 @@ Implement methods to react to inputs.
signal element_focused(element_global_id)
func _input(event):
if event.is_action_pressed("switch_action_verb"):
if event.button_index == BUTTON_WHEEL_UP:
@@ -93,7 +94,7 @@ func left_click_on_inventory_item(inventory_item_global_id : String, event : Inp
func right_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent) -> void:
escoria.do("item_right_click", [inventory_item_global_id, event])
func double_left_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent) -> void:
func left_double_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent) -> void:
pass
func inventory_item_focused(inventory_item_global_id : String) -> void:
@@ -101,3 +102,11 @@ func inventory_item_focused(inventory_item_global_id : String) -> void:
func inventory_item_unfocused() -> void:
emit_signal("element_focused", "")
func open_inventory():
$ui/inventory_layer/inventory_ui/inventory_button.show_inventory()
func close_inventory():
$ui/inventory_layer/inventory_ui/inventory_button.close_inventory()

View File

@@ -6,13 +6,20 @@ func _ready():
pass
func _on_inventory_button_pressed():
if !$AnimationPlayer.is_playing() and !showed:
$AnimationPlayer.play("show")
yield($AnimationPlayer, "animation_finished")
showed = true
show_inventory()
elif !$AnimationPlayer.is_playing() and showed:
$AnimationPlayer.play("hide")
yield($AnimationPlayer, "animation_finished")
showed = false
close_inventory()
func show_inventory():
$AnimationPlayer.play("show")
yield($AnimationPlayer, "animation_finished")
showed = true
func close_inventory():
$AnimationPlayer.play("hide")
yield($AnimationPlayer, "animation_finished")
showed = false

View File

@@ -6,7 +6,7 @@
[ext_resource path="res://game/ui/ui_mouse_icons/inventory/inventory_showhide.gd" type="Script" id=4]
[ext_resource path="res://game/ui/ui_mouse_icons/images/frame.png" type="Texture" id=5]
[ext_resource path="res://game/ui/ui_mouse_icons/images/inventory_icon.png" type="Texture" id=6]
[ext_resource path="res://game/items/all_items.tscn" type="PackedScene" id=7]
[ext_resource path="res://game/items/ESCORIA_ALL_ITEMS.tscn" type="PackedScene" id=7]
[sub_resource type="Animation" id=1]
resource_name = "hide"
@@ -100,7 +100,7 @@ __meta__ = {
}
items_container = NodePath("inventory_button/panel/MarginContainer/ScrollContainer/container")
[node name="all_items" parent="." instance=ExtResource( 7 )]
[node name="ESCORIA_ALL_ITEMS" parent="." instance=ExtResource( 7 )]
position = Vector2( 269.391, 275.003 )
[node name="inventory_button" type="TextureButton" parent="."]