We are about to switch to a new forum software. Until then we have removed the registration on this forum.
why does this change the boolean to true without mouse clicking?
I know the fix to the problem is to just use if (button), but why does if (button=true) make the boolean true?
boolean button = false;
int circleX = 0;
int circleY = 100;
void setup() {
size(200, 200);
}
void draw() {
background(100);
stroke(255);
fill(0);
ellipse(circleX, circleY, 50, 50);
if (button = true) {
circleX = circleX + 1;
}
}
void mousePressed() {
button = !button;
}
Answers
= is an assignment
== is a test
ofcourse, thanks
https://processing.org/reference/assign.html
https://processing.org/reference/equality.html