?
Plotting y=sint,x=cost is exactly the same as plotting y=cost,x=sint
Printable View
?
Plotting y=sint,x=cost is exactly the same as plotting y=cost,x=sint
That doesn't make any sense. For that to be true, COS(t) would have to equal SIN(t), which it does not.
http://www.themathpage.com/atrig/gra...m#sine%20graph
http://www.themathpage.com/atrig/graphs-trig.htm#cosine
It's the same wave, but offset by 1/2 Pi
I know the difference between sine and cosine.
It does, however, make sense.
When plotting a circle parametrically, it doesn't matter whether you use sine or cosine on the x or y, provided you don't use them for both (otherwise you'll get a diagonal line, which makes sense as y = x).
Have a look:
Will produce the exact same result as:Code:ffc script circle{
void run(){
int x = 80; int y = 80;
int r = 32;
while(true){
for(int i;i<360;i++){
int x2 = y+r*Cos(i);
int y2 = x+r*Sin(i);
Screen->PutPixel(6,x2,y2,Rand(10),0,0,0,128);
}
Waitframe();
}
}
}
Code:ffc script circle{
void run(){
int x = 80; int y = 80;
int r = 32;
while(true){
for(int i;i<360;i++){
int x2 = y+r*Sin(i);
int y2 = x+r*Cos(i);
Screen->PutPixel(6,x2,y2,Rand(10),0,0,0,128);
}
Waitframe();
}
}
}
Maybe for plotting a circle, but I believe in experimental data.
The script:
The results:Code:import "advmath.zh"
void moveTowards1(ffc this, int x, int y, int speed) {
int angle = findAngle(this->X, this->Y, x, y);
float dx = RadianSin(angle) * speed;
float dy = RadianCos(angle) * speed;
this->X += dx;
this->Y += dy;
}
void moveTowards2(ffc this, int x, int y, int speed) {
int angle = findAngle(this->X, this->Y, x, y);
float dx = RadianCos(angle) * speed;
float dy = RadianSin(angle) * speed;
this->X += dx;
this->Y += dy;
}
ffc script followLink {
void run(int method) {
while(true) {
if(method==1) {
moveTowards1(this, Link->X, Link->Y, 1);
} else if(method==2) {
moveTowards2(this, Link->X, Link->Y, 1);
}
Waitframe();
}
}
}
On YouTube
FFC #1 calls "moveTowards1", while #2 calls "moveTowards2". Only #1 behaves properly.
Oh, you're making triangles.
Should've read the thread a bit more carefully before I posted really.
It does work for circles though, trust me =P
Hahaha.. "ALL YOUR BASE ARE BELONG TO US!!!" I forgot about that shit. :D
Yeah, you're both right, and on a related note, It took me way too long to figure out this one:
That's the way it goes though, you feel like a dumbass, then a genius, then a dumbass again when you realize that you just figured out something everyone uses already that you probably could've googled in the first place.Code:x += cos(rad)*speed;
y += sin(rad)*speed;
I'll take a look at that script a little later joe, thanks...although watching pkmnfrk's video, there doesn't seem to be a problem with that...(maybe it was a bug in an older build?) So FFC's coordinates are stored in floats I guess.
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
If I use this on Link (assuming I can); will Link walk, or will he "float"?
Ya, I think you can. Just change "this->" into "Link->". However, he won't animate, he'll just float like you said. And you will probably need to stop the player from pressing any of the direction buttons.
Ok. I know how to get link to walk.
If Link walks over a tile/side warp, will he go where the warp says to go?