Draw player centered on position
This commit is contained in:
parent
6ca053f126
commit
e5752a5fe7
10
app/main.c
10
app/main.c
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user