diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2015-10-26 08:47:42 -0400 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2015-10-26 08:47:42 -0400 |
commit | 3166fd5ad6c1c4d1f79d48e69e9f3775f4f6e54e (patch) | |
tree | 694a42db4f771b65690315bae09ae4a1a9c170ce | |
parent | 99c8a41cde3e5ec74f35660c8701de4326ffcd21 (diff) |
Made basic robin texture, pixelated mount washington for backdrop test
-rw-r--r-- | include/Texture.h | 2 | ||||
-rw-r--r-- | include/entities.h | 1 | ||||
-rw-r--r-- | main.cpp | 12 | ||||
-rw-r--r-- | src/Texture.cpp | 4 | ||||
-rw-r--r-- | src/entities.cpp | 20 | ||||
-rw-r--r-- | src/gameplay.cpp | 4 |
6 files changed, 38 insertions, 5 deletions
diff --git a/include/Texture.h b/include/Texture.h index 5a08348..fdb294d 100644 --- a/include/Texture.h +++ b/include/Texture.h @@ -13,11 +13,13 @@ public: void bindNext(); void bindPrev(); void bind(int); + void walk(); GLuint *image; int texState; private: + }; #endif //TEXTURE_H
\ No newline at end of file diff --git a/include/entities.h b/include/entities.h index 47f7f55..f46c295 100644 --- a/include/entities.h +++ b/include/entities.h @@ -115,4 +115,5 @@ ENTITY TYPES | 2 MOBS |->1 Rabbit +|->2 Bird **/ @@ -50,6 +50,7 @@ SDL_GLContext mainGLContext = NULL; */ static GLuint bgImage; +static GLuint bgFar; /* * gameRunning @@ -367,6 +368,7 @@ int main(int argc, char *argv[]){ */ bgImage=Texture::loadTexture("assets/bg.png"); + bgFar = Texture::loadTexture("assets/bgfarMountains.png"); /* * Load sprites used in the inventory menu. See src/inventory.cpp @@ -553,7 +555,15 @@ void render(){ glTexCoord2i(1,0);glVertex2i( SCREEN_WIDTH*2,SCREEN_HEIGHT); glTexCoord2i(0,0);glVertex2i(-SCREEN_WIDTH*2,SCREEN_HEIGHT); glEnd(); - + + glBindTexture(GL_TEXTURE_2D, bgFar); + glColor4ub(255,255,255,155); + glBegin(GL_QUADS); + glTexCoord2i(0,1);glVertex2i(-SCREEN_WIDTH,0); + glTexCoord2i(1,1);glVertex2i( SCREEN_WIDTH,0); + glTexCoord2i(1,0);glVertex2i( SCREEN_WIDTH,391); + glTexCoord2i(0,0);glVertex2i(-SCREEN_WIDTH,391); + glEnd(); glDisable(GL_TEXTURE_2D); /* diff --git a/src/Texture.cpp b/src/Texture.cpp index 0d67701..99d6ae7 100644 --- a/src/Texture.cpp +++ b/src/Texture.cpp @@ -46,4 +46,8 @@ void Texturec::bindNext(){ void Texturec::bindPrev(){ bind(--texState); +} + +void Texturec::walk(){ + }
\ No newline at end of file diff --git a/src/entities.cpp b/src/entities.cpp index ae8b4c8..174495a 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -48,6 +48,8 @@ NPC::NPC(){ //sets all of the NPC specific traits on object creation type = NPCT; //sets type to npc subtype = 0; + + health = maxHealth = 100; tex = new Texturec(1,"assets/NPC.png"); inv = new Inventory(NPC_INV_SIZE); @@ -63,14 +65,17 @@ Structures::Structures(){ //sets the structure type } Mob::Mob(int sub){ - width = HLINE * 10; - height = HLINE * 8; type = MOBT; //sets type to MOB subtype = sub; //SKIRL - if(subtype == 1){//RABBIT + if(sub == 1){//RABBIT + width = HLINE * 10; + height = HLINE * 8; tex = new Texturec(2, "assets/rabbit.png", "assets/rabbit1.png"); - }else if(subtype == 2){//BIRD + }else if(sub == 2){//BIRD //add bird textures and bird things + width = HLINE * 8; + height = HLINE * 8; + tex = new Texturec(1, "assets/robin.png"); } inv = new Inventory(NPC_INV_SIZE); } @@ -137,6 +142,13 @@ void Entity::draw(void){ //draws the entities tex->bind(0); } break; + case 2: //RABBIT + if(ground == 0){ + tex->bind(0); + }else if(ground == 1){ + tex->bind(0); + } + break; default: break; } diff --git a/src/gameplay.cpp b/src/gameplay.cpp index 1f4b3fe..c36b09c 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -82,6 +82,10 @@ void initEverything(void){ mob.push_back(new Mob(1)); entity.push_back(mob.back()); mob.back()->spawn(200,100); + + mob.push_back(new Mob(2)); + entity.push_back(mob.back()); + mob.back()->spawn(200,100); /* * Link all the entities that were just created to the initial world, and setup a test AI function. |