How do I make a sword swing?...with some extras

0 favourites
  • 6 posts
From the Asset Store
140 sounds, specially designed to make your blades sound amazing
  • Hey beautiful people:)

    this may be easy to solve but I think I've got some brainknot at the moment.

    So the player (sidescroller) should hold his sword down, like at 120°, 240° if mirrored. On Keyboardinput ("A") the sword should rise over head, +/-180°, and then slash back to the 120/240.

    Both durations should be global variables (I think) because this will change later through differend weapons. Heavy axe needs more time to get over the head than a light sword but maybe slashes faster.

    It would be great if someone takes a look at the chaos I've build and maybe gets me on the right way or even corrects the file.

    Thanks, have a great day and so long!

    dropbox.com/s/ofp0pquqang2f8x/ZombieViking.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I usually just create my weapons with multiple frames - as an animation and play it.

    Keyboard A is pressed and Player is not attacking - Set animation name to Attack from beg.

    Then trigger once for damage after a specific frame on collision - Don't want damage on the upswing and don't want damage every tick on the down swing.

  • True words and I didn't think of the "Don't want damage on the upswing and don't want damage every tick on the down swing" part. Thx, mate:)

  • dropbox.com/s/dcxtcj12ymoipnq/ZombieViking.c3p

    Added a simple movement with clock and counter clockwise rotation, and added states (raise, strike, attack) which can be used to allow or disallow all sorts of events.

    Pretty, well, not the best, effective, yeah.

    The degrees and for angle comparison are intentionally a bit wider, so you can play with amount of degrees to move (for differing weapons)

    Also, the attack state resets upon shifting mirror.

  • I don't have a dropbox account so I threw it up on my Itch.

    I just added my code to Lennaert's so you can view them both at the same time.

    (Speed up animation speed or slow down the speed to change how fast they go. They will cap out I think at 60 Speed. So each animation frame you have will cut into how many attacks you can do a second. 10 animation frames at 60 would be 6 attacks a second max)

    win-streak.itch.io/attackanimation

    Either form of design can be modified to do what you need, it comes down to what you feel more comfortable working with.

  • Haha brilliant !!

    Decent approach there winstreak

    My motive using the method I did was because it was in the line of material and techniques mozip was already using.

    The only disadvantage I see with using an animation is size related.

    A single image vs the images used for animation. (10 weapons, 10 animations etc)

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