problem with reverse constrain position and max position

patapplepatapple Member Posts: 873
edited July 2012 in Working with GS (Mac)
hi guys,

I'm trying to create a rectangle the constrain the position to the mouse and also constrain to a min and a max position of the screen and it works great.
now I created a "special" power up that reverse this control. when the player drag left, the rectangle go right with a special expression. I added the expression for the min and the max position but now this two expression when the power up is activated don't work!

here is a screenshot of the rules for the special power up:
image

cheers and thanks and i hope you understand my problem :D

Best Answer

  • gyroscopegyroscope I am here.Posts: 6,598
    Accepted Answer

    @patapple

    I think I get why you're after... as far as I can make out from your screenshot, you're constraining self.position.x, then immediately constraining it again with a different equation; making the first equation redundant.... any help?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Answers

  • patapplepatapple Member Posts: 873
    @gyroscope before this rule there is a simple constrain attribute self.position.x to game.mouse.position.x
    then when a specific attribute is activated i want the this control now are reverse (this works fine)
    the problem is that there is an expression to limit the constrain to a certain position but the same rule in the reverse constrain doesn't work.
    do you understand the problem?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2012

    Oh, silly me, my mistake; :P – I see now, you're putting two different types of constraints onto self.Position.X which is fine, of course.

    Could you post the other version please?

    create a rectangle the constrain the position to the mouse and also constrain to a min and a max position of the screen and it works great.
    I'd like to compare them to see if I can help out.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • patapplepatapple Member Posts: 873
    here they are:
    this is the normal one:
    image
    and this is the reverse one:
    image
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2012

    Hi again,

    it's great you've got this first one working; I've been scratching my head over the 2nd constrain equations in each case, where it seems you've put a min expression as the y value of the max. I really can't work that one out! (Perhaps I'm being slow today...) But hey, if it's working for you, then great!

    The second one, that's not working, I think it's because: say the actor drags left, the rectangle moves right only until the rule When touch is pressed is valid; as soon as it gets outside of the touch drag, it no longer works.... hope I've explained that OK....

    For the opposite that you want, maybe put When game.inverse is true etc without the when touch is pressed rule.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Testing: just wrote a reply, posted it and it didn't show up....

    I'll try again in a sec....

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi again, I must be a bit slow today when it comes to your limiting equations in each case: I've been scratching my head trying to understand why you've the min expression as the y value in the max expression (I must be slow today... ;-) ) but, hey, as long as it's working for you!!

    For your prob, I think it's because of the When touch is pressed Rule: as soon as the rectangle moves opposite to the touch drag and is no longer under the touch, then it won't work.

    So try removing the touch rule in that case, just have: When game.inverted is true, etc.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • patapplepatapple Member Posts: 873
    hi, i tried to put the rule without the pressed in the normal pressed rule but it doesn't work. i also tried to turn off the rule that limit the position and the reverse movement works fine but obviously it doesn't stop to the max position!
Sign In or Register to comment.