summaryrefslogtreecommitdiffstats
path: root/src/game.c
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-08-10 02:08:41 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-08-10 02:21:48 (EDT)
commit3e619979dafa64c6b2576420ff1ce59462256d5e (patch)
tree27249a38387828b922dad3b88a8ee55f1949ec83 /src/game.c
parent85494ad6865c9087b0d0f5a547b17042e7122662 (diff)
downloadmazefight-3e619979dafa64c6b2576420ff1ce59462256d5e.zip
mazefight-3e619979dafa64c6b2576420ff1ce59462256d5e.tar.gz
mazefight-3e619979dafa64c6b2576420ff1ce59462256d5e.tar.bz2
char: Add collision detection/handling
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/game.c b/src/game.c
index 5daea66..0c94202 100644
--- a/src/game.c
+++ b/src/game.c
@@ -156,6 +156,7 @@ mf_game(long seed, int size, int fow, int reveal, int enemies,
int fr;
int won;
Uint32 beg;
+ int j;
int secs;
Uint32 end;
Uint32 delay;
@@ -246,6 +247,12 @@ mf_game(long seed, int size, int fow, int reveal, int enemies,
for (i = 0; i < 1 + enemies; ++i) {
mf_char_update(chars[i]);
}
+ for (i = 1; i < 1 + enemies; ++i) {
+ for (j = i + 1; j < 1 + enemies; ++j) {
+ mf_char_collision(chars[i], chars[j],
+ SDL_TRUE);
+ }
+ }
mf_char_get_vector(chars[0], &game.player_cx,
&game.player_cy, &game.player_travel,
&game.player_dx, &game.player_dy);