We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm very new to programming + processing and I'm trying to make a program where every time the mouse is clicked a point is drawn where the mouse was clicked, and each point is connected to the previous point through a line. So far I've figured out how to draw a point when/where the mouse is clicked, and I've figured out how to draw line continuously as long as the mouse is held down, but I haven't figured out how to simply connect the points drawn. I know there's a way to connect line through the previous mouse position, but is there a way to connect only to the last position where the mouse was clicked? Thanks! Here is what I have so far:
void setup(){
size(500,500);
background(200);
}
void draw(){
if (mousePressed == true){
point(mouseX,mouseY);
}
}
Answers
https://forum.Processing.org/two/discussion/20153/trying-to-understand-how-boolean-and-return-work
You can declare variables to store the previous x/y positions. For example, this would be your code:
Hope it helped! :)