How solve this bug? allegro 5 library

basically, a time after the user press the movement keys, the character disappears and got substituted for a color white rectangle, see the video for understand with more clarity: https://www.youtube.com/watch?v=5NoLjZJ8oio&feature=youtu.be
the bug don't have a constant delay to occurs, sometimes is more fast, sometimes is more delayed, sometimes not occurs.

the code:

al_start_timer(timer);
al_wait_for_event(eventos, &ev);
if (ev.type == ALLEGRO_EVENT_TIMER)
{
anim.Update(); //updates a variable thats defines which animation will be used
al_clear_to_color(al_map_rgb(0, 0, 0));
al_draw_bitmap_region(skin,anim.getCurDraw() * player.getLargura(),anim.getCurColumn() * player.getAltura(),
player.getLargura(),player.getAltura(),player.getX(),player.getY(),0); //draw of the character
}
Topic archived. No new replies allowed.