side to side interpolate help!

threepeasoupthreepeasoup Member Posts: 33
edited November -1 in Working with GS (Mac)
Hello Gamesalad community!

I have searched and filtered through the forums looking for an answer to my problem but to no avail! So I will ask it myself. :D

I am trying to use interpolate to move an unmovable object side to side from its "current" position on screen.

If anyone can point me to the right direction I would greatly appreciate it!

Best,

Threepeasoup

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    You need 2 interpolate rules

    Have the first rule when attribute self position x=200 (replace 200 with whatever the starting position is)
    interpolate self position x to 400(or wherver you want it to slide to and stop)

    Then another rule when attribute self position x=400 (again replacing that with whatever you changed 400 to in the above rule)
    interpolate self position x to 200(or whatever the starting position is)

    cheers
  • simo103simo103 Member, PRO Posts: 1,331
    what I did was to put a rule that if the actors self.position x< a certain x value (say 100) then interpolate to position x (say 301) then I also have a rule if self.position x > 300 interpolate to self.positionx =99

    this way it will go just a hair passed each value. I then make sure it starts either <100 or >300 so it triggers to start. You can control the speed with the duration in interpolate.

    hope that helps.

    Saw Johns post which I think says much the same as mine ... I think I saw someone else recommend the <> rather than equals as the actor could move to x=400.001 and then the rule wouldn't work.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    simo103 said:
    what I did was to put a rule that if the actors self.position x< a certain x value (say 100) then interpolate to position x (say 301) then I also have a rule if self.position x > 300 interpolate to self.positionx =99

    this way it will go just a hair passed each value. I then make sure it starts either <100 or >300 so it triggers to start. You can control the speed with the duration in interpolate.

    hope that helps.

    Saw Johns post which I think says much the same as mine ... I think I saw someone else recommend the <> rather than equals as the actor could move to x=400.001 and then the rule wouldn't work.

    I've found the greater than and less than functions to be more reliable since it doesn't always stop on your set value and if it doesn't react instantly when it hits the value you have set it will miss the move back.
  • threepeasoupthreepeasoup Member Posts: 33
    Hey thanks everyone!

    It works great!
Sign In or Register to comment.