Draw player centered on position

This commit is contained in:
Camden Dixie O'Brien 2024-12-28 12:37:10 +00:00
parent 6ca053f126
commit e5752a5fe7

View File

@ -265,11 +265,11 @@ int main(int argc, char *argv[])
}
// Draw player
const unsigned piframe = (t / BASEANIMPERIOD) % PIANIMLEN;
psrc.x = PIWIDTH * piframe;
pdest.x = SCALE * (int)(ppos.x - vpos.x);
pdest.y = SCALE * (int)(ppos.y - vpos.y);
SDL_RenderCopy(renderer, pitex, &psrc, &pdest);
const unsigned piframe = (t / BASEANIMPERIOD) % PANIMLEN;
psrc.x = PWIDTH * piframe;
pdest.x = SCALE * (int)(ppos.x - vpos.x - PWIDTH / 2);
pdest.y = SCALE * (int)(ppos.y - vpos.y - PHEIGHT / 2);
SDL_RenderCopy(renderer, pidle, &psrc, &pdest);
SDL_RenderPresent(renderer);
}