mirror of
https://github.com/GDQuest/godot-platformer-2d.git
synced 2026-01-23 10:16:09 +00:00
Close #159: Remove aim logic in the Fire state
Now the Fire state doesn't depend on the Aim state anymore so I removed the parenting
This commit is contained in:
parent
f54fb0eee2
commit
42bb4cbecd
2 changed files with 2 additions and 6 deletions
|
|
@ -36,7 +36,7 @@ initial_state = NodePath("Aim")
|
|||
[node name="Aim" type="Node" parent="StateMachine"]
|
||||
script = ExtResource( 6 )
|
||||
|
||||
[node name="Fire" type="Node" parent="StateMachine/Aim"]
|
||||
[node name="Fire" type="Node" parent="StateMachine"]
|
||||
script = ExtResource( 7 )
|
||||
|
||||
[editable path="Arrow"]
|
||||
|
|
|
|||
|
|
@ -5,10 +5,6 @@ func _on_Cooldown_timeout() -> void:
|
|||
_state_machine.transition_to("Aim")
|
||||
|
||||
|
||||
func physics_process(delta: float) -> void:
|
||||
_parent.physics_process(delta)
|
||||
|
||||
|
||||
func enter(msg: Dictionary = {}) -> void:
|
||||
owner.cooldown.connect("timeout", self, "_on_Cooldown_timeout")
|
||||
|
||||
|
|
@ -17,7 +13,7 @@ func enter(msg: Dictionary = {}) -> void:
|
|||
var target: HookTarget = owner.snap_detector.target
|
||||
if not target:
|
||||
var distance: = min(owner._radius, owner.get_local_mouse_position().length())
|
||||
owner.arrow.hook_position = owner.global_position + owner.get_local_mouse_position().normalized() * distance
|
||||
owner.arrow.hook_position = owner.global_position + owner.get_local_mouse_position().normalized() * distance / 2.0
|
||||
_state_machine.transition_to("Aim")
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue