From db2880dc8fd4e09e75e884890e12bd9dcef64875 Mon Sep 17 00:00:00 2001 From: SlyVTT Date: Sun, 20 Aug 2023 10:29:10 +0200 Subject: [PATCH] =?UTF-8?q?Fixed=20NPCs=20path=20alignement=20and=20import?= =?UTF-8?q?ation=20(thanks=20Leph=C3=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.c | 2 +- src/npc.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 5d1cc83..9b977be 100644 --- a/src/main.c +++ b/src/main.c @@ -32,7 +32,7 @@ extern Map *worldRPG[]; /* Game data (defined in "game.h")*/ Game game = { NULL, - {12*PXSIZE, 36*PXSIZE, 0, 0, 10*PXSIZE, 48*PXSIZE, 100, SPEED, false, 0, false}, + {12*PXSIZE, 36*PXSIZE, 0, 0, 12*PXSIZE, 36*PXSIZE, 100, SPEED, false, 0, false}, false, false, false, 0 /* debug variables*/ diff --git a/src/npc.c b/src/npc.c index d316a52..148c06c 100644 --- a/src/npc.c +++ b/src/npc.c @@ -40,11 +40,10 @@ void npc_draw(Game *game) { int16_t deltaX1=((int16_t) (Data->x + Data->xpath[v % NbPoints]) * PXSIZE)-(int16_t) player->wx; - int16_t deltaY1=((int16_t) (Data->x + Data->ypath[v % NbPoints]) * PXSIZE)-(int16_t) player->wy; - /*DEBUG*/ dprint(0, 0, 0xFAFA, "coucou 43 : %d", v); dupdate(); getkey(); //plante avant ici (le v % NbPoints est sus) + int16_t deltaY1=((int16_t) (Data->y + Data->ypath[v % NbPoints]) * PXSIZE)-(int16_t) player->wy; int16_t deltaX2=((int16_t) (Data->x + Data->xpath[(v+1) % NbPoints]) * PXSIZE)-(int16_t) player->wx; - int16_t deltaY2=((int16_t) (Data->x + Data->ypath[(v+1) % NbPoints]) * PXSIZE)-(int16_t) player->wy; + int16_t deltaY2=((int16_t) (Data->y + Data->ypath[(v+1) % NbPoints]) * PXSIZE)-(int16_t) player->wy; dline( player->px + deltaX1, player->py + deltaY1, player->px + deltaX2, player->py + deltaY2,