Allegro 5 – Bullet dispose when gets to the border

  allegro5, c++

Me and a classmate are making an Allegro 5 game, a Defender remake, but we have some problems with the bullets.
When the bullet impacts a borderline the game crashes completely.

void Player::render() {
    

    al_map_rgb(0, 0, 0);
    nave = al_load_bitmap("images/naveV2_xs.png");
    

    for (auto& bullet : bullets) {
        bullet->render();
    }

    al_draw_bitmap(nave, x, y, 0);
}

void Player::dispose() {
    for (auto& bullet : bullets) {
        delete bullet;
    }

    bullets.clear();

    al_destroy_event_queue(event_queue);
    al_destroy_bitmap(nave);
    
}

Source: Windows Questions C++

LEAVE A COMMENT