Created
March 15, 2012 17:40
-
-
Save levinotik/2045541 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGPoint touchLocation = CCDirector.sharedDirector().convertToGL(CGPoint.make(ev.getX(), ev.getY())); | |
if(touchLocation.x > largestX || touchLocation.x < smallestX) { | |
if(!(touchLocation.y > largestY || touchLocation.y < smallestY)) { | |
sprite.setPosition(sprite.getPosition().x, touchLocation.y); | |
} | |
} else if(touchLocation.y > largestY || touchLocation.y < smallestY) { | |
if(!(touchLocation.x > largestX || touchLocation.x < smallestX)) { | |
sprite.setPosition(touchLocation.x, sprite.getPosition().y); | |
} | |
} else { | |
sprite.setPosition(touchLocation.x, touchLocation.y); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment