This is something I've been wondering for quite a while. When building games that exist out of multiple levels (platformers, shmups etc) what is the prefered method to switch between the levels?
Let's say we have a level class that does the following:
- Load data for the level design (tiles), enemies, graphics etc.
- Setup all these elements in their appriopate locations and display them
- Start physics and game logic
I'm stuck between the following 2 methods:
1: Throw away everything in the level class and make a new one, we have to load an entirely new level anyway!
2: pause the game logic and physics, unload all currents assets, then re-initialize those components with the level data for the new level.
They both have their pros and cons. Method 1 is alot easier and seems to make sense since we have to redo everything anyway. But method 2 allows you to re-use exisiting elements which might save resources and allows for a smoother transfer to the new level.
No comments:
Post a Comment