[Solved] Bow and arrow animation

I was doing the events so that my character can throw arrows, all right until I realized a mistake, maybe the animation of aiming with the bow is with the k key pressed but when I press the k key quickly my character throws several arrows at once and the animation is not completed, could anyone help me?

1 Like

You should use “Trigger Once” event, it will activate event only once, instead of every frame. I hope this helps, so just add “Trigger Once” to your conditions, on the left side

thanks but my event already had to “trigger once” and remains the same

can you do a complete screenshot of all events ? i want to check something

1 Like

I see. Could you try adding Trigger Once to the event on the bottom? So it creates only one arrow when K is released. Test it out and tell me if this fixes it

still not working

As in 2 or more arrows in one go? Because the screen shot you have doesn’t show multiple arrows at once, but a number of arrows that appear to have been fired in quick succession

You can put a condition to the event on the bottom “The animation of player is XXXXX”, put the name of animation of your player throwing arrow and invert the condition. You can invert when you are choosing the animation:

Or you can make this later:

Invertendo condição2

All inverted conditions shows to you that icon:

Icon

well that happens because I press the k key several times but I want my character not to throw so many arrows doing that, that my character can throw another arrow after the arrow has disappeared or something like that.

or also that there is a kind of delay, that I wanted to do with the animation of pointing with the arc but you only see the first frame when you press the k key and you see all the animation when I hold down the k key for a few seconds

In that case, add the behaviour “Delete object when off screen” to the arrow object. If you only want one arrow on the screen at a time, then when you fire an arrow do a check that there aren’t any arrows in the scene (there’s a “number of objects” condition you can use).

1 Like

Use an object timer, and place it on the player. Then add a additional check when the k key is released that the timer is greater than a set time (last event in your screen snip). Remember to reset the timer when you create the arrow.

1 Like

Could something be done so that all the animation frames are shown without having to hold down the k key for a few seconds?

What is the number of the animation you want to play?

The animation number is 4, the frames are also 4

Yes, though it’s best achieved using a finite state machine.

To do this, add an object string variable to your player, called State. Every time the player does something - fire, walk, stand jump etc, change the value of the State variable to reflect what the player is doing. Then have a set of conditions that check the state of the player and act accordingly. So you’d get something like :

2 Likes

Thank you very much, now my character does all the animation and throws a single arrow but when he throws the arrow I can not throw arrows again

If you are using the events from my screen snip, then make sure the arrows have a “Destroy when outside of screen” behaviour attached.

1 Like

I already solved the problem I had, so that they could not spam the arrows I had to lengthen the animation a little, here I leave the events to help them

2 Likes