The Daily Click ::. Forums ::. Klik Coding Help ::. Need some help with Swords.
 

Post Reply  Post Oekaki 
 

Posted By Message

Deaval

It's my lap

Registered
  06/02/2008
Points
  146

360 Owner
22nd April, 2009 at 11:08:56 -

Hi,

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.

Thank you.

 
Image

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49567

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
22nd April, 2009 at 13:52:35 -

Sword... Engine?

Just use an active object that looks like a sword swinging, then when you press the action key make it appear play it's animation then disappear.

When it touches an enemy, subtract life, make then get knocked back, ect.

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
23rd April, 2009 at 03:34:40 -

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.


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

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 ?

caccolothemeaning



Registered
  03/12/2008
Points
  373
24th April, 2009 at 01:06:07 -

And fill just the Appearing and Disappearing animations so you don't have to tell MMF (or whatelse) but the Create Object thing.




...was my post obvious isn't it? Aww...

 
Image

Deaval

It's my lap

Registered
  06/02/2008
Points
  146

360 Owner
24th April, 2009 at 02:22:23 -


Originally Posted by MBK
Are you talking about a similar way to how it's done in King of Dragons?



Thanks, but i was thinking more like the style of Zelda: Link To The Past.

 
Image

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49567

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
24th April, 2009 at 03:53:26 -

Thats what I said MBK!

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
24th April, 2009 at 04:35:18 -

LoL! ... you noticed! ... .... didn't think anyone would catch that ... most people don't seem to actually read what I post. X)


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

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 ?

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
24th April, 2009 at 06:03:40 -

The whole game is about swinging swords:
http://www.create-games.com/download.asp?id=7218

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.

Image

Deaval

It's my lap

Registered
  06/02/2008
Points
  146

360 Owner
24th April, 2009 at 06:07:41 -

The download link don't work.

 
Image

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
24th April, 2009 at 16:00:35 -

Hmm.. must've accidentally deleted it

 
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.

Image

Kitsuneh



Registered
  23/04/2009
Points
  21
24th April, 2009 at 21:07:52 -

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

 
I CAN HAS SIGNATURE?

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
26th April, 2009 at 01:50:36 -

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.

Image

chrilley

Insane Beaver

Registered
  05/01/2002
Points
  704

Game of the Week WinnerVIP Member360 Owner
26th April, 2009 at 11:11:18 -

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.

Edited by chrilley

 
Image

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
27th April, 2009 at 19:02:32 -

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!

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
27th April, 2009 at 21:05:51 -

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.
   

Post Reply



 



Advertisement

Worth A Click