the constructor sketch Paddle is undefined ======> can't solve problem
in
Programming Questions
•
1 year ago
i recently wrote some code but no matter what, i keep receiving the message above.
here, what i wrote:
Paddle myPaddle;
void setup()
{size(500, 500);
myPaddle = new Paddle(0); //======> this line apears highlighted when i click run button
}
void draw()
{background(0);
myPaddle.display();
}
class Paddle
{
boolean side;
Paddle (boolean tempSide)
{
side = tempSide;
}
void display()
{noStroke();
fill(255);
rectMode(CENTER);
if(side==0) rect(25, mouseY, 50, 100);
else rect(475, mouseY, 50, 100);
}
}
here, what i wrote:
Paddle myPaddle;
void setup()
{size(500, 500);
myPaddle = new Paddle(0); //======> this line apears highlighted when i click run button
}
void draw()
{background(0);
myPaddle.display();
}
class Paddle
{
boolean side;
Paddle (boolean tempSide)
{
side = tempSide;
}
void display()
{noStroke();
fill(255);
rectMode(CENTER);
if(side==0) rect(25, mouseY, 50, 100);
else rect(475, mouseY, 50, 100);
}
}
1