]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
npc facing
authorClyne Sullivan <tullivan99@gmail.com>
Wed, 9 Dec 2015 13:28:39 +0000 (08:28 -0500)
committerClyne Sullivan <tullivan99@gmail.com>
Wed, 9 Dec 2015 13:28:39 +0000 (08:28 -0500)
src/entities.cpp

index f2d727030e5a656484b4070f21f996e234e33926..08af0a9b05c0b5d6f72b1d5d96c13094a4203f5e 100644 (file)
@@ -313,6 +313,10 @@ void NPC::interact(){ //have the npc's interact back to the player
        if(aiFunc.size()){
                func=aiFunc.front();
                canMove=false;
+               
+               left = (player->loc.x < loc.x);
+               right = !left;
+               
                if(!func(this)){
                        if(aiFunc.size())aiFunc.erase(aiFunc.begin());
                }