PDA

View Full Version : Link's Hitbox



ZoriaRPG
12-26-2016, 11:32 AM
// For Link's hit detection. Don't count them if they are stunned or are guys.
int GuyHit(int tx,int ty,int tz,int txsz,int tysz,int tzsz)
{
//Calculate hitsize and hitoffsets
if ( Link.getExtend() >= 3 ) {
tx += Link.getHXOfs();
ty += Link.getHYOfs();
//tz += Link.getLinkHitZOffset();
txsz += ( Link.getHXSz() + Link.getHXOfs() );
tysz += ( Link.getHYSz() + Link.getHYOfs() );
//tzsz += Link.getLinkHitZHeight();
}
for(int i=0; i<guys.Count(); i++)
{
if(guys.spr(i)->hit(tx,ty,tz,txsz,tysz,tzsz))


Are the txsz, and tysx parameters something unusual here? By this, I mean what values are they using as inuts? I see some oddness in calls to this, such as GuyHit(LinkX()+*, LinkY+98), LinkZ(), 2, 2, ...)

Is this vastly different from ordinary rect collision, because the '2' values are off to me.

DarkDragon
12-26-2016, 01:23 PM
I believe it's just a standard rectangle check (in ZC units, i.e. tiles are 16x16.)

I don't know which line specifically you're referring to, but for example it's common to have calls like

GuyHit(x+7, y+7, 2, 2)
to denote a small hitbox around the center of the sprite.