diff options
-rw-r--r-- | assets/bgfarMountains.png | bin | 0 -> 30875 bytes | |||
-rw-r--r-- | assets/robin.png | bin | 0 -> 316 bytes | |||
-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 | 16 | ||||
-rw-r--r-- | src/gameplay.cpp | 4 |
8 files changed, 36 insertions, 3 deletions
diff --git a/assets/bgfarMountains.png b/assets/bgfarMountains.png Binary files differnew file mode 100644 index 0000000..fa6b349 --- /dev/null +++ b/assets/bgfarMountains.png diff --git a/assets/robin.png b/assets/robin.png Binary files differnew file mode 100644 index 0000000..9fefa47 --- /dev/null +++ b/assets/robin.png 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 c111ea7..94febcf 100644 --- a/include/entities.h +++ b/include/entities.h @@ -121,4 +121,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 8100a4c..da096bc 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -51,6 +51,8 @@ NPC::NPC(){ //sets all of the NPC specific traits on object creation type = NPCT; //sets type to npc subtype = 0; + + health = maxHealth = 100; maxHealth = health = 100; @@ -68,17 +70,20 @@ Structures::Structures(){ //sets the structure type } Mob::Mob(int sub){ - width = HLINE * 10; - height = HLINE * 8; type = MOBT; maxHealth = health = 50; switch((subtype = sub)){ case MS_RABBIT: + width = HLINE * 10; + height = HLINE * 8; tex = new Texturec(2, "assets/rabbit.png", "assets/rabbit1.png"); break; case MS_BIRD: + width = HLINE * 8; + height = HLINE * 8; + tex = new Texturec(1, "assets/robin.png"); break; } @@ -147,6 +152,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 77d0021..1de542d 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -83,6 +83,10 @@ void initEverything(void){ mob.push_back(new Mob(MS_RABBIT)); 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. |