Position constraint problem

ZourathZourath Member Posts: 16
edited November -1 in Tech Support
It appears that when I constrain the Y position, the X position gets stuck. For example, this actor is supposed to move left and right, and always be constrained to a certain height, but when it gets its height location variable constrained, it cannot move left or right.

Comments

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Which behaviors did you use for movement?
  • ZourathZourath Member Posts: 16
    The move behavior.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    I'll look out for it, but I haven't been able to reproduce it.
    Do you have both move behavior Move Types set to stacked? If it is set to additive and you push both directional keys at the same time, then they may cancel each other out.

    Here is what I have:
    1. Create an actor.
    2. Add the Constrain Attribute behavior and set the Y position (self.Position.Y) to 160.
    3. Add a rule that activates with the condition, Actor receives event > key > left > is down.
    4. Add a Move behavior within that rule with Direction 180. Move Type: stacked
    5. Add a rule that activates with the condition, Actor receives event > key > right > is down.
    6. Add a Move behavior within that rule with Direction 0. Move Type: stacked
  • ZourathZourath Member Posts: 16
    How odd. That is basically how mine is set up, the only differences are the Y position is set to 30, not 160, keys a and d replace left and right, and a few other key checks which shouldn't interact with this code, and it doesn't work. That said, I found a fix. I removed the constraint and added a rule that checks to see if the Y position does not equal 30. If it doesn't then it changes the Y position attribute to 30.
Sign In or Register to comment.