From: Clyne Sullivan Date: Thu, 29 Oct 2015 13:21:36 +0000 (-0400) Subject: gotta go fast X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=9133b5b379f565ca9f268b63864155051c464cb1;p=clyne%2Fgamedev.git gotta go fast --- 9133b5b379f565ca9f268b63864155051c464cb1 diff --cc src/ui.cpp index 5d6c2ab,e0ebc50..91da2e9 --- a/src/ui.cpp +++ b/src/ui.cpp @@@ -240,31 -238,13 +241,31 @@@ namespace ui player->ground=false; } } + World *tmp; if(SDL_KEY==SDLK_i){ - player->vel.y=.5; - player->ground=false; + tmp=currentWorld; currentWorld=currentWorld->goWorldBack(player); // Go back a layer if possible + if(tmp!=currentWorld){ + currentWorld->detect(player); + player->vel.y=.2; + player->loc.y+=HLINE*5; + player->ground=false; + } } - if(SDL_KEY==SDLK_k)currentWorld=currentWorld->goWorldFront(player); // Go forward a layer if possible - if(SDL_KEY==SDLK_LSHIFT)player->speed = 3; // Sprint + if(SDL_KEY==SDLK_k){ + tmp=currentWorld; + currentWorld=currentWorld->goWorldFront(player); // Go forward a layer if possible + if(tmp!=currentWorld){ + player->loc.y=0; + currentWorld->behind->detect(player); + player->vel.y=.2; + player->ground=false; + } + } + if(SDL_KEY==SDLK_c){ + dialogBox("","You pressed `c`, but nothing happened."); + } - if(SDL_KEY==SDLK_LSHIFT)player->speed = 3; // Sprint ++ if(SDL_KEY==SDLK_LSHIFT)player->speed = debug?4:3; // Sprint if(SDL_KEY==SDLK_LCTRL)player->speed = .5; } if(SDL_KEY==SDLK_F3)debug^=true; diff --cc src/world.cpp index 599b1ef,c04c88a..641dbf9 --- a/src/world.cpp +++ b/src/world.cpp @@@ -222,7 -222,7 +222,7 @@@ LOOP2 * Invert shading if desired. */ -- //shade*=-1; ++ shade*=-1; /* * Draw structures in the current layer if we're on the one we started at. We draw @@@ -369,7 -349,7 +369,7 @@@ * Restore the inverted shading if it was inverted above. */ -- //shade*=-1; ++ shade*=-1; /* * Draw platforms... @@@ -602,7 -582,7 +602,7 @@@ void World::addHole(unsigned int start, } int World::getTheWidth(void){ - return x_start*2; - return x_start*-2; ++ return -x_start*2; } IndoorWorld::IndoorWorld(void){