]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Increased interaction range, and added right click for interact
authordrumsetmonkey <abelleisle@roadrunner.com>
Wed, 30 Sep 2015 01:45:24 +0000 (21:45 -0400)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Wed, 30 Sep 2015 01:45:24 +0000 (21:45 -0400)
src/main.cpp

index 6c4047cc99ac48e87a47d83891a11b2c46c6e8d9..7980cf72c0fd1812d88e6604a4560e29469ec734 100644 (file)
@@ -213,8 +213,8 @@ 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(40,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)
+                       if( pow((entity[i]->loc.x - player->loc.x),2) + pow((entity[i]->loc.y - player->loc.y),2) <= pow(35*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();
                        }
                }