Muchos pequeños cambios para estandarizar y mejorar la demo

This commit is contained in:
2024-08-22 21:35:48 +02:00
parent 22ddfcd153
commit 1eab622ba2
7 changed files with 49 additions and 13 deletions
+3 -4
View File
@@ -1,5 +1,4 @@
#include "ball.h"
#include "defines.h"
// Constructor
Ball::Ball(int x, int y, int w, int h, int vx, int vy, Texture *texture)
@@ -13,8 +12,8 @@ Ball::Ball(int x, int y, int w, int h, int vx, int vy, Texture *texture)
sprite = new Sprite(texture);
sprite->setPos({x, y});
sprite->setSize(w, h);
sprite->setClip({0, 0, 24, 24});
color = {255, 255, 255};
sprite->setClip({0, 0, w, h});
color = {(rand() % 192) + 32, (rand() % 192) + 32, (rand() % 192) + 32};
}
// Destructor
@@ -69,7 +68,7 @@ void Ball::update()
if (collision)
{
color = {rand() % 255, rand() % 255, rand() % 255};
sprite->setAnimationSpeed((rand() % 15) + 5);
}
// Actualiza la posición del sprite