my game has a menu that has multiple pages to it, and all the pages but page 1s icons will not ‘destroy’. i have a function that destroys the sprites for each page, but when debugging i goudn that it does not destroy the sprite. the function is still run through when the command is given. does anyone have any alternitives to ‘sprites.destroy’ or know how to fix the issue?
For the other pages, the icons are declared inside their functions, hence their scope is for the duration of the functions where the sprites are created only, and when later attempted destroyed in other functions, the sprites are no longer referenced and the destroy() function cannot find and destroy them: