Here you go:
direction = 0 anchor_sine = 0 anchor_x = 64 function _update() direction += .05 anchor_sine += .01 anchor_x = 64 + sin(anchor_sine) * 40 end function _draw() cls() circfill(anchor_x, 64, 1.5, 7) circfill(anchor_x + cos(direction) * 10, 64 - sin(direction) * 10, 1.5, 8) circfill(anchor_x + cos(direction / 2) * 20, 64 - sin(direction / 2) * 20, 1.5, 9) end |
- Blokatt
P#20321 2016-05-08 15:52 ( Edited 2016-05-08 20:05)
Pasted it all in and worked great...wasn't even expecting the moving anchor, pretty sweet. But wasn't exactly sure what all the variables controlled, so I annotated it some more with extra variables. Thanks again!
anchor_sine=0 anchor_x=64 anchor_y=64 speed=.05 radius=20 ccw=false --counterclockwise? direction=0 --leave at zero function _update() anchor_sine += .01 anchor_x = anchor_y + sin(anchor_sine) * 40 --this is speed/distance of anchor movement end function _draw() cls() --center point circfill(anchor_x, anchor_y, 1.5, 7) --get direction based on flag if (ccw) then direction -= speed --counterclockwise else direction += speed --clockwise end --orbiting circle circfill(anchor_x + cos(direction / (radius/10)) * radius, anchor_y - sin(direction / (radius/10)) * radius, 1.5, 9) end |
P#20339 2016-05-08 20:48 ( Edited 2016-05-09 00:48)
[Please log in to post a comment]