Keep Object From Moving on Y Axis

Hey everyone. Long time no see. I was wondering how I would keep a movable object from moving up or down when colliding with another object. It has to be able to move along the X axis but not the Y. Thanks everyone. :)

Best Answer

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Constrain attribute self.position.Y to self.position.Y

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

  • SolarPepperStudiosSolarPepperStudios Member Posts: 754
    edited February 2014
    @tatiang I tried that but it wouldn't work... :-/
    Edit: I might also mention that the objects I don't want to move up or down are moving along the X axis automatically. (Think of the pipes in Flappy Bird)
  • SolarPepperStudiosSolarPepperStudios Member Posts: 754
    Tried all of those suggestions except the last one. That last one will be tricky if they are spawned at a random height but I know its possible to do.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Tried all of those suggestions except the last one. That last one will be tricky if they are spawned at a random height but I know its possible to do.
    I'm not sure if it will help to do it but it's actually really simple. In your spawned actor, do change attribute self.startY (real) to self.position.Y. Make sure that behavior is at/near the top of the actor's rules. Then constrain attribute self.position.Y to self.startY.

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

Sign In or Register to comment.