I was wondering if anyone could link/tell me a good tutorial how to get a functional sword engine. How it could hurt the enemy and how it' comes out from nowhere than dissapears etc.
Are you talking about a similar way to how it's done in King of Dragons?
Just make a seperate active abject with the slashing animation you want displayed, then in the shooting animation of the character make the sword nothing more than a handle. Synch up the slash animation object with the swing of the sword (handle), and when Shoot button is pressed and character is facing right ---> create slash animation active at position on right of character, when Shoot button is pressed and character facing left ---> create slash animation on left side of character..... etc. ... Just make sure all your hotspots are where they need to be (usually everything is 0,0 OR set to the center of object) and make sure you have all your animations for each direction.
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?
It's well documented though and open source, IIRC Very lazily made too.
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
You could have it as a separate active object, or just keep it as an animation(and test if another object is overlapping the sword-dude while the sword-animation is playing = poor object thing gets hurt), if you are lazy... like me
Umm yeah... I suck at explaining things
Very easy way:
The sword and the guy are the same sprite. When you attack, the guy has an animation of swinging the sword. If he collides with the enemy AND is facing in the direction of the enemy, the enemy gets hurt.
That was the one I used in the 20 event thing.
Not so easy, more accurate:
The sword and guy are separate. The sword will always stay at the guy's hand (say, the sword's hot spot is at the hilt and the guy's hand is the action point). When you click, the guy and sword animate at the same time. If sword collides with enemy, then it's a hit.
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
Here's another way to do it! Create a character, draw the animations including a slashing animation. Create another active object and shape it as a box, it's size depends on your sword's reach. Name it "Hit Box".
Events:
When player presses Fire 1: Change animation to "Slash"
When Animation "Slash" is playing: Set position of "Hit Box" to "Player" (remember to assign a good action spot for it)
When Animation "Slash" is not playing: Set position of "Hit Box" <somewhere off screen>
Now if an enemy were to collide with it...
"Hit Box" overlaps "Enemy": Do whatever your supposed to do when hurt, remove health, start a hurt animation, destroy the foe etc.
I find it almost always looks / works better to have the sword be part of the same sprite as the guy but if you want to have 50 swords that look different than each other you could be in for some future headaches.
Here's what I'm doing now, and I find it's the best method for me and doesn't have to rely on any hitboxes (per se) :
1.) Complete your hero's sprite with all the animations you'll need for attacking.
2.) Clone your hero!
3.) Go into the clone's animation editor and ERASE everything on him that's not a sword.
4.) Make an event that always sets the clone's X & Y position to the hero's, and that forces the clone's animation & frame to whatever the hero's are.
5.) Make the clone invisible.
6.) When you go to have weapons collisions, test if the CLONE is overlapping the ENEMY and the animation "ATTACK" is playing, then subtract damages and stuff from the enemy's HP. Since the CLONE is only the sword, you'll have really accurate hit detection
NOTE: You can also do something similar with your hero taking damage from the enemy, where your hero's weak points (e.g. head) are susceptible to being hit or whatever.
Edited by Del Duio
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
Don't forget, the always command only updates once per frame. If the character is controlled by loops or even partially controlled by loops the sword will not be able to keep up to the X,Y axis. A quick fix is to always include the 'sword' in each loop event that also manipulates the character.
thinking is like pong, it's easy, but you miss sometimes.
Originally Posted by Del Duio I find it almost always looks / works better to have the sword be part of the same sprite as the guy but if you want to have 50 swords that look different than each other you could be in for some future headaches.
Here's what I'm doing now, and I find it's the best method for me and doesn't have to rely on any hitboxes (per se) :
1.) Complete your hero's sprite with all the animations you'll need for attacking.
2.) Clone your hero!
3.) Go into the clone's animation editor and ERASE everything on him that's not a sword.
4.) Make an event that always sets the clone's X & Y position to the hero's, and that forces the clone's animation & frame to whatever the hero's are.
5.) Make the clone invisible.
6.) When you go to have weapons collisions, test if the CLONE is overlapping the ENEMY and the animation "ATTACK" is playing, then subtract damages and stuff from the enemy's HP. Since the CLONE is only the sword, you'll have really accurate hit detection
NOTE: You can also do something similar with your hero taking damage from the enemy, where your hero's weak points (e.g. head) are susceptible to being hit or whatever.
I use this exact same technique, it's a very good way to separate weapons from the player and it's extremely accurate.
That's the same method I came up with for my "Elf Beatemup Movement Engine" Del Duio! ....
I never use the Always for that sort of thing though .... much better off making walking movement for the character AND the sword (jumping too), that way everything moves at exactly the same pace.
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?