From aa448c4dc68d8cf548ea8476d775c78cb70dcfa1 Mon Sep 17 00:00:00 2001 From: mibi88 <76903855+mibi88@users.noreply.github.com> Date: Wed, 31 Jul 2024 14:46:39 +0200 Subject: [PATCH] Smoother NPC movement --- src/npc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/npc.c b/src/npc.c index 9c88246..8223156 100644 --- a/src/npc.c +++ b/src/npc.c @@ -267,10 +267,8 @@ void npc_draw(Game *game) { } #endif // DEBUGMODE - int16_t delX = - ((int16_t)((Data->curx >> PRECISION) * PXSIZE)) - (int16_t)pl->wx; - int16_t delY = - ((int16_t)((Data->cury >> PRECISION) * PXSIZE)) - (int16_t)pl->wy; + int16_t delX = ((Data->curx * PXSIZE)>>PRECISION) - (int16_t)pl->wx; + int16_t delY = ((Data->cury * PXSIZE)>>PRECISION) - (int16_t)pl->wy; bopti_image_t *face = npc_sprites[Data->face]; dimage(pl->px - P_WIDTH / 2 + delX, pl->py - P_HEIGHT / 2 + delY, face); }