Topic was automatically imported from the old Question2Answer platform.
Asked By
chris33556
i have a player character that has 2 attack types, a single punch and a combo attack. i want it that when the player is not near any objects/ or enemy AI to play the single punch. and if the player is in attacking distance , to play the combo attack.
the problem is that I dont know how to switch the attacks since they are both bound to the ‘J’ key. ive tried to change the attack when the player is in the objects ‘body_entered_area’ but it doesnt work.
func _on_animation_tree_animation_finished(anim_name: StringName) -> void:
if(test == objects is in a group that can combo! && anim_name == "Your punch"):
autorize the next punch !
else
then nothing !
func _on_area_3d_area_entered(area: Area3D) -> void:
test = area
You finish the animation and in the end you check if you collide with an object that has area3D or body your choice , that collide . then you check if the last animation is the punch ! and once it finish the punch it look if it will do a combo !! . i hope that will inspire you ! im just a rookie =P . hope that help and this code inspire you ! on animation is finished is a signal !