- This wiki is out of date, use the continuation of this wiki instead
Tutorial:Cosine
From FenixWiki
Some sine and cosine program. Check it out. More of example code, but useful anyway.
Example code
Program cosine;
Begin
set_fps(60,0);
timer[1]= 200;
Repeat
if(timer[1]>=200)
timer[1] = 0;
x = new_map(20,20,8);
map_clear(0,x,rgb(rand(0,255),rand(0,255),rand(0,255)));
ball(x);
end
frame;
Until(key(_esc))
let_me_alone();
End
Process ball(graph)
Begin
z = 0;
Loop
x = 160+cos(z)*150;
y = 100+sin(z*2)*90;
z+=2000;
frame;
End
End
Used in example: set_fps(), new_map(), map_clear(), key(), let_me_alone(), cos(), sin(), timer, x, y
