From: drumsetmonkey Date: Fri, 23 Oct 2015 12:48:10 +0000 (-0400) Subject: Worked on the new texture library X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=7638fd9e6f3875faca536177083cdd7cb106b4c0;p=clyne%2Fgamedev.git Worked on the new texture library --- 7638fd9e6f3875faca536177083cdd7cb106b4c0 diff --cc src/entities.cpp index 1f45e40,0bc9fe7..ae8b4c8 --- a/src/entities.cpp +++ b/src/entities.cpp @@@ -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); } diff --cc src/gameplay.cpp index f9d2578,8230e56..1f4b3fe --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@@ -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;iinWorld=test; + + for(i=0;iinWorld=currentWorld; } }