You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
this needs to be a reference to your main PApplet, that is, the main Processing sketch. If you are using dashed lines inside a class, the class needs to have a reference to the PApplet object.
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 () {
}
}
The text was updated successfully, but these errors were encountered: