Learn creative coding writing simple programs

65. Are we getting close? Use dist() to find out the distance

The dist() function can be used to find out the distance between to points. In our example we test how far is a moving circle from the mouse pointer by writing: float d = dist(x, y, mouseX, mouseY);
Now that we know the distance, we can do different things when we are getting close to our destination.

Tags: dist, distance, Lesson

Code editor

You can make changes to the code below. Then
Below you can ask and answer questions related to this video. If your question is unrelated to the video, please post it at the Processing Forum as I'm unable to help with all of your programs and still have enough free time to eat and sleep :)
comments powered by Disqus