if statement using and operator not working right, help.

Hey Guys,
I have been trying to drag an object when it meets two conditions and can’t get anywhere! Here is what I have, it is a draggable object and I want to only be able be dragable when it’s x value is < 160 and y > 400. Picture dragging a box from right to left on the bottom of the screen and then when it reaches the right side of the screen you can drag it up and down in a straight line but only until you drag it back down to the bottom of the screen. I am using an if statement,
if box.x < 160 and box.y is > 400 then
box.y = 480

this seems to work until I move the mouse up higher than 400 and the box snaps to where the mouse is. Any ideas? I am really stuck!
Thanks.
SM [import]uid: 79586 topic_id: 16345 reply_id: 316345[/import]

Could you post a small section of the code plz. [import]uid: 78015 topic_id: 16345 reply_id: 60946[/import]

Please post plug and play code to replicate your issue.

Alternatively, click the premium support link above :slight_smile:

Peach [import]uid: 52491 topic_id: 16345 reply_id: 60958[/import]

Actually, I figured out how to use the and and or operators just before I saw your responses. Thanks though. But now I am having trouble with constraining my piece when going in the right direction. I will try and figure out how to post the code. Also, I would love to upgrade my membership Peaches, but I could only afford it if they had any promo codes left. Unfortunately I spent it all on gamesalad first, but in my defense that is before I knew Corona SDK existed. I am hoping I can repent from that. :slight_smile: [import]uid: 79586 topic_id: 16345 reply_id: 61095[/import]