Actor vibrating after movement

ClownmrminghuiClownmrminghui Member Posts: 18
edited October 2012 in Working with GS (Mac)
Hi there,

I am trying to achieve the following :

If self.X is < than Device.position.X , move right.
If self.X is > than Device.position.X, move left.

I manage to get my actor to move, but it vibrates after stopping.

I've tried Self.X = Device.position.X, move left at speed 0 (to force it to stop), but it didn't work.

Any help?

Thanks in advance.

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    That is the perfect recipe to make something 'vibrate'. The chances that an actor will be exactly at 'Device.position.X' is very small. It will almost always either be more or less than that. (Even by .001 pixel.)

    Try making a 'dead zone' where you can set speed to zero. Something like:
    If self.X is < than (Device.position.X - 5) , move right.
    If self.X is > than (Device.position.X + 5), move left.
  • ClownmrminghuiClownmrminghui Member Posts: 18
    Hello RThruman,

    thanks for your reply. Allow me to give this a shot. Will let you know soon.
  • ClownmrminghuiClownmrminghui Member Posts: 18
    IT WORKS! THANKS! :)
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Glad its working for you!
Sign In or Register to comment.