Multiple orbiting cores

Started by Eppiox, April 10, 2014, 09:37:39 AM

Previous topic - Next topic

Eppiox

Howdy fine map makers,
I've been trying to make some orbiting cores, 8 of them that rotate 10 blocks away from a centre point, they are also evenly spaced apart.
The code works but my cores all fly to the same point before they start the orbit. (So if I place them in the circle- they all fly to the middle right then orbit all out of sync)
To offset their orbits I added a manually incrementing delay on each core.
It seems messy- and takes about 8 seconds for it to all fully deploy.

Is there a way- using the rotate script from the wiki to set a starting point or an offset in the rotation so all 8 cores can start in their circular positions?


Here is my code:

# rotatingShield.crpl
# Created on: 4/10/2014 11:25:12 PM
# ------------------------------------------
$delayTime:0
$fieldStrength:-1000000
$speed:1
$size:10
$x:128
$y:128
$precision:0.2

once
@PositionShield
EnableTowerField(10 <-fieldStrength mul(-1) <-fieldStrength mul(-1) 0 FALSE)
0.0 ->step
<-delayTime Delay
endonce

@PositionShield

:PositionShield
GetQueuedMoveCount eq0 if
<-step cos <-size asfloat mul <-x asfloat add 0 Round <-step sin <-size asfloat mul <-y asfloat add 0 Round <-speed QueueMove
<-step <-precision add ->step
endif

J

Looks like you used my script, so I hope I can remember how it worked.

Between once and endonce there's this line:
0.0 ->step

Change that value to change starting position on the circle. This will make it start on the middle left:
PI ->step
Add '2.0 div' or '1.5 mul' after 'PI' to make it start at top or bottom of the circle.

Eppiox

Thanks a bunch!
Works great, had to remove that extra @position in the run once (not even sure why I put that there now).