aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-10-01 18:34:23 +1000
committerquou <quou@disroot.org>2024-10-01 18:34:23 +1000
commit626a3850ebc4859cecb9b3a003c96b69c2fdf7f9 (patch)
treee5ca3bd026e3e9f6ba83453abb89466eb3017526
parent20311c69d2fd4315e3fecf731819d7eba3152871 (diff)
fix enemy patrol
-rw-r--r--enemy.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/enemy.c b/enemy.c
index 1c82e47..bc97030 100644
--- a/enemy.c
+++ b/enemy.c
@@ -121,9 +121,9 @@ void update_demon_move(Enemy* e, const World* w) {
int dist = fxsqrt(dx * dx2 + dy * dy2) >> fbits;
if (e->grounded < 3) {
int tx, ty =
- ((e->y >> fbits) - (map_tile_size >> 1)) /
+ ((e->y >> fbits) + (map_tile_size >> 1)) /
map_tile_size;
- int ty2 = ty + 2;
+ int ty2 = ty + 1;
if (e->face == face_left) {
tx = (
(e->x >> fbits) - (map_tile_size >> 1)) /
@@ -136,7 +136,7 @@ void update_demon_move(Enemy* e, const World* w) {
}
if (
tile_at(&w->map, tx, ty) ||
- (ty2 < map_h && !tile_at(&w->map, tx, ty2))
+ (!e->on_ramp && ty2 < map_h && !tile_at(&w->map, tx, ty2))
)
e->face = !e->face;
if (e->face == face_left) {