]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Worked on the new texture library
authordrumsetmonkey <abelleisle@roadrunner.com>
Fri, 23 Oct 2015 12:48:10 +0000 (08:48 -0400)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Fri, 23 Oct 2015 12:48:10 +0000 (08:48 -0400)
1  2 
main.cpp
src/entities.cpp
src/gameplay.cpp

diff --cc main.cpp
Simple merge
index 1f45e4092218cfab0f646524477eeb819f9c92a1,0bc9fe7e9fcf95e1875f59bad4e70220b4faced0..ae8b4c862d235dca967a05dbc456705a1851d0ec
@@@ -28,16 -33,15 +33,13 @@@ void Entity::spawn(float x, float y){      /
  Player::Player(){ //sets all of the player specific traits on object creation
        width = HLINE * 10;
        height = HLINE * 16;
-       speed = 1;
+       
        type = PLAYERT; //set type to player
--      subtype = 0;
-       maxHealth = 100;
-       health = maxHealth;
-       alive = true;
-       ground = false;
-       near = true;
-       inv = new Inventory(PLAYER_INV_SIZE);
 -      
++      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);
  }
  
  NPC::NPC(){   //sets all of the NPC specific traits on object creation
@@@ -61,20 -64,14 +62,16 @@@ Structures::Structures(){ //sets the st
        tex = new Texturec(1,"assets/house1.png");
  }
  
 -Mob::Mob(){
 +Mob::Mob(int sub){
        width = HLINE * 10;
        height = HLINE * 8;
-       speed = 1;
 -      
        type = MOBT; //sets type to MOB
 -      subtype = 1; //SKIRL
 -      
 -      tex = new Texturec(2, "assets/rabbit.png", "assets/rabbit.png1");
 +      subtype = sub; //SKIRL
-       alive = true;
-       canMove = true;
-       near = false;
 +      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);
  }
  
index f9d2578b0803b04d6e3a34ddb9d0e64aff642b17,8230e560ba9c29b9fdf61241eb09d7ac77ac6c35..1f4b3fee7ad12f4aee96e84f3b7656512291191e
@@@ -41,25 -60,36 +60,35 @@@ void initEverything(void)
        player=new Player();
        player->spawn(0,100);
        
-       // Make structures
-       entity.push_back(new Entity());
+       /*
+        *      Create a structure (this will create villagers when spawned).
+       */
+       
        build.push_back(new Structures());
-       entity[0]=build[0];
-       build[0]->spawn(STRUCTURET,(rand()%120*HLINE),10);
+       entity.push_back(build.back());
+       build.back()->spawn(STRUCTURET,(rand()%120*HLINE),10);
+       
+       /*
+        *      Generate an indoor world and link the structure to it. 
+       */
+       
        IndoorWorld *iw=new IndoorWorld();
        iw->generate(200);
-       build[0]->inside=iw;
+       build.back()->inside=iw;
  
-       entity.push_back(new Mob(1)); //create a new entity of NPC type
-       mob.push_back(Mob(1)); //create new NPC
-       entity[entity.size()] = &mob[mob.size()-1]; //set the new entity to have the same traits as an NPC
-       entity[entity.size()-1]->spawn(200,100); //sets the position of the villager around the village
-       entity.pop_back();
-       
+       /*
+        *      Spawn a mob. 
 -      */
 -      
 -      mob.push_back(new Mob());
++      */      
++      mob.push_back(new Mob(1));
+       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. 
+       */
        NPCp(entity[1])->addAIFunc(giveTestQuest,false);
-       for(i=0;i<entity.size()+1;i++){
-               entity[i]->inWorld=test;
+       
+       for(i=0;i<entity.size();i++){
+               entity[i]->inWorld=currentWorld;
        }
  }