1
I’m playing a simple game like "space Invaders" in Opengl and in the part of the collisions need to calculate the minimum and maximum X and Y values, but I still can’t figure out how to do this.
This is the code I use to create an enemy ship:
void Inimiga::Corpo(void){
glColor3f(0.545, 0.000, 0.000);
glScalef(1.0,0.5,0.0);
glBegin(GL_QUADS);{
glVertex2f(0.0,0.0);
glVertex2f(0.8,0.0);
glVertex2f(0.8,0.25);
glVertex2f(0.0,0.25);
}
glEnd();
}
void Inimiga::asaDireita(void){
glColor3f(0.545, 0.000, 0.000);
glScalef(0.5,1.0,0.0);
glBegin(GL_TRIANGLES);{
glVertex2f(0.0,0.0);
glVertex2f(2.0,1.0);
glVertex2f(0.0,2.0);
}
glEnd();
}
void Inimiga::asaEsquerda(void){
glColor3f(0.545, 0.000, 0.000);
glScalef(0.5,1.0,0.0);
glBegin(GL_TRIANGLES);{
glVertex2f(0.0,1.0);
glVertex2f(2.0,0.0);
glVertex2f(2.0,2.0);
}
glEnd();
}
I added the tag [tag:c++] since your code seems to be from this language. In the future, when preparing such an issue, provide a [mcve] instead of just snippets of code. It can make it easier for you to get a better answer or faster.
– Luiz Vieira