How do you code strikes?
-
-
Don't worry about redrawing collisions. Focus on the animation of the character for now.
Started Touching -> Play Animation
You can also make itplay a sound
and add other effects for the animation.You can have another object act as a hit box for the sword. It'll be invisible, but at least it'll make things a lot easier.
You want to move this object to the player when the player strikes. It would teleport instantly, so use0s
duration.So now we have:
Started Touching -> Move to Object + Play Animation
You can change the anchors in the Move to Object behavior so that the hitbox can move to where the sword is swinging in front of the player!You can code the hit box object to damage enemies on collision.
And of course, you want to take the hit box away so that the enemies don't get damaged when the animation is over. You can move the object to a point, say(-99999,-99999)
for example, where it is very far from the enemies.And now we have:
Started Touching -> Move to Object + Play Animation -> Move to Point -
@RobinsonX Nice. I was thinking it had to do with some type of weld attach. Never thought to make an invisible hit box. Thanks