Add default behaviors in ESCGame click handlers on BG and items. (#356)

If ESCGame functions concerned by this PR are not overridden in user's game.gd script, the default behavior will be used.
NB: if these function are overridden in user's game.gd script, these default behaviors will not be called (unless explicitly called using parent script call by adding a dot before the function: .left_click_on_bg())
This commit is contained in:
Julian Murgia
2021-08-04 12:57:42 +02:00
committed by GitHub
parent 51e1cfa92b
commit a0218e2998
2 changed files with 14 additions and 7 deletions

View File

@@ -50,7 +50,7 @@ func _draw():
#
# - position: Position clicked
func left_click_on_bg(position: Vector2) -> void:
pass
escoria.do("walk", ["player", position])
# Called when the player right clicks on the background
@@ -60,7 +60,7 @@ func left_click_on_bg(position: Vector2) -> void:
#
# - position: Position clicked
func right_click_on_bg(position: Vector2) -> void:
pass
escoria.do("walk", ["player", position])
# Called when the player double clicks on the background
@@ -70,7 +70,7 @@ func right_click_on_bg(position: Vector2) -> void:
#
# - position: Position clicked
func left_double_click_on_bg(position: Vector2) -> void:
pass
escoria.do("walk", ["player", position, true])
# Called when an element in the scene was focused
@@ -97,7 +97,7 @@ func element_unfocused() -> void:
# - item_global_id: Global id of the item that was clicked
# - event: The received input event
func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
pass
escoria.do("item_left_click", [item_global_id, event])
# Called when an item was right clicked
@@ -108,7 +108,7 @@ func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
# - item_global_id: Global id of the item that was clicked
# - event: The received input event
func right_click_on_item(item_global_id: String, event: InputEvent) -> void:
pass
escoria.do("item_right_click", [item_global_id, event])
# Called when an item was double clicked
@@ -122,7 +122,7 @@ func left_double_click_on_item(
item_global_id: String,
event: InputEvent
) -> void:
pass
escoria.do("item_left_click", [item_global_id, event])
# Called when an inventory item was left clicked