The Daily Click ::. Forums ::. Klik Coding Help ::. Melee Attacks
 

Post Reply  Post Oekaki 
 

Posted By Message

Ben Schlessman



Registered
  05/09/2005
Points
  11
27th September, 2005 at 19:21:51 -

Sorry if this has been posted elsewhere, but what is the best way of going about programming your character to have melee attacks in MMF?

 
Durka durka

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
27th September, 2005 at 19:33:32 -

what do you mean, like to make a character attack?
if so then it would be very very simple,
ie.
upon pressing "Space"
-play animation attack

 
n/a

Ben Schlessman



Registered
  05/09/2005
Points
  11
27th September, 2005 at 19:37:18 -

Sorry if I wasn't specific enough. If you were to simply change animations upon pressing a key, and have an enemy get hit while said animation is playing, that wouldn't be enough because any part of the character could be touching an enemy to have it work. Is there an easy way to press a button and have a character, say, swing a sword, and when only the sword part of the sprite is colliding with an enemy make the enemy take damage?

 
Durka durka

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
27th September, 2005 at 19:39:14 -

I would say there are many ways that work well if you use the right events.

how about making a seperate object for the melee weapon thats only visible when you are attacking? you will need to make the object always the same direction at your character and make it only kill things when it's visible.
Syncing the animation between player and the weapon may not be easy though.

so.

upon ctrl pressed - play attack animation (player) + make melee reappear

melee visible? + only once when event loops - play animation 1 (melee)

melee animation 1 is playing? + overlapping enemy 1 - destory enemy 1

Melee animation 1 is stopped - make melee invisible

 
.

Ben Schlessman



Registered
  05/09/2005
Points
  11
27th September, 2005 at 19:42:20 -

Thanks Andy, that sounds good and is worth tinkering around with. I guess to clarify things even more, I've got a side scroller in mind that I want to work this into. The sword as a separate object would work, but it would take some time to make perfect. Any other ideas that might be more side scroller appealing?

 
Durka durka

Noyb



Registered
  31/05/2004
Points
  1117

VIP Member
27th September, 2005 at 19:44:20 -

You could also make hitboxes, invisible active objects always positioned at the end of a fist/sword/whatever by placing it on action points to detect collisions.

 
"Omg. Where did they get the idea to not use army guys? Are they taking drugs?" --Tim Schafer on originality in videogames

Ben Schlessman



Registered
  05/09/2005
Points
  11
27th September, 2005 at 19:47:24 -

Yeah, those hitboxes could very well be the way to go. Thanks a bunch Noyb.

 
Durka durka

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
28th September, 2005 at 19:02:58 -

or you can shoot a detector at speed 0, then remove it like this

Number of (Detector) > 0 - Add 1 to valueA.Detector

ValueA.Detector = 5 - Destroy Detector

 
Craps, I'm an old man!

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
28th September, 2005 at 19:11:09 -

I was thinking 'sidescroller' when i came up with my suggestion. But it would work the same with an 8 way movement game too.

 
.

Dave Matthew (Jester Gaming)



Registered
  09/07/2004
Points
  148
29th September, 2005 at 04:01:02 -

you could make the 'hitboxes' Noyb suggested a copy of the main character. And then just remove anything but the weapon from the 'hitbox' animation. then you place the 'hitbox' at 0,0 from main character. that way the whole sword will be detected for collisions

 
n/a
   

Post Reply



 



Advertisement

Worth A Click