From: Clyne Sullivan Date: Thu, 10 Sep 2015 20:16:39 +0000 (-0400) Subject: more better X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=a103b556146e434d038487fe518b854da8bc10d3;p=clyne%2Fgamedev.git more better --- diff --git a/src/World.cpp b/src/World.cpp index 24f836f..cf14612 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -62,6 +62,7 @@ void World::draw(void){ } glEnd(); } +#include void World::detect(vec2 *v,const float width){ unsigned int i; for(i=0;ix+width>(HLINE*i)-1&&v->x+width<(HLINE*i)-1+HLINE){ v->x=(HLINE*i)-1-width; }else{ - v->y=line[i].start; + v->y=line[i].start+HLINE/4; } - }else if(v->y>line[i].start+HLINE/2){ - v->y-=HLINE/4; + }else if(v->y>line[i].start+HLINE/4){ + //v->y-=HLINE/8; } } } diff --git a/src/main.cpp b/src/main.cpp index 3d1afb6..c404f22 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -159,6 +159,7 @@ unsigned int logic(unsigned int interval,void *param){ ui.handleEvents(); // Handle events player.vel.x = 0; + currentWorld->detect(&player.loci,player.width); //std::cout << player.vel.x << std::endl; //std::cout << player.velg.y << std::endl;