Jump to content

  • Log In with Google      Sign In   
  • Create Account

xinfinite33

Member Since 12 Oct 2012
Offline Last Active Aug 17 2014 06:37 PM

Posts I've Made

In Topic: 2D Arcade Fighter Game

13 May 2014 - 08:59 AM

Hello aanthonyz1
 

I've also been thinking about how to handle collision detection in fighting games, so I did some research about it and I found some pretty cool results. Some games use the pixel perfect approach as DpakoH mentioned, But there are others who use a collection of "Hit Boxes" for each frame of animation. The fighting game Skullgirls uses the Hitbox method. Here is a link so you can get an idea of how it works.

 

http://wiki.shoryuken.com/Skullgirls/Hit_Box_Ref

 

While hitbox detection is most often faster than pixel perfect collision detection, you have to manually create the hitboxes for every single frame ,of every single animation and for every single character in your game, while the pixel perfect method only needs the image data. But in my opinion I think hitbox detection is the way to go. It makes it very easy to specify which parts of your character are Hurt areas (Areas that can be hit by attacks, such as the torso, head ,etc.), and which areas are Attack areas (Areas used in attacking, such as, fists, legs, weapons, etc.). Though the downside is that it will most likely be tedious to set up, unless you make some kind of external program to make editing the hitboxes for your characters easier. But then again the same thing could be done with pixel perfect collision detection if you use a separate set of images along with the original image data that specifies the hurt and attack areas. For example you could color the hurt areas blue and the attack areas red. Then when you do the collision detection, you just get the color of the pixels that are colliding and determine if its a successful hit or not. But this would make your game take up more space due to the extra image data.


In Topic: Custom window GUI system

08 May 2013 - 07:03 AM

so far you guys are only pointing me to libraries. are there really no tutorials / discussions on how to go about creating your own GUI system? id rather learn the basic idea on how they work and then design around that because if i ever decide to use another language for a project and need a GUI system, i can have enough knowledge to create a fairly basic one, then if i need more advanced features that i cannot create myself, then id use a GUI library. i just need an understanding of how a system would be structured, so i could add on the individual tools such as the buttons, checkboxes,sliders etc. myself.


In Topic: Custom window GUI system

07 May 2013 - 09:08 AM

im using C++ and SFML


In Topic: CodeBlocks and SFML Confusion?

26 December 2012 - 11:35 AM

I also had alot of trouble getting SFML running the first time. what i had to do was rebuild SFML using a program called Cmake. It fixed everything and it works fine now. if you mean that you had trouble understanding how it works, and not trouble getting it running, i suggest reading the tutorials on the SFML website.


In Topic: 2D tile map collision detection

26 December 2012 - 11:12 AM

the way i would do it is to just do a bounding box collision check, then if there was a collision i would correct on the axis with the lowest penetration value. the penetration value is how far one bounding box has penetrated another . so you get the penetration value of both the x axis and the y axis. and correct for the smallest penetration value. you can get the penetration value by taking the distance from the center of the bounding box to the edge of the bounding box "width/2 or height /2". for both bounding boxes, and then subtract it from the distance from the center of box 1 to  the center of box 2:

 


int Xpenetration=( ( Boundingbox1.width/2 + Boundingbox2.width/2 ) - (Boundingbox2.centerX-Boundingbox1.centerX) );

int Ypenetration=( ( Boundingbox1.height/2 + Boundingbox2.height/2 ) - (Boundingbox2.centerY-Boundingbox1.centerY) );

 

 

then you compare the absolute value of both the Xpenetration and the Ypenetration, and just correct for the smallest value:

 

if( abs(Xpenetration) > abs(Ypenetration) )
{
   // correct on the y axis using Ypenetration value.
}
else 
{
   // correct on the x axis using Xpenetration value.
} 

PARTNERS