How do I get my character to spawn his weapon on attack?

Just started using Construct 2? Post your questions here

Post » Thu Jun 05, 2014 8:18 pm

So I would like my "character" to spawn a whip on attacking. I have created a seperate sprite for the whip and put a "image point" on the attack animation frame 1. My event sheet is:
- When the mouse is clicked
- Play Attack Animation
- Wait 0.2 seconds and spawn Whip on image point "hand"
- Wait 0.2 seconds and destroy whip.

It works fine for standing still but doesn't line up correctly when moving. :|

Is there some way to get the whip to spawn only on the attack frame ?
B
7
S
1
Posts: 25
Reputation: 477

Post » Thu Jun 05, 2014 9:21 pm

I think something like this is what you are looking for :

Image

It will spawn the weapon on the 4th frame of the animation, and then destroy it when the animation is finished. You could also have it be destroyed at a specific frame if you wanted. It also keeps the weapon attached to the spawn point during the duration.
B
5
Posts: 14
Reputation: 253

Post » Thu Jun 05, 2014 10:04 pm

dsvw56 wrote:I think something like this is what you are looking for :

Image

It will spawn the weapon on the 4th frame of the animation, and then destroy it when the animation is finished. You could also have it be destroyed at a specific frame if you wanted. It also keeps the weapon attached to the spawn point during the duration.


:mrgreen: Well I learned something new today!

It kinda works, if I interupt the animation then the whip still gets stuck on the screen but im sure I can figure that out. You sir are a real help! Thank you :D
B
7
S
1
Posts: 25
Reputation: 477

Post » Thu Jun 05, 2014 10:23 pm

To solve that you can just add an invert of the "Is Animation Playing" condition and have it destroy the object. That way it's never spawned if the animation isn't playing.
B
5
Posts: 14
Reputation: 253

Post » Mon Aug 18, 2014 11:21 am

That's cool,guys.. but can we rotate the sword with the hand so it's more realistic?
B
21
S
6
Posts: 244
Reputation: 2,655


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest