Move actor on x-axis

Member Posts: 37

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 ?

• 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

• 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!

• Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,925

@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

• Member Posts: 37

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