Game Development Community

2D Melee

by Jeremy Dains · in Torque X 2D · 04/12/2010 (12:27 pm) · 7 replies

Hello everyone, I am trying to get some ideas for developing a melee system to be used in a 2D side-scroller. Any input helps, Thanks.

#1
04/12/2010 (2:05 pm)
There's a function called pickRect() where you can test a rectangle (given 4 coordinates) and it returns a list of objects found. You can pickRect() by a mask type (player, monster, whatever you want) to just see if your "attack" hits a monster in font of you.

Other than that, just search the forum. This has probably been covered a lot of times.
#2
04/12/2010 (3:23 pm)
Depends on what kind of melee fighting your doing. My game has supersmash bros/streetfighter style fighting.

I create "Hitbox" objects for all the players and enemies that are attached to them.

I then scale these hitboxes based on the animation so they always make sense.

Then when you attack I create attack boxes. The attack boxes collide with the hit boxes and generate a hit fx based on the location of the hit box and the enemy player ect...

Here is a video on Fighting game strategy that illustrates much of what I am talking about.

http://www.youtube.com/watch?v=HFTvXXoDNRA

My system is very similar to the one illustrated in the video.

#3
04/12/2010 (3:46 pm)
I did a technique where I "fired" a projectile with a world limit set at my reach. The projectile is tiny and nearly invisible, set to a lower layer, you never see it. When hero swings his sword a projectile is fired in the facing direction. then its just like any shooter. Kind of the poor mans casting a ray. If the enemy is outside of the range or more importantly behind you it will not be hit.

#4
04/12/2010 (5:15 pm)
^---lol that sounds funny....but its very clever. the method i'm using is similar to matthew's but incomplete and totally noobish. thanks for the video that helps alot too i always played fighting games but never thought about using the concepts towards actual code.
#5
04/12/2010 (5:19 pm)
http://www.youtube.com/watch?v=8uAYQGVrz3U
this video will probably help all of us i wonder if that program is torqueable? but then again it was made just to pick apart character frames and hit boxes for the MeltyBlood game (a fav of mines)
#6
04/13/2010 (9:08 am)
For my 2.5D brawler, I created a scene object and gave it a collision boundary, then set it to collide with enemies and turned off collision handling. I then mounted it to my player under an "attack" linkpoint. Whenever the player attacks, I do a manual collision check, which returns a list of all objects it collided against.

I also give my attacks names, so the code will first check if a linkpoint exists with that name before defaulting to the standard attack linkpoint. That way I can have a jump attack that hits enemies underneath the player.
#7
04/16/2010 (7:30 am)
Wow got a lot of great ideas from your posts. Im getting some good ideas from all this. I will try and put something together and let you all know how it turned out. I especially liked the ideas about using invisible projectiles, sounds like I might be able to get some creative melee stuff done with that.