GameMaker: Studio

GameMaker: Studio

Find, play, and make games easily
Discover, rate, and download the best player-created games made in GameMaker: Studio for free. Or try making your own and share with the community. Click here to learn more.
Sword Attack Animations a la Illusion of Gaia or Link to the Past
I'm a little confused about how to go about this.

As some of you have seen from my (hopefully not annoying) posts, my goal is to eventually have something like Illusion of Gaia (or A Link to the Past, but maybe the two games handle this differently).

I feel like there are two options ahead of me....

Do I...
a.) Have a "sword swinging" animation where my character is empty handed, and have the button press trigger both that animation AND a sword object with its own collision properties? And then line up the objects to create the illusion that my character is swinging a weapon?

b.) Have a "sword swinging" animation where my character IS holding a weapon, and create an invisible object that has its own collision properties?

My gut is telling me that most people would do option a.), but if my character is only going to have one weapon throughout the game, wouldn't it make more sense to do option b.)? And then in that scenario, I wouldn't have to go through the trouble of lining up two separate animations? Am I going about this all wrong?

Right now, all I have is that if I hit a button, a sword appears, so I haven't really done any "weapon swinging" animations, and didn't want to go down the wrong path. Can anyone possibly point me in the right direction?
Last edited by PogueSquadron; 12 Mar, 2014 @ 6:40pm
< >
Showing 1-4 of 4 comments
Ninjaneer 12 Mar, 2014 @ 9:49pm 
This is just my opinion, but what I would do is have an animation on button press that has the weapon swing, but then use the draw collision mask option on the animation to determine collision on a pixel by pixel basis. If you run that in your step function, it should handle it well. Also if you have your player pick up a new weapon, have that just overwrite the damage dealt value and you can have as many items as you want. You could also change out the color of your "sword" so have a graphical explanation showing that you got a new sword similar to when you get the silver sword in the original NES LOZ.

Just one man's thoughts.
PogueSquadron 1 13 Mar, 2014 @ 8:34am 
Would that make things more difficult, then, if I want to have an enemy damage you while you're attacking? That's why I was thinking that maybe separating this into two objects might not be a bad idea (regardless of whether or not the weapon is embedded in the player sprite or as its own object).
Pseudonym_0 15 Apr, 2014 @ 8:31am 
What you could do here, if you're still working on this, is set the collision shape of your player just to his body and make the sword animation extend beyond that. Then you set yourself an "isAttacking" flag or some such, and put a few lines in your step event so that if it's set to TRUE, you collision check a line at the proper arc of the sword for that point in the animation. Simplest way to line them up would probably be to draw a visible line in your draw event using the exact same parameters and then tweak them from there.

No worries about wierd interactions of collision objects then.
getimoliver 23 Apr, 2014 @ 4:06pm 
Regardless of how you do the animation, you may want to rely on something other than a pixel-by-pixel collision with the sword. This is a tightly-coupled solution that may come back to bite you.

As you tweak the gameplay, you may want to be able to increase or decrease the actual range of the sword, or add a gusting wind effect or some such that has a small amount of area splash damage. You probably wouldn't want to rely on the swords exact position to do this - probably just the player origin.

If I was going to do this, I would create a very fast attack animation and simply place a collision rectangle in front of the player. During the enemy step, if any enemies are within the rectangle, damage and push them back, relative to the player position.

This would be easy to extend to a charge-up attack like Link's standard charge attack in the Zelda Series. Instead of a static rectangle, I'd create two or four rectangles on a timer around the player, and perform the same check.
< >
Showing 1-4 of 4 comments
Per page: 1530 50