diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2015-09-28 08:13:09 -0400 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2015-09-28 08:13:09 -0400 |
commit | c8b859da1c52205973ad853eec91bf5a7cb882bb (patch) | |
tree | 8f2e6c4667191ba63d418ea06f14122d28a551f8 | |
parent | 4391f9289b7368765b39c9654d6b0bdf2db8f36b (diff) |
Fixed entities
-rw-r--r-- | src/entities.cpp | 13 | ||||
-rw-r--r-- | src/main.cpp | 1 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index da28851..d31f427 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -50,9 +50,9 @@ NPC::NPC(){ width = HLINE * 8; height = HLINE * 12; speed = 1; - type = 0; + type = 1; subtype = 0; - alive = false; + alive = true; canMove = true; } @@ -78,14 +78,15 @@ unsigned int Structures::spawn(int t, float x, float y){ //int tempN = (getRand() % 5 + 1); int tempN = 2; for(int i=0;i<tempN;i++){ - entity.push_back(new Entity()); + entity.push_back(new NPC()); npc.push_back(NPC()); std::cout<<"NPC:"<<npc.size()<<std::endl; std::cout<<"Entity:"<<entity.size()<<std::endl; entity[entity.size()] = &npc[npc.size()-1]; - entity[entity.size()]->alive=true; - entity[entity.size()]->type = 1; - entity[entity.size()]->spawn(loc.x + (float)(i - 5) / 8,100); + entity[entity.size()-1]->spawn(loc.x + (float)(i - 5) / 8,100); + std::cout<<"Entity Type["<<entity.size()<<"]: "<<entity[entity.size()]->type<<std::endl; + std::cout<<"Entity Life["<<entity.size()<<"]: "<<entity[entity.size()]->alive<<std::endl; + } return entity.size(); } diff --git a/src/main.cpp b/src/main.cpp index 0ba715f..dae4189 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -198,6 +198,7 @@ void logic(){ for(int i=0;i<=entity.size();i++){ if(entity[i]->alive&&entity[i]->type == 1){ entity[i]->wander(90, &entity[i]->vel); + std::cout<<"works"<<i<<std::endl; } } } |