Skip to content
Snippets Groups Projects
Commit a92c6f91 authored by belkhiritaha's avatar belkhiritaha
Browse files

clignotement joueur fini

parent 888ba9f7
No related branches found
No related tags found
No related merge requests found
......@@ -182,9 +182,10 @@ void drawPlayer(){
rect.y = player.y ;
SDL_Rect destRect = {32 * (SDL_GetTicks()/200%6), 0, 32, 32};
int flip = (player.direction == PLAYER_LEFT) ? (SDL_FLIP_HORIZONTAL) : (SDL_FLIP_NONE);
int tick = SDL_GetTicks()%2;
int tick = player.invisible * (SDL_GetTicks()/200)%2;
SDL_SetTextureColorMod(playerIdleTexture, 255 * (1 - tick), 255 * (1-tick), 255 * (1-tick));
SDL_SetTextureColorMod(playerTexture, 255 * (1 - tick), 255 * (1-tick), 255 * (1-tick));
if (player.isMoving){
SDL_SetTextureColorMod(playerIdleTexture, tick * 255 * (1 -player.invisible),tick * 255 * (1-player.invisible),tick * 255 * (1-player.invisible));
SDL_RenderCopyEx(renderer, playerTexture, &destRect, &rect, 0, NULL, flip);
}
else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment