]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
more better
authorClyne Sullivan <tullivan99@gmail.com>
Thu, 10 Sep 2015 20:16:39 +0000 (16:16 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Thu, 10 Sep 2015 20:16:39 +0000 (16:16 -0400)
src/World.cpp
src/main.cpp

index 24f836f520244edefe5ebfbdcd5bd65823e03fb4..cf14612dcac1637c0aa6ab695b731f2d53e52aa6 100644 (file)
@@ -62,6 +62,7 @@ void World::draw(void){
                }\r
        glEnd();\r
 }\r
+#include <stdio.h>\r
 void World::detect(vec2 *v,const float width){\r
        unsigned int i;\r
        for(i=0;i<lineCount;i++){\r
@@ -71,10 +72,10 @@ void World::detect(vec2 *v,const float width){
                        }else if(v->x+width>(HLINE*i)-1&&v->x+width<(HLINE*i)-1+HLINE){\r
                                v->x=(HLINE*i)-1-width;\r
                        }else{\r
-                               v->y=line[i].start;\r
+                               v->y=line[i].start+HLINE/4;\r
                        }\r
-               }else if(v->y>line[i].start+HLINE/2){\r
-                       v->y-=HLINE/4;\r
+               }else if(v->y>line[i].start+HLINE/4){\r
+                       //v->y-=HLINE/8;\r
                }\r
        }\r
 }\r
index 3d1afb611a30247e7249393c8ed749956b12fc04..c404f22a707263abab19eb3e993390a2648c57bf 100644 (file)
@@ -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;