summaryrefslogtreecommitdiffstats
path: root/src/char/char.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 0ab7145..4a4a4e7 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -126,6 +126,24 @@ mf_char_update(struct mf_char *c)
}
int
+mf_char_collision(struct mf_char *c1, struct mf_char *c2, int handle)
+{
+ if (c1->cur_x == c2->cur_x && c1->cur_y == c2->cur_y) goto hit;
+ if (c1->cur_x == c2->new_x && c1->cur_y == c2->new_y) goto hit;
+ if (c1->new_x == c2->cur_x && c1->new_y == c2->cur_y) goto hit;
+ if (c1->new_x == c2->new_x && c1->new_y == c2->new_y) goto hit;
+
+ return 0;
+
+ hit:
+ if (handle == SDL_TRUE) {
+ c1->collide(c1);
+ c2->collide(c2);
+ }
+ return 1;
+}
+
+int
mf_char_render(struct mf_char *c, SDL_Renderer *renderer)
{
int e = 0;