]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Made basic robin texture, pixelated mount washington for backdrop test
authordrumsetmonkey <abelleisle@roadrunner.com>
Mon, 26 Oct 2015 12:47:42 +0000 (08:47 -0400)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Mon, 26 Oct 2015 12:47:42 +0000 (08:47 -0400)
include/Texture.h
include/entities.h
main.cpp
src/Texture.cpp
src/entities.cpp
src/gameplay.cpp

index 5a0834873ea488f942ad61aa0776728617fa2ad7..fdb294dd7a198cb1350f655c64c0430e8bbda2fd 100644 (file)
@@ -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
index 47f7f55b4eef3c49e1d41a51e97dab693715c45a..f46c295fd9b8dded242198702f17a2df67b50ea2 100644 (file)
@@ -115,4 +115,5 @@ ENTITY TYPES
 |
 2 MOBS
 |->1 Rabbit
+|->2 Bird
 **/
index e43029aa5bf89f7a8a1f6fc230935f9141234d31..f0073848d4ee46d7703665c95f688ea0bddb282e 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -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);
        
        /*
index 0d677017829bd8e01ebe59042287fb4de9e4f099..99d6ae723b5eed16c7b2ab5efae1c41be256fb25 100644 (file)
@@ -46,4 +46,8 @@ void Texturec::bindNext(){
 
 void Texturec::bindPrev(){
        bind(--texState);
+}
+
+void Texturec::walk(){
+       
 }
\ No newline at end of file
index ae8b4c862d235dca967a05dbc456705a1851d0ec..174495a69807c0c3a3496de952dd9cdeba461720 100644 (file)
@@ -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;
                }
index 1f4b3fee7ad12f4aee96e84f3b7656512291191e..c36b09cd3ec06d98ff4764847988f101df2b9f28 100644 (file)
@@ -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.