aboutsummaryrefslogtreecommitdiff
path: root/particle.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-09-30 19:01:53 +1000
committerquou <quou@disroot.org>2024-09-30 19:01:53 +1000
commit7664fdafb9a6d6f4aa3339fe38958b24b234218e (patch)
treea1b1879403eab088aee66c091e476d407fe35402 /particle.c
parent98322a86ec78f732a5a6750a1e93061269cc76a7 (diff)
player slashing
Diffstat (limited to 'particle.c')
-rw-r--r--particle.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/particle.c b/particle.c
new file mode 100644
index 0000000..c10e3aa
--- /dev/null
+++ b/particle.c
@@ -0,0 +1,28 @@
+#include "animation.h"
+#include "asset.h"
+#include "obj.h"
+#include "render.h"
+
+void init_particle(Particle* p, int x, int y, int anim, int bmp) {
+ p->x = x;
+ p->y = y;
+ p->frame = 0;
+ p->anim = anim;
+ p->bmp = bmp;
+}
+
+int update_particle(Particle* p) {
+ const Animation* a = get_animation(p->anim);
+ return update_anim(a, &p->frame, &p->rect);
+}
+
+void ren_particle(const Particle* p, Renderer* r) {
+ const Bitmap* b = get_bitmap(p->bmp);
+ ren_map(
+ r,
+ p->x,
+ p->y,
+ &p->rect,
+ b
+ );
+}