Some notes on your code that aren't related to this issue:
1) You need to check return values of functions such as load_bitmap() and create_bitmap(). If these functions encounter an error, they will not terminate your program, or let you know i any other manner that something has gone wrong, and your program will not crash until later, when you try to access the returned data structure.
2) Unless you are using some obscure OS/hardware, you don't need to call poll_keyboard() as this will be done automatically anyway, and calling it yourself will just slow down the program.
3) Also, don't use acquire_screen()/release_screen() either, unless you know exactly what you are doing. With most OSes, these calls actually either do nothing, or will again slow down your code.
4) Using rest() to slow down your code is going to have different results on different machines. Allegro has timer routines for making sure that code runs at the same speed on all machines. Use those instead.
5) Instead of doing multiple draws to the screen, draw everything to one BITMAP then draw that to the screen. The way you have it right now, if there is a screen refresh between the two calls, you will get jittery results. The more draws to the screen you do, the more this occurs.
6) If you are going to draw a buffer bitmap that covers the entire screen, use blit() rather than draw_sprite(). draw_sprite is slower as it checks every pixel for transparency before drawing it. blit() does not do this extra work.
thank u im aware of some of the things like poll_keyboard my editor has an allegro project creator so it creates the starting code for you like starting allegro and it throws in that function i never added it imma save ur above tips and go through them later thanks again. Now i have 1 other question how do i get a scrolling background to repeat itself/continue from the bottom of the bitmap smoothly once the background runs out?