Spent most of this week implementing the basic framework for having two player characters. A lot of code ended up needing changes since it had assumed the existence of a single player character – things like saved games, the grappling hook, etc. By far the hardest parts to get working properly were user input and collision detection.

Getting the inactive player character to properly handle input took some significant changes since I previously assumed that I could just poll the state of the joystick – now, a class called the PlayerManager sits between the two Player instances and objects like the joypad in order to make sure that only the active player receives input events. Collision detection also required some major changes in order to allow players to avoid colliding with each other without breaking any other behaviors that depended on collision detection, like gripping onto ledges or riding platforms.

Now that I have the basics working, I plan to start working on the initial implementation of the secondary character’s AI, so it can follow you around and traverse the environment by jumping and climbing up onto ledges. I still have yet to start working on the code for the secondary character’s abilities and attributes, so right now both characters are basically identical.