0 Favourites

Top Down Melee Weapon Swing

  • I'm trying to create a top down melee combat system and I keep getting stuck on the swing. I want the player to hold the left mouse button down to swing the weapon. While the button is held down, the weapon has a back swing, then once that angle is reached, it is swung forward until it reaches the end of its forward swing. Since it's top down, the player sprite could be rotating (player sprite always points at the mouse) as well, which should affect the angle at which the weapon is held. Ex: if the player sprite rotates the same direction the weapon is being swung, the weapon should appear to be swung at a higher speed, or vice versa.

    I also have several different melee weapons, each of which has a different back swing, forward swing, swing speed, etc, and I have them all in a family. I'm trying to use a function that just uses the instance variables to determine the actual angles.

    I've been working on this for a few days now and read all the threads I could find on melee combat, but those are all about animation frames, which I'm not using.

    Imagine Hotline Miami's melee, except the mouse button needs to be held down throughout the swing or else the weapon goes back to its default position.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Although this is not a direct answer to your question, it does have an angle follow and angle set compared to the base object..

    You might be able to turn this into what you are looking for..

    https://dl.dropboxusercontent.com/u/485 ... ollow.capx

  • So the global variable C basically just records the angle of B in comparison to A, so even though they aren't pinned at position and angle, B stays rotated the same in relation to A?

    So if I had a variable that just held the angle different between the weapon and the player, the weapon would look like it's being steadily held by the player even with being pinned at the angle.

    Thank you, LittleStain. I think that solves one problem for me.

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