diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2015-09-12 18:44:23 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2015-09-12 18:44:23 -0400 |
commit | a744d3312dd2f0253f7965253b3eff683cca3453 (patch) | |
tree | 6877af9fc2bd27fdab00b8fd946195939035f21e /src/UIClass.cpp | |
parent | d68b30ee201579e06f050a9448e4dcf883860064 (diff) |
Real layered worlds n stuff
Diffstat (limited to 'src/UIClass.cpp')
-rw-r--r-- | src/UIClass.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/UIClass.cpp b/src/UIClass.cpp index 318ba00..c1c1180 100644 --- a/src/UIClass.cpp +++ b/src/UIClass.cpp @@ -17,8 +17,16 @@ void UIClass::handleEvents(){ if(e.key.keysym.sym == SDLK_d) player.right = true; if(e.key.keysym.sym == SDLK_a) player.left = true; if(e.key.keysym.sym == SDLK_SPACE) player.loc.y += 10; - if(e.key.keysym.sym == SDLK_i)if(currentWorld->behind) currentWorld=currentWorld->behind; - if(e.key.keysym.sym == SDLK_k)if(currentWorld->infront)currentWorld=currentWorld->infront; + if(e.key.keysym.sym == SDLK_i) + if(currentWorld->behind){ + player.loc.x-=(currentWorld->getWidth()-currentWorld->behind->getWidth())/2; + currentWorld=currentWorld->behind; + } + if(e.key.keysym.sym == SDLK_k) + if(currentWorld->infront){ + player.loc.x+=(currentWorld->infront->getWidth()-currentWorld->getWidth())/2; + currentWorld=currentWorld->infront; + } break; case SDL_KEYUP: if(e.key.keysym.sym == SDLK_d) player.right = false; |