2 Replies Latest reply on Oct 11, 2008 6:38 AM by Bob220867

    Circling and facing the right way...

    Bob220867
      I want a character to walk in circles when unattended but can't work out how to get it to face the direction it is going in the circle.

      How would I add the correct rotation to this? Or is there a better way to achieve this?

      Here is the code I'm basing it on:
      on beginSprite me
      my=sprite(me.spriteNum)
      circRadius = 200.0
      circCenterX = 320.0
      circCenterY = 240.0
      circPos = 0.0
      end

      on exitFrame me
      x = circRadius * cos(circPos) + circCenterX
      y = circRadius * sin(circPos) + circCenterY
      newLocH=x
      newLocV=y
      my.loc = point(x,y)
      circPos = circPos + 1
      end