diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-06-27 23:18:22 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-06-27 23:18:22 +0100 |
commit | 399e039d799186aeacebee60e1c2009a46677c0d (patch) | |
tree | 6b0d2dc98f86e7aecea073e40c35cd21ee6314f3 /src/effect.c | |
parent | cb51a0b3973399c4adfb1406b93cd8a25e2f726c (diff) | |
download | gold-mine-run-399e039d799186aeacebee60e1c2009a46677c0d.tar.gz gold-mine-run-399e039d799186aeacebee60e1c2009a46677c0d.zip |
Add pikcups
WIP: only time and bonuses for now.
Diffstat (limited to 'src/effect.c')
-rw-r--r-- | src/effect.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/effect.c b/src/effect.c new file mode 100644 index 0000000..030f223 --- /dev/null +++ b/src/effect.c @@ -0,0 +1,41 @@ +#include <stdint.h> + +#include "vga.h" +#include "entities.h" + +#include "effect.h" + +#define MAX_FRAME 3 + +static const Rect frames[2 * 4] = +{ + { 96, 16, 144, 144 }, + { 112, 16, 144, 144 }, + { 128, 16, 144, 144 }, + + /* not used */ + { 0, 0, 144, 144 }, + { 0, 0, 144, 144 }, + { 0, 0, 144, 144 }, + { 0, 0, 144, 144 }, + { 0, 0, 144, 144 } +}; + +void effect_out_init(Entity *e) +{ + e->frames = (const Rect *)frames; + e->frame = 1; + e->delay = 0; + e->update = effect_out_update; +} + +void effect_out_update(Entity *e) +{ + if (e->delay++ == WALK_DELAY - 2) + { + e->delay = 0; + e->frame++; + if (e->frame == MAX_FRAME) + e->used = 0; + } +} |