How do I code keeping a sprite (A) in position over the left end of rectangular shaped sprite (B) as (B) rotates left or right. Say sprite B is a star ship and sprite A is a turret overlaid sprite B. I want sprite A to be able to 'orbit' sprite B and visually remain in position as sprite B rotates. Sprite B does not move, it only rotates.
Offline
Try setting the center rotation to make it work. Then simply set it to keep to the same rotation as A
Offline
In the costume/paint editor, there is a crosshair/plus sign that you can click and then select somewhere on the costume to change the center/rotation point of the sprite.
Offline
OK I found my answer
when [right-arrow v] key pressed go to front set [b_cos v] to <[cos v] of angle> set [b_sin v] to <[sin v] of angle> set [b_dy v] to <(b_sin) * (b_hyp)> set [b_dx v] to <(b_cos) * (b_hyp)> go to x: (b_dx) y: (b_dy) stop scriptWhere:
Offline
or more simply,
go to x: (([sin v] of ([direction v] of [arm v])) * (length)) y: (([cos v] of ([direction v] of [arm v])) * (length))be sure your rotating thing is at (0,0)
Last edited by thebriculator (2012-10-18 23:28:37)
Offline