We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, so for a project that I'm doing I'm trying to divide mouseX by mouseY, however when I try I can't start the program because I get a divide by zero message. I'm guessing it's doing this because mouseY could POTENTIALLY end up at zero, even though it doesnt start off there, so it just blocks off the program from starting to prevent it from happening (that's my guess although I could be wrong). How can I fix this?
Answers
@john832 --
No, this is an actual (runtime) error, not a potential one. On frame 1 mouseX and mouseY may each be initialized to zero, and updated thereafter with the first mouse cursor position on frame 2.
@GoToLoop's solution prevents the assignment on that first frame -- or anytime the mouse hits the top edge of the sketch frame thereafter.