Skip to content

Instantly share code, notes, and snippets.

@ZachMassia
Created November 12, 2012 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZachMassia/4056920 to your computer and use it in GitHub Desktop.
Save ZachMassia/4056920 to your computer and use it in GitHub Desktop.
// Bounds check
if(posX < 0)
posX = 0;
else if(posX > (screenW - boundX))
posX = screenW - boundX;
if(posY < 0)
posY = 0;
else if(posY > (screenH - boundY))
posY = screenH - boundY;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment