extern World *currentWorld;
void UIClass::handleEvents(){
+ static bool space=false;
float thing;
SDL_Event e;
while(SDL_PollEvent(&e)){
if(e.key.keysym.sym == SDLK_a) player.left = true;
if(e.key.keysym.sym == SDLK_LSHIFT) player.speed = 3;
if(e.key.keysym.sym == SDLK_SPACE){
- if(player.vel.y<=0){
+ if(!space&&player.vel.y<=0){
+ space=true;
player.loc.y += HLINE*1.2;
player.vel.y += .004;
}
if(e.key.keysym.sym == SDLK_d) player.right = false;
if(e.key.keysym.sym == SDLK_a) player.left = false;
if(e.key.keysym.sym == SDLK_LSHIFT) player.speed = 1.0;
+ if(e.key.keysym.sym == SDLK_SPACE)
+ if(player.vel.y<=.001)space=false;
if(e.key.keysym.sym == SDLK_ESCAPE) gameRunning = false;
break;
if(player.left == true) {player.vel.x = -.00075;}
if(player.right == false && player.left == false) {player.vel.x = 0;}
- std::cout<<"\r("<<player.loc.x<<","<<player.loc.y<<")"<<std::endl;
+ std::cout<<"\r("<<player.loc.x<<","<<player.loc.y<<")";
currentWorld->detect(&player.loc,&player.vel,player.width);