From a9781681bb8f3277ac310fbec8dc0353972dbc37 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Thu, 1 Oct 2015 09:19:52 -0400 Subject: improved gravity --- src/world.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/world.cpp') diff --git a/src/world.cpp b/src/world.cpp index 5ba2e7d..d2cd380 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -117,10 +117,6 @@ LOOP2: // Draw each world for(i=0;iinWorld==this){ entity[i]->draw(); - if(entity[i]->near){ - ui::setFontSize(14); - ui::putText(entity[i]->loc.x,entity[i]->loc.y-ui::fontSize-HLINE/2,"%s",entity[i]->name); - } } } } @@ -130,7 +126,7 @@ void World::singleDetect(Entity *e){ unsigned int i; if(e->alive){ i=(e->loc.x+e->width/2-x_start)/HLINE; // Calculate what line the player is currently on - if(e->loc.y>line[i].y){ // Snap the player to the top of that line if the player is inside it + if(e->loc.y>line[i].y-.002*deltaTime){ // Snap the player to the top of that line if the player is inside it for(i=0;iloc.x+e->width>platform[i].p1.x)&(e->loc.x+e->widthloc.xloc.x>platform[i].p1.x))){ @@ -145,10 +141,10 @@ void World::singleDetect(Entity *e){ } } e->vel.y-=.001*deltaTime; - }else{ + }else if(e->loc.yvel.y=0; e->ground=true; - e->loc.y=line[i].y+HLINE/2; + e->loc.y=line[i].y-.001*deltaTime; } if(e->loc.xvel.x=0; -- cgit v1.2.3