Melee Attack

Get help using Construct 2

Post » Sat Mar 09, 2013 2:55 am

So I saw a post about if you want to do a Melee Attack one good way is to onClick of a Key Create a Object(Sword), play its animation, Check for Collisions during the animation, Remove object.

So unless there is another or better way can someone help with with creating that logic in C2? I can Spawn an Object and I can Create an Object but how do you tell it to in X remove it? Do you do a timers, wait X seconds then remove? that seems odd you could have tons of them that all have different wait timers. :( Help.

Thank you
Brett
B
21
S
7
G
1
Posts: 128
Reputation: 3,076

Post » Sat Mar 09, 2013 3:03 am

I like to use the fade behavior for this. Set the wait time, set the fade time, if any, leave Destroy='After fade out'. All self contained.
ImageImageImage
B
67
S
19
G
124
Posts: 3,218
Reputation: 74,423

Post » Sat Mar 09, 2013 7:03 am

Another way would be to set an event with "on animation finish".

Using the wait action would work as well - it is specific to the event it was created in, so you don't have to worry about keeping track of a bunch of timers.
Mistakes were made.
B
37
S
17
G
67
Posts: 1,041
Reputation: 38,211

Post » Sat Mar 09, 2013 3:13 pm

I'm not sure I like the idea of creating/destroying the object every time it's used, although I guess that's what happens with bullets anyway. Still, if it's something like a sword that the player is permanently carrying, I'd go with the fade effect. Start the fade, then when testing for collision, test the opacity of the sword. Don't destroy it if it'll be needed again constantly, you may as well just have it constantly animating whilst invisible.
B
25
S
5
G
3
Posts: 446
Reputation: 5,633


Return to How do I....?

Who is online

Users browsing this forum: linkman2004, Vodakman and 14 guests