Los items ya brillan a distinto ritmo

This commit is contained in:
2022-08-30 21:44:07 +02:00
parent 38c41193ec
commit 93febf3127
6 changed files with 88 additions and 37 deletions

View File

@@ -19,6 +19,8 @@ Item::Item(item_t item)
// Inicia variables
sprite->setSpriteClip(item.tile * 8, 0, 8, 8);
collider = sprite->getRect();
colorChangeSpeed = 4;
counter = item.counter * colorChangeSpeed;
// Inicializa los colores
color_t c = stringToColor("blue");
@@ -54,7 +56,7 @@ Item::~Item()
// Pinta el objeto en pantalla
void Item::render()
{
const int index = (counter / 2) % color.size();
const int index = (counter / colorChangeSpeed) % color.size();
sprite->getTexture()->setColor(color[index].r, color[index].g, color[index].b);
sprite->render();
sprite->getTexture()->setColor(255, 255, 255);