Cześć,podpowie mi ktoś jak mógłbym zrobić animacje ruchu nóg mojej postaci w grze?
- Rejestracja:prawie 9 lat
- Ostatnio:prawie 9 lat
- Postów:16
0
:
frame++;
if( frame > 80 ){
frame = 0;
}
if( key[ KEY_LEFT] )
{ postac_x--;
if( frame < 20 ) { draw_sprite( bufor, postac0, postac_x, postac_y ); }
else if( frame >= 20 && frame < 40 ) { draw_sprite( bufor, postac1, postac_x, postac_y ); }
else if( frame >= 40 && frame < 60 ) { draw_sprite( bufor, postac2, postac_x, postac_y ); }
else if( frame >= 60 && frame < 80 ) { draw_sprite( bufor, postac3, postac_x, postac_y ); }
}
else
{
masked_blit(postac,bufor,0,0,postac_x,postac_y,postac->w,postac->h);
}
if(postac_x <= 0)
{
postac_x=0;
}
frame++;
if( frame > 80 ) {
frame = 0;
}
if( key[ KEY_RIGHT ] )
{ postac_x++;
if( frame < 20 ) { draw_sprite( bufor, postac0, postac_x, postac_y ); }
else if( frame >= 20 && frame < 40 ) { draw_sprite( bufor, postac1, postac_x, postac_y ); }
else if( frame >= 40 && frame < 60 ) { draw_sprite( bufor, postac2, postac_x, postac_y ); }
else if( frame >= 60 && frame < 80 ) { draw_sprite( bufor, postac3, postac_x, postac_y ); }
}
else {
masked_blit(postac,bufor,0,0,postac_x,postac_y,postac->w,postac->h);
}
animacja działa tylko w lewą stronę , wie ktoś gdzie tutaj jest błąd ?
Zarejestruj się i dołącz do największej społeczności programistów w Polsce.
Otrzymaj wsparcie, dziel się wiedzą i rozwijaj swoje umiejętności z najlepszymi.