We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, could you help me, I´m beginner on this and I would like how to make an object change color when the mouse is inside and how apply this to several objects in the same program, I got this:
void setup() { size(500,400); }
void draw() { background(0);
stroke(1); fill(170); rect(200, 150, 100, 100); }
void mouseMoved (){
stroke(1); fill (232, 287, 146); rect(200, 150, 100, 100);
}
Thanks!!!
Answers
in draw() use if to check if mouse is inside rect. if so, set is to one color, if not to another.
rect.....
to do this with multiple rects just put them one after another
or: you store the rects in an array and use for-loop to go over them
later use oop - see tutorial.
;-)