Added animated pokemon in AR mode, as well as your own Pokemon.
It was no simple task, but in the end I managed to do a successful first round of refactoring, dividing it into 13 modules.
My process was to start distributing the methods from the big class into smaller classes with a single responsibility, then seeing what modules these classes ended up depending with and in case it made sense, add them as a dependency wired at initialisation. Running Cordova in the browser sped up debugging a whole lot.
My main motivation for doing this refactor was being able to implement unit tests into the separate components to make sure they are working ok. Since there are many things going on at the same time, it’s not easy to be sure which one are failing in the equation to provide the player with an adequate experience.
So far the project evolves in two directions: The first one will be completing this Pokemon concept; I’ll be using a simplified battle system instead of the full rules (won’t even be implementing the full Gen 1 rules), but you’ll still be able to take advantage of the different moves they have including the type bonuses and resistances.
The second one will be my own location based monster training game. More info about that one soon 🙂