diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/char/enemy.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/char/enemy.c b/src/char/enemy.c index b981da7..a7a1251 100644 --- a/src/char/enemy.c +++ b/src/char/enemy.c @@ -85,11 +85,13 @@ _mf_enemy_step(struct mf_char *c) case MF_CHAR_DIR_R_: dx = 1; dy = 0; break; default: dx = 0; dy = 0; break; } - if (!mf_maze_is_wall(c->maze, c->cur_x, c->cur_y, dx, dy)) { - /* Move */ - c->new_dir = dirs[i]; - return 0; + if (mf_maze_is_wall(c->maze, c->cur_x, c->cur_y, dx, dy)) { + /* Wall ahead; don't go this direction. */ + continue; } + /* Move */ + c->new_dir = dirs[i]; + return 0; } return 0; |