botó per a donar energiaa les pilotes

This commit is contained in:
2024-08-21 13:12:52 +02:00
parent cdd6e7bc5d
commit e5fb176ef6
3 changed files with 37 additions and 4 deletions
+11 -1
View File
@@ -67,6 +67,7 @@ void Ball::update()
{
y = 0;
vy = -vy;
vy = -vy * loss;
}
// Comprueba las colisiones con la parte inferior
@@ -89,7 +90,7 @@ void Ball::update()
{
vx = 0.0f;
stopped = true;
//exit(0);
// exit(0);
}
}
@@ -103,4 +104,13 @@ void Ball::render()
{
sprite->setColor(color.r, color.g, color.b);
sprite->render();
}
// Modifica la velocidad
void Ball::modVel(float vx, float vy)
{
this->vx = this->vx + vx;
this->vy = this->vy + vy;
onFloor = false;
stopped = false;
}