Jump to content

Photo

FFC solidity


  • Please log in to reply
5 replies to this topic

#1 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 01 December 2008 - 01:22 PM

I want to make 16x32 moving FFC, but they can't be solid... How can I do this? Or can anyone do this for me? If I need to give the combos I use for the FFC a certain combo type, that could work as well.
Remember, the FFCs I want are 16x32.
Thou shall be credited!

#2 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 02 December 2008 - 05:08 PM

Is my request very complicated or such?
If it is to hard to make, I won't use it. It's no necessity.

#3 Saffith

Saffith

    IPv7 user

  • Members

Posted 03 December 2008 - 12:09 AM

This should do it:

CODE
// 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()
    {
        float xOverlap;
        float yOverlap;
        
        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 if(SOLIDFFC_BIG_LINK==0)
                    yOverlap=this->Y+16*this->TileHeight-(Link->Y+8);
                else
                    yOverlap=this->Y+16*this->TileHeight-Link->Y;
                
                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 if(SOLIDFFC_BIG_LINK==0)
                        Link->Y=this->Y+16*this->TileHeight-8;
                    else
                        Link->Y=this->Y+16*this->TileHeight;
                }
            }
            Waitframe();
        }
    }
}


Although it'll act a bit oddly if diagonal movement isn't enabled.

Edited by Saffith, 03 December 2008 - 12:21 AM.


#4 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 03 December 2008 - 08:39 AM

Diagonal movement is enabled! So I guess it will work better then. icon_smile.gif Thanks for lending your scripting power, I will test this, but I guess it works. If not..., you'll see.

Edit: It works flawless, except "hitboxAdjustment" wasn't declared. But I added it myself as variable.

Edited by Twilight_Knight, 03 December 2008 - 10:07 AM.


#5 Saffith

Saffith

    IPv7 user

  • Members

Posted 03 December 2008 - 10:39 AM

Oop. Should've known I'd break something screwing around with it once it worked... icon_razz.gif
It was supposed to be more like this:

CODE
// 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();
        }
    }
}


#6 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 03 December 2008 - 06:11 PM

I will look if that works better tomorrow.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users