diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/entities.cpp | 6 | ||||
-rw-r--r-- | src/main.cpp | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index cff971f..9fe05c7 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -36,6 +36,12 @@ void Entity::wander(int timeRun, vec2 *v){ //this makes the entites wander about ticksToUse--; //removes one off of the entities timer } +char* Entity::getName(){ + char* buf; + + return buf; +} + Player::Player(){ //sets all of the player specific traits on object creation width = HLINE * 8; height = HLINE * 12; diff --git a/src/main.cpp b/src/main.cpp index 77d22bc..4ed34dc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,8 +26,6 @@ std::vector<NPC>npc; std::vector<Structures>build; int mx, my; - -FILE* config; FILE* names; void logic(); @@ -95,6 +93,7 @@ int main(int argc, char *argv[]){ // WORLD GENERATION STUFF // //************************************************************************// + names = fopen("assets/names_en-us", "r+"); // Make a world World *test=new World(); test->generate(SCREEN_WIDTH/2); @@ -127,7 +126,6 @@ int main(int argc, char *argv[]){ //************************************************************************// // END WORLD GENERATION STUFF // //************************************************************************// - currentTime=millis(); while(gameRunning){ prevTime = currentTime; @@ -223,7 +221,7 @@ void logic(){ for(int i=0;i<=entity.size();i++){ if(entity[i]->alive&&entity[i]->type == NPCT){ entity[i]->wander((rand()%120 + 30), &entity[i]->vel); - if( pow((entity[i]->loc.x - player->loc.x),2) + pow((entity[i]->loc.y - player->loc.y),2) <= pow(35*HLINE,2)){ + if( pow((entity[i]->loc.x - player->loc.x),2) + pow((entity[i]->loc.y - player->loc.y),2) <= pow(40*HLINE,2)){ if(mx >= entity[i]->loc.x && mx <= entity[i]->loc.x + entity[i]->width && my >= entity[i]->loc.y && my <= entity[i]->loc.y + entity[i]->width && (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_RIGHT))) entity[i]->interact(); |