Using constrain() with KeyPressed

edited March 2015 in How To...

So I saw this example on constrain() void draw() { background(204); float mx = constrain(mouseX, 30, 70); rect(mx-10, 40, 20, 20); }

And I was trying to use it in my program that has WASD movement, but the experiment was unsuccessful. I was wandering how I would use it to stop my Ball when it hits the edge of the screen. Thank you!


Sign In or Register to comment.