Joe123
10-13-2007, 05:25 AM
Circles, circles, circles.
I want an FFC that moves in a circle. So I tried the traditionnal (or at least, one that I've seen around here) Sine and Cosine response:
ffc script circle{
void run(){
int n = 1;
while(true){
this->X = Cos(n);
this->Y = Sin(n);
n++;
Waitframe();
}
}
}
Which didn't work. Just had the ffc jerking around in the top left hand corner.
Then I thought I'd try a different approach. On digging out my notes from maths yesterday: The general equation of a circle is
(x-a)^2+(y-b)^2 == r^2
Where the coordinates of the cerntre of the circle are (a,b), r is the radius and x&y are the variables as per usual.
So I plugged this into zscript (which I'm sure I did do very wrong)
giving me:
ffc script circle{
void run(){
int n = 1;
while(true){
9 == (n-100)^2 + (n-100)^2;
n++;
Waitframe();
}
}
}
Which won't even compile; apparently it can't cast from bool to float on the line with the equation. If I knew what that meant...
Also, if I'm just doing mathematics in a script, can I just use the normal brackets for them (obviously I need brackets here) or do they clash because they have seperate functions also?
I want an FFC that moves in a circle. So I tried the traditionnal (or at least, one that I've seen around here) Sine and Cosine response:
ffc script circle{
void run(){
int n = 1;
while(true){
this->X = Cos(n);
this->Y = Sin(n);
n++;
Waitframe();
}
}
}
Which didn't work. Just had the ffc jerking around in the top left hand corner.
Then I thought I'd try a different approach. On digging out my notes from maths yesterday: The general equation of a circle is
(x-a)^2+(y-b)^2 == r^2
Where the coordinates of the cerntre of the circle are (a,b), r is the radius and x&y are the variables as per usual.
So I plugged this into zscript (which I'm sure I did do very wrong)
giving me:
ffc script circle{
void run(){
int n = 1;
while(true){
9 == (n-100)^2 + (n-100)^2;
n++;
Waitframe();
}
}
}
Which won't even compile; apparently it can't cast from bool to float on the line with the equation. If I knew what that meant...
Also, if I'm just doing mathematics in a script, can I just use the normal brackets for them (obviously I need brackets here) or do they clash because they have seperate functions also?