PDA

View Full Version : this->solid = true?



Mega Link
02-18-2008, 11:40 AM
Is it possible to create a variable that makes a ffc solid via Global Script, and then say

this->solid = truein the ffc script?

If so, how do you do it?

Joe123
02-18-2008, 01:12 PM
Heh, ffcs can't be solid at all.
You could script pseudo solidity though.
Beefster's asking about it at Pure at the moment.

C-Dawg
02-18-2008, 01:43 PM
Hasn't this already been scripted, like, five times?

Mega Link
02-18-2008, 02:14 PM
Hasn't this already been scripted, like, five times?
It has!? Where is it?

I looked everywhere, I can't find anything.

Joe123
02-18-2008, 02:53 PM
I haven't actually seen it scripted anywhere, although I'm sure it wouldn't be too hard to do.

C-Dawg
02-18-2008, 03:23 PM
Here you go. You may need to tinker with the close variable. Smaller variable will make a smaller hitbox for the FFC. close = 15 should make it so Link can't move onto the block if any pixel would touch.

Another thing you can change is what happens when Link tries to step on the combo. Right now, it bumps him back 2 pixels. You could change it so it just cancels out the input (Link->InputUp = false), or maybe keep track of Link's previous position and move him back to that.

I havn't tested it yet, so who knows if it compiles.

If you want this code on a script that does something else, just copy the four if statements and plunk them into your while loop in the code you're using. Then add the "close" variable at the start of the target code.




ffc script fake_solid{

void run(){

int close = 15; // determines how close Link has to be to the block
// to be blocked by it.

while(true){

if(
(Abs(Link->X-this->X)<=close) &&
(Abs(Link->Y-this->Y)<=10) &&
(Link->Y > this->Y) &&
(Link->InputUp)
){
Link->Y = Link->Y -2;
}

if(
(Abs(Link->X-this->X)<=close) &&
(Abs(Link->Y-this->Y)<=18 &&
(Link->Y < this->Y) &&
(Link->InputDown)
){
Link->Y = Link->Y + 2;
}

if(
(Abs(Link->Y-this->Y)<=close) &&
(Abs(Link->X-this->X)<=18 &&
(Link->X < this->X) &&
(Link->InputRight)
){
Link->X = Link->X - 2;
}

if(
(Abs(Link->Y-this->Y)<=close) &&
(Abs(Link->X-this->X)<=18 &&
(Link->X > this->X) &&
(Link->InputLeft)
){
Link->X = Link->X + 2;
}

Waitframe();
} // end of while loop

} // end of void run

} // end of ffc script