How does the planet orbiting the map work? (rotate in a circle)

Started by PsudoSage, October 16, 2013, 03:02:08 AM

Previous topic - Next topic

PsudoSage

I would like to try some of this CRPL stuff and would like to be able to make emitters that 'orbit' a central position, I'm assuming there's going to be some trig stuff in there with the sin/cos stuff but its hard enough to wrap my head around a stack language as it is without trying to add trig & stack together. I would like to see if there is someone who could show me a quick simple example that I can work from a bit like the map with the planet that orbits the map.

Thanks.

Edit: Its ok i found an example in the examples thread, im a derp.

knucracker

Btw, don't panic too much about the stack based nature of CRPL.  Most of the time you can use the warp operator and not even think about the stack.  For instance, if you want to generate X and Y coordinates that move in a circle you might do this


once
   10 ->centerX
   10 ->centerY
   0 ->currentAngle
endonce

<-centerX add (cos(<-currentAngle)) ->x
<-centerY add (sin(<-currentAngle)) ->y
<-currentAngle add(0.1) ->currentAngle