0 Favourites

Melee Attack

  • 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

  • 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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)