Unable to adjust the parameters of a gloabal variable later in the code
in
Programming Questions
•
2 years ago
I have included a simplified version of the code I am currently struggling with...in short - I have defined several gloabl variables which I am using in my class. However, I tried but could not adjust the parameters of these variable anywhere later in the code..
float x1,y1,z1 = 0;
float x2,y2 = 100
float z2 = - 100;
void setup() {
point1 = newPointS (0,0,0);
println(y1 = y1 + 10);//It does print the result
if (mousePressed) {
y1 = y1 + 10;// No change happens on the sketch
}
void draw() {
point1.drawPoint();
}
class PointS {
float x1,y1,z1
PointS (float, xpos,ypos,zpos) {
x1 = xpos;
y1 = ypos;
z1 = zpos;
void drawPoint() {
strokeWeight(2);
point(x1,y1,z1);
}
}
1