]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Made swords work facing both directions
authordrumsetmonkey <abelleisle@roadrunner.com>
Wed, 9 Dec 2015 03:36:39 +0000 (22:36 -0500)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Wed, 9 Dec 2015 03:36:39 +0000 (22:36 -0500)
main.cpp

index fc2fb6c96ae3028856feb3f5756b96518ff5477c..d1fd85e96d173a0fd3c241231361c89404cabd2c 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -703,11 +703,6 @@ void render(){
                glUseProgramObjectARB(0);
        }
        player->inv->draw();
-
-       if(player->inv->usingi && player->inv->detectCollision(vec2{currentWorld->npc[0]->loc.x, currentWorld->npc[0]->loc.y},vec2{currentWorld->npc[0]->loc.x+currentWorld->npc[0]->width,currentWorld->npc[0]->loc.y+currentWorld->npc[0]->height})){
-               currentWorld->npc[0]->alive = false;
-       }
-
        
        /*
         *      Here we draw a black overlay if it's been requested.
@@ -839,6 +834,10 @@ void logic(){
                        */
 
                        if(n->canMove) n->wander((rand() % 120 + 30));
+
+                       if(player->inv->usingi && player->inv->detectCollision(vec2{n->loc.x, n->loc.y},vec2{n->loc.x+n->width,n->loc.y+n->height})){
+                               n->alive=false;
+                       }
                        /*
                         *      Don't bother handling the NPC if another has already been handled.
                        */