diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/entities.cpp | 3 | ||||
-rw-r--r-- | src/inventory.cpp | 36 | ||||
-rw-r--r-- | src/world.cpp | 7 |
3 files changed, 32 insertions, 14 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index 1c36ca7..a04b638 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -319,7 +319,8 @@ const char *randomDialog[] = { "Did you know this game has over 4000 lines of code? I didn\'t. I didn't even know I was in a game until now...", "HELP MY CAPS LOCK IS STUCK", "You know, if anyone ever asked me who I wanted to be when I grow up, I would say Abby Ross.", - "I want to have the wallpaper in our house changed. It doesn\'t really fit the environment." + "I want to have the wallpaper in our house changed. It doesn\'t really fit the environment.", + "Frig." }; void NPC::interact(){ //have the npc's interact back to the player diff --git a/src/inventory.cpp b/src/inventory.cpp index 8d8f958..585af47 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -7,7 +7,7 @@ extern Player *player; extern GLuint invUI; static float hangle = 0.0f; -static bool up = true; +static bool swing = false; static float xc,yc; static vec2 itemLoc; Mix_Chunk* swordSwing; @@ -278,13 +278,13 @@ void itemDraw(Player *p,ITEM_ID id,ITEM_TYPE type){ if(hangle < 15){ hangle=15.0f; p->inv->usingi = false; - up = false; + //swing=false; } }else{ if(hangle > -15){ hangle=-15.0f; p->inv->usingi = false; - up = false; + //swing=false; } } break; @@ -310,19 +310,31 @@ void itemDraw(Player *p,ITEM_ID id,ITEM_TYPE type){ } int Inventory::useItem(void){ + static bool up = false; ITEM_TYPE type = item[inv[sel].id].type; if(!invHover){ switch(type){ case SWORD: - if(!player->left){ - if(hangle==-15){up=true;Mix_PlayChannel(2,swordSwing,0);} - if(up)hangle-=15; - if(hangle<=-90)hangle=-14; - }else{ - if(hangle==15){up=true;Mix_PlayChannel(2,swordSwing,0);} - if(up)hangle+=15; - if(hangle>=90)hangle=14; - } + if(swing){ + if(!player->left){ + /*if(hangle==-15){up=true;Mix_PlayChannel(2,swordSwing,0);} + if(up)hangle-=.75*deltaTime; + if(hangle<=-90)hangle=-14;*/ + }else{ + if(hangle<90&&!up)hangle+=.75*deltaTime; + if(hangle>=90&&!up)up=true; + if(up)hangle-=.75*deltaTime; + if(up&&hangle<=15){ + up=false; + swing=false; + hangle=15; + return 0; + } + } + }else if(!swing){ + swing=true; + Mix_PlayChannel(2,swordSwing,0); + } break; default: break; diff --git a/src/world.cpp b/src/world.cpp index 3fdfa7f..7a47c97 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -621,7 +621,8 @@ LOOP2: o->draw(); o->loc.y-=(yoff-DRAW_Y_OFFSET); } - } + }for(auto &o : particles){o->draw();} + /* * If we're drawing the closest/last world, handle and draw the player. @@ -896,6 +897,10 @@ void World::addObject(ITEM_ID i, bool q, const char *p, float x, float y){ entity.push_back(object.back()); } +void World::addParticle(float x, float y, float w, float h, Color color){ + particles.push_back(new Particles(x,y,w,h,color)); +} + /*void World::removeObject(Object i){ object.delete[](i); }*/ |