74 lines
1.1 KiB
C
Raw Normal View History

2023-02-12 00:09:02 -05:00
/*
* DESCRIPTION:
* Collectbles; the money/powerups that come out of enemies.
*/
#include "collectibles.h"
/* Initializes collectibles. */
void
collectibles_init(List* _l, Play* _p)
{
list_init(_l);
}
/* Initializes collectibles. */
void
collectibles_free(List* _l, Play* _p)
{
list_free(_l);
}
/* Updates collectibles. */
void
collectibles_update(List* _l, Play* _p)
{
Collectible** collectibles;
s32 collectibleCount;
collectibles = (Collectible**)list_data_get(_l);
collectibleCount = _l->count;
for (s32 i = 0; i < collectibleCount; i++)
{
Collectible* c;
c = collectibles[i];
collectible_update(c, _l, _p);
}
free(collectibles);
}
/* Draws all collectibles. */
void
collectibles_draw(List* _l, Play* _p)
{
Collectible** collectibles;
s32 collectibleCount;
collectibles = (Collectible**)list_data_get(_l);
collectibleCount = _l->count;
for (s32 i = 0; i < collectibleCount; i++)
{
Collectible* c;
c = collectibles[i];
shadow_draw(&c->shadow, _p);
}
for (s32 i = 0; i < collectibleCount; i++)
{
Collectible* c;
c = collectibles[i];
sprite_draw(&c->sprite, _p->g->renderer);
}
free(collectibles);
}