Jun-19-2024, 08:55 PM
From what you’ve described, the problem could be related to how the game state is being reset or how the game loop is handling the transitions between levels. One suggestion is to double-check how you’re reinitializing your game objects when you restart a level or move to the next one. Make sure all game objects, such as platforms, enemies, and the player, are being properly reset to their initial states. Also, since you mentioned the main game loop, it might help encapsulate the initialization and reset logic into functions that can be called whenever you need to restart a level or load a new one. This can help ensure that everything is properly reloaded. If you haven’t already, try logging the state of your game objects before and after the level reset to see what might be going wrong. Sometimes, just seeing the differences can give you a clue. Lastly, make sure that the screen scroll and other game elements are also being reset. If these are dependent on the player’s position or other game states, they might not be updating correctly after a reset.