]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Made sword swing at screen fps
authordrumsetmonkey <abelleisle@roadrunner.com>
Wed, 9 Dec 2015 13:47:45 +0000 (08:47 -0500)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Wed, 9 Dec 2015 13:47:45 +0000 (08:47 -0500)
assets/BennyHillTheme.wav [deleted file]
assets/air-horn-club-sample_1.wav [deleted file]
main.cpp
src/ui.cpp
src/world.cpp

diff --git a/assets/BennyHillTheme.wav b/assets/BennyHillTheme.wav
deleted file mode 100644 (file)
index a926902..0000000
Binary files a/assets/BennyHillTheme.wav and /dev/null differ
diff --git a/assets/air-horn-club-sample_1.wav b/assets/air-horn-club-sample_1.wav
deleted file mode 100644 (file)
index 50c5bf8..0000000
Binary files a/assets/air-horn-club-sample_1.wav and /dev/null differ
index bde880d11dc82c39075f90a1e4c26e3ec172453b..b28a8da31c3475536fe2a1b08b2d2d986142371a 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -829,11 +829,6 @@ void logic(){
         *      click detection is done as well for NPC/player interaction.
         *
        */
-       if((SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT)) && !ui::dialogBoxExists)player->inv->usingi = true;
-       if(player->inv->usingi){
-               player->inv->useItem();
-       }
-
        for(auto &n : currentWorld->npc){
                if(n->alive){
                        /*
index 9ab81419556adca8628ab5a5c0bf240fd7cb32a2..14ad64b21e8a32ce9c1931ff1c33c930f257de2f 100644 (file)
@@ -612,6 +612,9 @@ DONE:
                                if((e.button.button&SDL_BUTTON_RIGHT)&&dialogBoxExists){
                                        dialogAdvance();
                                }
+                               if((e.button.button&SDL_BUTTON_LEFT)&&!dialogBoxExists){
+                                       player->inv->usingi = true;
+                               }
                                break;
                        /*
                                KEYDOWN
index 2fd35911503db8dce1a842949d7a11ff5a5992e6..9674b64892164de3970d72ed010a7da230407e05 100644 (file)
@@ -272,6 +272,9 @@ void World::update(Player *p,unsigned int delta){
        
        p->loc.y += p->vel.y                     * delta;
        p->loc.x +=(p->vel.x * p->speed) * delta;
+       if(p->inv->usingi){
+               p->inv->useItem();
+       }
 
        /*
         *      Update coordinates of all entities except for structures.