Commit 5ef822fd authored by Leandro Motta Barros's avatar Leandro Motta Barros

Disable walking while using tool

parent 91788540
......@@ -23,6 +23,12 @@ func _processAction(_delta: float) -> void:
func _processWalk(_delta: float) -> void:
# Don't walk if using tool
var currTool := getTool()
if currTool and currTool.isUsing:
return
# No tool in use, OK to walk
var velocity := Vector2()
if Input.is_action_pressed("right"):
......
......@@ -17,6 +17,7 @@ var toolPoint = null
# True if player is taking it; hack to avoid using it when taking it
var isTaking := false
var isUsing := false
func _process(delta: float) -> void:
_coolDownTimer -= delta
......@@ -29,9 +30,12 @@ func use() -> void:
return
if get_parent() and canUse():
isUsing = true
_coolDownTimer = coolDownInSecs
$AnimationPlayer.play("use")
useImplementation()
yield($AnimationPlayer, "animation_finished")
isUsing = false
# Did it break?
if randf() < chanceToBreak:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment