I am completely new to Processing, so more than grateful for any advice to achieve the following:
- making a moving object stop when hovering over it
- and open a new object when clicking on it
Below is the beginning of the code (i.e.. if I go for example with the mouse over 'A', 'A' should stop; if I then click on 'A', it should open or link to sth; the same for 'B', 'C' and 'D' etc.)...
Thanks so much for any help with this or any hint in the right direction!
-------------
class Writing {
float x;
float y;
int radius;
float speed = 0.5;
int direction = 1;
Writing (float tempX, float tempY, int tempRadius) {
x = tempX;
y = tempY;
radius = tempRadius;
}
void move1 () {
x += speed * direction;
if ((x > width - radius-520) || (x < radius + 110 && direction < 0)) {
direction = - direction;
}
}
void move2 () {
x += speed * direction;
if ((x > width - radius-340) || (x < radius + 430 && direction < 0)) {
direction = - direction;
}
}
void move3 () {
x += speed * direction;
if ((x > width - radius-340) || (x < radius + 430 && direction < 0)) {
direction = - direction;
}
}
void move4 () {
x += speed * direction;
if ((x > width - radius-120) || (x < radius + 600 && direction < 0)) {