Mega Link: /slap
First thing: This moves Link one step toward the intended target. You have to call it more than once, until Link gets there.
Pielord: /slap
Originally Posted by
pkmnfrk
Just be careful about checking absolute position if you use my script, since FFCs won't necessarily be pixel-aligned any more.
So, if you need to check an exact position, do something like:
Code:
if(Floor(theffc->X) == 120 && Floor(theffc->Y) == 80) //do something
What you mean to do is something like:
Code:
Link->Dir = DIR_UP;
Link->Action = LA_WALKING; //I don't think this does what you think it does...
//I also made Link move at 4 pixels/tick, since that will actually get him where he's going
while(Abs(Link->X - 168) > 4 || Abs(Link->Y - 120) > 4) {
moveLinkTowards(168,120,4);
Waitframe();
}
Link->Action = LA_FROZEN;
Screen->Message(25);
Link->Dir = DIR_DOWN;
Link->Action = LA_WALKING;
while(Abs(Link->X - 168) > 4 || Abs(Link->Y - 168) > 4) {
moveLinkTowards(168,168,4);
Waitframe();
}
Link->Action = LA_NONE;
To both of you: /slap
To make Link move up and down along the Y axis, you don't need advanced trigonometry! This will suffice:
Code:
Link->Dir = DIR_UP;
Link->Action = LA_WALKING;
if(Link->Y > 120) {
while(Link->Y > 120) {
Link->Y -= 4; //in reality, you probably want him to walk slower.
Waitframe();
}
} else {
while(Link->Y < 120) {
Link->Y += 4; //in reality, you probably want him to walk slower.
Waitframe();
}
}
Link->Action = LA_FROZEN;
Screen->Message(25);
Link->Dir = DIR_DOWN;
Link->Action = LA_WALKING;
while(Link->Y < 168) {
Link->Y += 4; //in reality, you probably want him to walk slower.
Waitframe();
}
Link->Action = LA_NONE;