I said I was going to build a co-op game alongside the students in my gamedev class, but I haven’t touched Fourlords (a clone of Warlords) since before the semester started. Not until today, that is. I am in Baltimore for a conference, with a reprieve from lecture preparation. When not developing humans, I get to develop software.
Somehow I was able to get through airport security with an Arduino, some loose wires, and a potentiometer. I had an hour this afternoon to mix these things together into a paddle like the ones I had for the Atari 2600.
The Arduino sends the potentiometer reading via the serial port to Unity, where it is used to position and orient the player. The mapping is a piecewise function. A low reading positions the player on its horizontal track, a high reading on its vertical. If the reading is somewhere in the middle, the player is positioned at the corner and rotated. The original Warlords did some funky sprite drawing at this corner. I didn’t feel that I needed to replicate that.
Here’s the end result, with all four players controlled by one potentiometer at the moment:
Next up: getting a ball bouncing around.