diff --git a/source/ball.cpp b/source/ball.cpp index 66372e8..61d9cdc 100644 --- a/source/ball.cpp +++ b/source/ball.cpp @@ -67,7 +67,7 @@ void Ball::update() { y = 0; vy = -vy; - vy = -vy * loss; + //vy = -vy * loss; } // Comprueba las colisiones con la parte inferior @@ -90,7 +90,6 @@ void Ball::update() { vx = 0.0f; stopped = true; - // exit(0); } } @@ -109,7 +108,10 @@ void Ball::render() // Modifica la velocidad void Ball::modVel(float vx, float vy) { - this->vx = this->vx + vx; + if (stopped) + { + this->vx = this->vx + vx; + } this->vy = this->vy + vy; onFloor = false; stopped = false; diff --git a/source/main.cpp b/source/main.cpp index b8ab0df..29e8bec 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -152,7 +152,7 @@ void checkEvents() break; } - if (event->type == SDL_KEYDOWN) + if (event->type == SDL_KEYDOWN && event->key.repeat == 0) { if (event->key.keysym.sym == SDLK_SPACE) {