glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glEnable(GL_TEXTURE_2D);
- glBindTexture(GL_TEXTURE_2D,texture);
+ if(type == PLAYERT){
+ static int texState = 0;
+ static bool up = true;
+ if(loops % (int)((float)5 / (float)speed) == 0){
+ if(up){
+ texState+=1;
+ if(texState==2)up=false;
+ }else if(!up){
+ texState-=1;
+ if(texState==0)up=true;
+ }
- }
- std::cout << texState << std::endl;
- if(vel.x != 0){
++ }if(vel.x != 0){
+ switch(texState){
+ case 0:
+ glBindTexture(GL_TEXTURE_2D,texture[1]);
+ break;
+ case 1:
+ glBindTexture(GL_TEXTURE_2D,texture[0]);
+ break;
+ case 2:
+ glBindTexture(GL_TEXTURE_2D,texture[2]);
+ break;
+ }
+ }else glBindTexture(GL_TEXTURE_2D,texture[0]);
+ }else{
+ glBindTexture(GL_TEXTURE_2D,texture[0]);
+ }
glBegin(GL_QUADS);
glTexCoord2i(0,1);glVertex2i(loc.x, loc.y);
glTexCoord2i(1,1);glVertex2i(loc.x + width, loc.y);