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

# Circling and facing the right way...

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)
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
• ###### 2. Re: Circling and facing the right way...
Thanks for that link. The primer is a useful thing for getting me thinking about the problem solving but maybe a little too abstract to be of direct help. Is there a more direct way of getting to omega or is it a case of constructing a relationship like I have below?

Was the link to your site for a particular example? I couldn't find one but there's lots there, of course, for later.

So anyway, focused a bit and came up with this, which seems to work: