]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
updates
authorClyne Sullivan <tullivan99@gmail.com>
Wed, 30 Sep 2015 11:29:50 +0000 (07:29 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Wed, 30 Sep 2015 11:29:50 +0000 (07:29 -0400)
Changelog
src/main.cpp

index 4ac0ba4c9cd2b6139b7abb69ecb42ee3e293bec6..cd04cf6bc9ae9c0a61c6e6ca7e38287d07f36623 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -43,4 +43,4 @@
        - made world handling work with interpolation
        - successfully ran game 200 entities
        - improved debug screen
-
+       - added mouse interaction w/ NPCs
index 6c4047cc99ac48e87a47d83891a11b2c46c6e8d9..4fb66d3727f60c7d472a709ca3da0cdcc87d23e2 100644 (file)
@@ -213,7 +213,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(40,2)){
+                       if( pow((entity[i]->loc.x - player->loc.x),2) + pow((entity[i]->loc.y - player->loc.y),2) <= pow(30*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)
                                        entity[i]->interact();
                        }