Hey guys. I've got a strange Problem.
I tried to work with a tutorial on youtube, which got the same title as my topic
My program works fine until i try to use a function for moving the planet around the sun.
the working sourcecode looks like this (without using the function "RotateAroundSun"):
sync on
Backdrop on
Color Backdrop 0
radius as float
grad as float
xpos as float
ypos as float
distance as float
autocam off
position camera 0,0,0,50
point camera 0,0,0,0
GeneratePlanet(1,2,0)
GeneratePlanet(2,10,15)
do
planetnumber=1
radius=15
inc grad,0.01
grad = wrapvalue(grad)
xpos = radius * cos(grad)
ypos = radius * sin(grad)
position object PlanetNumber,xpos,ypos,0
sync
loop
END
Function RotateAroundSun(PlanetNumber,radius,speed)
inc grad,speed
grad = wrapvalue(grad)
xpos = radius * cos(grad)
ypos = radius * sin(grad)
position object PlanetNumber,xpos,ypos,0
sync
EndFunction
Function GeneratePlanet(number,size,distance)
Make Object Sphere number,size
Move Object number,distance
EndFunction
Okay. When i use the function f.e
do
RotateAroundSun(1,15,0.1) // Sphere1,r=15,Rotatingspeed=0.1
sync
loop
The Planets get generated but dont move.
What am i doing wrong?
Greetings from Germany and thanks in advance.