Me and my 13 year old son just started to learn programming in processing with the guidence from “the coding train”.
I have a hard time explaining how easy the coorinate system is. Drawing on paper and stuff but I guess I suck at explaining it.
With the visuals of two lines following the mouse at the same time as x and y coordinates is printed in the window I think he could get it right away.
So… im looking for the simpliest way to make to lines follow my mouse cursor.
I want them to keep straight also so theres always 2 straight lines following the mouse from x and y. So if I holde the mouse in center I would have a box like shape from the 2 lines. one coming straight down from the top and the other out from the left.
Aslo, I would love the coordinates x and y printed in a corner of the window.
A bonus would be if points could be created by clicking the mouse button but in my head that might complicate the code even more? Could help when comparing different coorinates and talking about it.
I tried and this is how far I got with my poor skills.
void setup(){
size(640,320);
}
void draw(){
stroke(0);
line(mouseX,mouseY, 1, mouseY);
// background(255);
}
With this test I made lines are created correctly but they stay on screen! I end up filling the screen with lines.
I tried the backround under the line to see if That would erase the prevoius line but af cource it stacks above the line roe all together.
Anyone up for making a example on a code like I am asking for or if there is any guide I havent found jet?
Thx