After drawing the world and moving the camera back to 0, 0, you draw your HUD with normal, pixel coordinates. You don’t need to account for the world or camera or anything.
Translating negatively means you’re subtracting the camera position from all the future render calls. I explained in an earlier post why subtracting is used and not adding. When you’re done rendering the world (blocks, sprites, what have you) you add the camera’s position to the graphics context (translate). This resets it back to 0 because -500 + 500 = 0
, for example.
I swear I saw this question before regarding levels but it might’ve been a different person. I would keep all your levels to one state. Instead of hard-coding a level class instance for each level, you can merely load it from a file. About your question with the player dying, you can just either a) reload from the file if it’s quick enough or b) store a copy of the level before anything has happened and load it in to reset the world without reading from a file.
Your game loop looks fine. I do the exact same thing (although I do logic right before rendering in the render loop).
I hope that answers your questions.