millorat el rebot dalt
arreglada la repetició de la tecla space
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,8 +107,11 @@ void Ball::render()
|
||||
|
||||
// Modifica la velocidad
|
||||
void Ball::modVel(float vx, float vy)
|
||||
{
|
||||
if (stopped)
|
||||
{
|
||||
this->vx = this->vx + vx;
|
||||
}
|
||||
this->vy = this->vy + vy;
|
||||
onFloor = false;
|
||||
stopped = false;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user