What is the best way that I can go about creating separate files for code that I keep re-typing for each level such as player movement, power-up behavior, and background animations/movement? If I could just create a single file for player movement and then reference or call a single function that invokes all of the player movement and controls that would be awesome.
I’ve tried creating new classes and referencing functions in them from file to file but it doesn’t seem to like that at all. I’ve also tried using export/import for modules but I guess I just don’t know enough about how that should work. I’m running an HTTP server with xampp so I should be able to utilize this.
My code is just getting really heavy and I’d like to get it clean before I get heavy into more level creation.