I am developing a 2D platform game using Allegro with C++. However, there is a problem. In the game the character has rubber bullets and when a bullet is fired, it reflects from the walls forever. The character has ability to fire 30 bullets, however, the more the bullet count the slower the graphics becomes. Although I do not use any loops for drawing the movement of any bullets, the game inevitably slows down. Here is the function for moving bullets:
void Character :: moveBullets(void){
if(bullet_turn != bullet_count){
bullet_chain[bullet_turn++]->move();
else
bullet_turn = 0;}
And here is the function move():
rectfill(buffer, getX(), getY(), getX() + bullet_image[direction]->h, getY() + bullet_image[direction]->w, 0);
//update direction
acquire_screen();
draw_sprite(buffer, bullet_image[direction], x, y);
blit(buffer, screen, 0, 0, 0, 0, buffer->w, buffer->h);
release_screen();
}
What should I do? Does Allegro always slow down when drawing many sprites?