GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

I want my actor to move in a circular path

Hii,
I want my main actor to move in a circular path, like if left side of the screen is pressed actor should move in a clock wise circular path and vice versa. Pls help me....

thanks

Comments

  • SocksSocks London, UK.Posts: 12,822Member
    edited October 2016

    The easiest /most flexible way to do this would be to use a separate controller actor.

    Make a 'controller' actor, throw it into the scene somewhere, it can be invisible or off to one side so you don't see it, or even make its dimensions 0,0 . . . etc etc . . . basically you don't need to see it in the actual game.

    Set up a rule where your left and right screen presses rotate this controller actor. For example . . . (landscape iPad screen sizes used) . . .

    When mouse button down
    --When mouse X position > 512
    ----Rotate CW
    --Otherwise
    ----Rotate CCW

    Ok, so now you have a little controller actor that rotates CW or CCW depending on which side of the screen you press.

    Now in your main actor, the one you want to move in a circular path, give it these three behaviours . . .

    Constrain X to Radius *cos(controller's rotation)+main actor's X centre
    Constrain Y to Radius *sin(controller's rotation)+main actor's Y centre
    Constrain Rotation to controller's rotation

  • SocksSocks London, UK.Posts: 12,822Member

    example file attached . . . click/touch left or right to move . . .

    c.zip 19.8K
  • blackmoroiblackmoroi Posts: 28Member
    edited October 2016

    thanks for the reply, This is what i need but my actor should move in a straight path if we are not pressing on the screen. To be more specific the actor should follow a tangential path when screen is not pressed. Pls help me

    http://images.tutorvista.com/cms/images/83/tangential-acceleration-image.png

  • SocksSocks London, UK.Posts: 12,822Member

    @blackmoroi said:
    thanks for the reply, This is what i need but my actor should move in a straight path if we are not pressing on the screen.

    Lol.

  • -Timo--Timo- Posts: 2,313Member

    move
    direction 0 relative to actor
    speed 300 or whatever

    if mouse button is down
    rotate clockwise
    speed 200 or whatever

Sign In or Register to comment.