Good afternoon everyone!
I am currently making a simple game in C ++ and SDL2 for fun. I have a class ‘Actor’ that has a fixed number of possible states (standing, walking, running …) each with its own ‘sprite’, and at the time of writing the constuctor a question has arisen: since ‘Actor’ is likely to use all his states at some time (some virtuoso may be able to pass the game without firing or running ;)) Would it be very bad practice to ‘load’ them all in memory when building it? I mean, instead of waiting for, let´s say, the ‘fire’ button to press to erase the current state, create the new state and load its ‘sprite’ and then move to it, all the resources loaded in memory at thje beginning of the game and thus avoid the creation and dynamic destruction at runtime that I understand is somewhat expensive in terms of CPU cycles. As I said it is a simple game and the sprites are too, that is, they are not heavy.
Thanks in advance for your time.