Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
@Stevanicus I'm not completely sure what you are asking but the basic idea is you want to separate your drawing calls and your update calls. You should take input and process everything in an update method and after the update method has finished processing everything for the frame, you should draw the frame by calling draw. In the draw method is when you draw everything in opposite order you want it to show up on the screen. (You want to draw your background first). Not sure if this answered your question, if it didn't, can you give me a little more specifics?