PDA

View Full Version : ffc solidity



Pielord
02-22-2009, 05:54 PM
Is there any option or something that makes a ffc solid? I'm trying to script it and it's not going to well... I would normally put solid combos under my ffc's but I'm making one that's moving so that won't work very well...

Saffith
02-22-2009, 06:05 PM
Ah, I've got one for that.


// Set this to 1 if you're using the big Link hitbox, 0 if not.
const int SOLIDFFC_BIG_LINK = 0;

ffc script SolidFFC
{
void run()
{
int hitboxAdjustment=0;
float xOverlap;
float yOverlap;
if(SOLIDFFC_BIG_LINK==0)
hitboxAdjustment=8;

while(true)
{
if(Link->X+16>this->X && Link->X<this->X+16*this->TileWidth &&
Link->Y+16>this->Y && Link->Y+hitboxAdjustment<this->Y+16*this->TileHeight)
{
if(Link->X<this->X)
xOverlap=Link->X+16-this->X;
else
xOverlap=this->X+16*this->TileWidth-Link->X;

if(Link->Y<this->Y)
yOverlap=Link->Y+16-this->Y;
else
yOverlap=this->Y+16*this->TileHeight-(Link->Y+hitboxAdjustment);

if(xOverlap<yOverlap)
{
if(Link->X<this->X)
Link->X=this->X-16;
else
Link->X=this->X+16*this->TileWidth;
}
else
{
if(Link->Y<this->Y)
Link->Y=this->Y-16;
else
Link->Y=this->Y+16*this->TileHeight-hitboxAdjustment;
}
}
Waitframe();
}
}
}

lucas92
02-22-2009, 06:09 PM
Could you submit it at PureZC script database? It will be easier to find it after.

Pielord
02-22-2009, 07:56 PM
Thanks! :)Only problem is that link jerks whenever he walks into the ffc. Like, he goes a pixel in then he is pushed out by the script then he goes into it a pixel in again and so on, but I can live with that. Also, is it possible to make this into a function? I may have to repeat this a few times.

Saffith
03-27-2009, 11:46 AM
Sorry, haven't been around much lately...


Only problem is that link jerks whenever he walks into the ffc. Like, he goes a pixel in then he is pushed out by the script then he goes into it a pixel in again and so on, but I can live with that.Yeah, there's not really a great way to avoid that. I think doing it from a global script after Waitdraw() should work.


Also, is it possible to make this into a function? I may have to repeat this a few times.
Sure. I think this should do it:

const int SOLIDFFC_BIG_LINK = 0;

void solidifyFFC(ffc solidFFC)
{
int hitboxAdjustment=0;
float xOverlap;
float yOverlap;
if(SOLIDFFC_BIG_LINK==0)
hitboxAdjustment=8;

if(Link->X+16>solidFFC->X && Link->X<solidFFC->X+16*solidFFC->TileWidth &&
Link->Y+16>solidFFC->Y && Link->Y+hitboxAdjustment<solidFFC->Y+16*solidFFC->TileHeight)
{
if(Link->X<solidFFC->X)
xOverlap=Link->X+16-solidFFC->X;
else
xOverlap=solidFFC->X+16*solidFFC->TileWidth-Link->X;

if(Link->Y<solidFFC->Y)
yOverlap=Link->Y+16-solidFFC->Y;
else
yOverlap=solidFFC->Y+16*solidFFC->TileHeight-(Link->Y+hitboxAdjustment);

if(xOverlap<yOverlap)
{
if(Link->X<solidFFC->X)
Link->X=solidFFC->X-16;
else
Link->X=solidFFC->X+16*solidFFC->TileWidth;
}
else
{
if(Link->Y<solidFFC->Y)
Link->Y=solidFFC->Y-16;
else
Link->Y=solidFFC->Y+16*solidFFC->TileHeight-hitboxAdjustment;
}
}
}