Limiting number of pixels objects move up or down?? HElp

Guy’s I have two buttons that move the character up/down. I don’t want to use physics to create boundaries. I want when the user taps the up button it goes up 30 pixels and then disables itself until the objects is lower 30 pixels. The same for the down button.

local moveDist = 10;  
  
local OnTrack = function ()  
 if(player.y \< 200) then  
 moveDist = 0;  
 else  
 moveDist = 10;  
 end  
end  
  
Runtime:addEventListener("enterFrame", OnTrack)  

Right with this code the player still goes above and I guess it never moveDist never gets set to “0” [import]uid: 53149 topic_id: 11564 reply_id: 311564[/import]

Ignore this… I guess I was a little impatient. I got the solution. Thanks All! [import]uid: 53149 topic_id: 11564 reply_id: 42001[/import]

Glad to hear you got it resolved :slight_smile: (Satisfying, right?)

Peach :slight_smile: [import]uid: 52491 topic_id: 11564 reply_id: 42100[/import]

Yes, very much so!!! [import]uid: 53149 topic_id: 11564 reply_id: 44182[/import]