Move actor on x-axis

Hi guys,

I want to make an actor move only on the x-axis and not on the y-axis.

In other words I want to make the actor move left when it touch the left screen edge then move right and so on.

So what do I need to do ?

thanks in advance :)

Comments

  • ashtmjashtmj Member, PRO Posts: 405
    edited October 2014

    put 3 rules in your actor

    If device > touches> count is greater then 0
    if device> mouse position X is greater then self position X

    constrain self.Motion.Linear Velocity.X to 100

    If device > touches> count is greater then 0
    if device> mouse position X is less then self position X

    constrain self.Motion.Linear Velocity.X to -100

    and lastly

    If device > touches> count is 0

    self.Motion.Linear Velocity.X to 0

    Hope that helps!

    I also have started a guide book on youtube, watching these videos will hopefully help you start understanding the basics of game salad

  • Mr.NonameMr.Noname Member Posts: 37

    Thanks a lot :) @ashtmj‌

    My 2nd question is how can I spawn an actor in an certain area?

    So I want to spawn an actor in an rotating actor an shoot with the spawned actor from the certain area which is in the rotating actor!

    I checked your youtube channel nice stuff and good luck! :)

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @Mr.Noname said:
    So I want to spawn an actor in an rotating actor an shoot with the spawned actor from the certain area which is in the rotating actor!

    You'll have to give an example of what you mean. An image would be best or a link to an existing game with the same mechanics. Without that, I would assume you mean a tank turret... something like that?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Mr.NonameMr.Noname Member Posts: 37

    @tatiang thanks for your info :)

    but I don't know how to put in a pic haha

    So I try it to describe it better:

    I want to make an rotating actor that rotates automatically and in that actor there is an free space. You can imagine it like a rotating pac man with a fixed mouth. In the "mouth" of the rotating actor I want to be there spawned a little ball with I can shoot when I tap on the screen and it have to take that direction where the "mouth" is, so when the actor rotates to the left side off the screen and I tap there that it shoot on the left side.

    I hope it is now understandable :)

    thanks in advance

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I made a demo... is this what you mean? Click the mouse button to shoot a projectile.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Mr.NonameMr.Noname Member Posts: 37

    Exactly @tatiang‌ Thank you :)

Sign In or Register to comment.