Hi.
I have a problem with multiple levels (game states).
What can I do when, I don't want to write the same piece of code in each level over and over?
I've tried to create a function in separate js file which e.g. will set player sprite, gravity, animations or will create necessary variables etc.
And I failed this. Everything what I have got are errors.