aboutsummaryrefslogtreecommitdiff
path: root/src/engine/animator.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/animator.c')
-rw-r--r--src/engine/animator.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/engine/animator.c b/src/engine/animator.c
new file mode 100644
index 0000000..887493c
--- /dev/null
+++ b/src/engine/animator.c
@@ -0,0 +1,27 @@
+#include "engine/animator.h"
+#include "engine/entity.h"
+#include "engine/maths.h"
+
+
+#define hh_white_palette 6
+
+void hh_animate_hit(hh_s_rendering* in, bool hit) {
+ if (hit) {
+ in->fam.palette_index = hh_white_palette;
+ } else {
+ in->fam.palette_index = in->palette;
+ }
+}
+
+void hh_animate(hh_s_rendering* in, hh_idx_t start, hh_idx_t end, uint8_t step) {
+ if (in->fam.palette_index >= start && in->fam.palette_index < end) {
+ in->fam.palette_index += step;
+ } else {// rollover
+ in->fam.palette_index = start;
+ }
+}
+
+void hh_update_sprite(hh_entity* in) {
+ hh_animate_hit(&in->render, in->is_hit);
+
+}