How do I draw inside a class?
I'm creating a game for a university project and I would like to make a dashed circle indicating the area that the player has to reach to follow the path, however when I use "dashed = new DashedLines(this);" the program says that "The constructor DashedLines(CUBWAY_Ver_4_2.ObstaculoNvl3) is undefined".
I would like to know how I can solve this.
This is the class in question, I would like to know what I have to put in place of "this". Sorry if it's obvious, I'm still learning.
//
DashedLines tracejado;
class ObstaculoNvl3 {
int NdPontas;
float PX0, PY0, PX1, PY1;
int Raio;
float Ang;
float RaioT;
float m = radians(0);
float dist = 0;
ObstaculoNvl3 (int NdP, float X, float Y, int R) {
NdPontas = NdP;
Raio = R;
Ang = radians(360/NdP);
PX0 = X;
PY0 = Y;
RaioT = (Raio*2)/3;
tracejado = new DashedLines(this);
tracejado.pattern(30, 10);
}
void desenhaHorario () {
//Circulo
stroke(148, 56, 173);
strokeWeight(3);
noFill();
tracejado.ellipse(PX0, PY0, RaioT, RaioT);
//circle(PX0, PY0, RaioT);
tracejado.offset(dist);
dist += 1;
//Linha
for (int i = 0; i < NdPontas; i++) {
PX1 = PX0+(Raio*cos((Ang)*(i+m)));
PY1 = PY0+(Raio*sin((Ang)*(i+m)));
strokeWeight(10);
stroke(0);
line(PX0, PY0, PX1, PY1);
}
m = m + radians(0.5);
}
void desenhaAntiHorario () {
//Circulo
stroke(148, 56, 173);
strokeWeight(1);
noFill();
tracejado.ellipse(PX0, PY0, RaioT, RaioT);
//circle(PX0, PY0, RaioT);
/*tracejado.offset(dist);
dist += 1;*/
//Linha
for (int j = 0; j < NdPontas; j++) {
PX1 = PX0+(Raio*cos((Ang)*(j-m)));
PY1 = PY0+(Raio*sin((Ang)*(j-m)));
strokeWeight(10);
stroke(0);
line(PX0, PY0, PX1, PY1);
}
m = m + radians(0.5);
}
}
How do I draw inside a class?
I'm creating a game for a university project and I would like to make a dashed circle indicating the area that the player has to reach to follow the path, however when I use "dashed = new DashedLines(this);" the program says that "The constructor DashedLines(CUBWAY_Ver_4_2.ObstaculoNvl3) is undefined".
I would like to know how I can solve this.
This is the class in question, I would like to know what I have to put in place of "this". Sorry if it's obvious, I'm still learning.
//
DashedLines tracejado;
class ObstaculoNvl3 {
int NdPontas;
float PX0, PY0, PX1, PY1;
int Raio;
float Ang;
float RaioT;
float m = radians(0);
float dist = 0;
ObstaculoNvl3 (int NdP, float X, float Y, int R) {
NdPontas = NdP;
}
void desenhaHorario () {
}
void desenhaAntiHorario () {
}
}