diff options
Diffstat (limited to 'src/entities.cpp')
-rw-r--r-- | src/entities.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index 0bc9fe7..ae8b4c8 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -35,12 +35,10 @@ Player::Player(){ //sets all of the player specific traits on object creation height = HLINE * 16; type = PLAYERT; //set type to player - subtype = 0; - + subtype = 0; health = maxHealth = 100; speed = 1; - - tex = new Texturec(3, "assets/player.png", "assets/player1.png", "assets/player2.png"); + tex = new Texturec(3, "assets/player1.png", "assets/player.png", "assets/player2.png"); inv = new Inventory(PLAYER_INV_SIZE); } @@ -64,14 +62,16 @@ Structures::Structures(){ //sets the structure type tex = new Texturec(1,"assets/house1.png"); } -Mob::Mob(){ +Mob::Mob(int sub){ width = HLINE * 10; height = HLINE * 8; - type = MOBT; //sets type to MOB - subtype = 1; //SKIRL - - tex = new Texturec(2, "assets/rabbit.png", "assets/rabbit.png1"); + subtype = sub; //SKIRL + if(subtype == 1){//RABBIT + tex = new Texturec(2, "assets/rabbit.png", "assets/rabbit1.png"); + }else if(subtype == 2){//BIRD + //add bird textures and bird things + } inv = new Inventory(NPC_INV_SIZE); } @@ -103,43 +103,45 @@ void Entity::draw(void){ //draws the entities if(up){ texState+=1; if(texState==2)up=false; + tex->bindNext(); }else if(!up){ texState-=1; if(texState==0)up=true; + tex->bindPrev(); } } if(ground == 0){ - glBindTexture(GL_TEXTURE_2D, tex->image[0]); + tex->bind(0); }else if(vel.x != 0){ switch(texState){ case 0: - glBindTexture(GL_TEXTURE_2D,tex->image[1]); + tex->bind(0); break; case 1: - glBindTexture(GL_TEXTURE_2D,tex->image[0]); + tex->bind(1); break; case 2: - glBindTexture(GL_TEXTURE_2D,tex->image[2]); + tex->bind(2); break; } } else{ - glBindTexture(GL_TEXTURE_2D,tex->image[0]); + tex->bind(1); } }else if(type == MOBT){ switch(subtype){ case 1: //RABBIT if(ground == 0){ - glBindTexture(GL_TEXTURE_2D, tex->image[1]); + tex->bind(1); }else if(ground == 1){ - glBindTexture(GL_TEXTURE_2D, tex->image[0]); + tex->bind(0); } break; default: break; } }else{ - glBindTexture(GL_TEXTURE_2D,tex->image[0]); + tex->bind(0); } glColor3ub(255,255,255); glBegin(GL_QUADS); |