move acotor back and forward

chrisalchrisal Member Posts: 74
edited November -1 in Working with GS (Mac)
Ho can i get an actor to move back anf forward between 2 points without endless move to then move to statements????

Many thanks
Chris

Comments

  • MotherHooseMotherHoose Member Posts: 2,456
    How are you initiating the move? Touch? ...Button? ... Timer? ...???

    and why moveTo and not interpolate X or Y of the actor?

    MH
  • ancchancch Member, PRO Posts: 103
    Use change velocity to set the actor moving in a particular direction.
    Then use timer: every x seconds change attribute "self.motion.linear.x = -self.motion.linear.x"
    Note the negative sign.
  • chrisalchrisal Member Posts: 74
    go on then how does interpolate work???

    Not Used it before
  • azavegaazavega Member Posts: 362
    ok got the same issue trying to move and object between 20 and 300 on X like a loop motion , no stop...
    how to do that
  • MotherHooseMotherHoose Member Posts: 2,456
    @chrisal

    as I say to the grandkids... I am NOT yelling; I am telling.

    How does interpolate work?... great.
    but it is capable of doing so much... need a long tutorial to explain it all...

    so I am going to suggest that you open a new My Great Project... and put it in iPad Landscape so you have plenty of room to play in.
    Create an actor... drag it 6 times to the screenArea
    click on an actor in the scene... unlock...
    Create a [Rule] when touch is pressed
    drag the interpolate behavior to the rule...
    and change something like self.Position.X, self.Position.Y, self.Color.Alpha, self.Color.Red,self.Size.Width, or etc. pick one thing for each actor...
    explore duration and Function: Linear, Ease In, etc.

    when you finish playing... you will understand a lot about Interpolate ... and further explore with confining rules like if self.Position.X is > 500 interpolate self.Position.X to 50 Otherwise if self.Position.X is 50 interpolate to self.Position.X to 500!

    Enjoy yourself!

    MH
Sign In or Register to comment.