Hey. Looking at your code you want to make a moving ball, but the old images
pollute the screen.
A simple solution is to clear the screen with
SDL_FillRect(screen,&screen->clip_rect,0x00000000); each loop.
If you want trailing “motion” images of the ball that don’t jump back
and forth, make a “virtual screen”,
blit the ball sprite to that and blit it to the screen each loop.
And if you mean drawing this without refreshing the screen just delete
the SDL_Delay and SDL_Flip lines.
int kolysanie_statkami()
{
ball[0]=IMG_Load(“czaszka.bmp”);
ball[1]=IMG_Load(“czaszka.bmp”);
while(pl==false)
{
for(int i=0;i<=50;++i)
{
apply_surface(++i, 40, ball[0], screen );
apply_surface(++i+80, 40, ball[1], screen );
//Szybkosc ko?ysania
SDL_Delay(80);
SDL_Flip(screen);
}
for(int j=50;j>=0;--j)
{
apply_surface(--j, 40, ball[0], screen );
apply_surface(--j+80,40, ball[1], screen );
//Szybkosc ko?ysania
SDL_Delay(80);
SDL_Flip(screen);
}
}
}