Orbiting an actor AND following mouse / finger gestures..

OK so I had a look at this tutorial on orbiting a point in gamesalad..

(Great work Mr ShirtBooth, thx for the pointers)
Now I want to have my actor do this BUT also follow my finger as if I had constrained the rotation to mouse position X. In other words
I want the actor to stay in orbit but follow my gestures for direction and speed.. Am I making sense? It's done my head in this morning so I
thought I'd see what the hive mind has to say on the topic.
Any help is as always, hugely appreciated.
Thanks in advance
Lbc4ever.

(Great work Mr ShirtBooth, thx for the pointers)
Now I want to have my actor do this BUT also follow my finger as if I had constrained the rotation to mouse position X. In other words
I want the actor to stay in orbit but follow my gestures for direction and speed.. Am I making sense? It's done my head in this morning so I
thought I'd see what the hive mind has to say on the topic.
Any help is as always, hugely appreciated.
Thanks in advance

Lbc4ever.
Comments
Constrain self.position.y to game.mouse.position y + (radius * sin(angle))
Should do it.
The angle is a value going from 0 to 360. You can constrain use a constrain atribute for this: angle= self.time%360 (@tShirtbooth does the same thing in the video. My formula orde is a little different I believe)
Ask if you don't understand some of the syntax.
Lump Apps and My Assets
Will let you know how I get on.
Many thanks
What I now get is my actor travelling diagonally up & down the screen (following mouse position x) and rotating around the centre (sun x & y) before carrying on in a straight line.
I'd like the actor to stay within a certain radius of the "sun" and orbit left or right depending on how I move my finger.. I'm goin to carry on headscratching for a bit & get back to you.
Thanks again.
Lbc4ever.
Lump Apps and My Assets
"I'd like the actor to stay within a certain radius of the "sun" and orbit left or right depending on how I move my finger.."
What's defining whether the actor orbits left or right is the speed of the orbit (minus values = clockwise / positive values = counterclockwise) . . . so all you have to do is dynamically control the speed of the orbit with whatever control you want (your finger on the screen in this case).
Assuming an initial speed of 200 (self-time * 200) and an iPad screen of 1024 pixels wide . . . and let's imagine our goal is to have the actor orbit at a speed -200 (200 clockwise) when your finger is on the far left of the screen and +200 (200 counterclockwise) when your finger is on the far right of the screen we should do the following . . .
Constrain the actors X to 200 * cos ( self-time * ( ( Game - mouse position X divided by 2.56 ) - 200 ) ) + 512
Constrain the actors Y to 200 * sin ( self-time * ( ( Game - mouse position X divided by 2.56 ) - 200 ) ) + 384
http://www.mediafire.com/?htx3slle7xd51ts
. . . but then again I am a shallow cheapskate. :bz :bz :bz
I will pillage that template and be sure to mention you in the game credits. Awesome.
@ Tynan, thanks man, I can learn a lot from that before trying to get my head around more complex stuff.
THis forum NEVER fails. I only look forwards to the day when I can repay the favour.
Many, many thanks guys.
Lbc4ever.
That first post nailed it. Salute