More progress in porting Loser Corps to the ESP32 (see all posts about the port).
Here's a demo video (click to open Youtube):
(This video shows a slightly older version where collision detection was done with the image rectangle, not the character's clipping rectangle, which is why it looks a little wonky in a few places.)
As the video shows, you control a character in a map, walking and jumping around. I reworked some parts of the movement code, but it feels a lot like the original, although I think the jump is not high enough. The collision detection is pretty much untouched, except for what I absolutely had to do to make it run in the ESP32, which wasn't much.
The joystick I'm using is a common Arduino joystick shield. It's pretty cheap and easy to use, but it requires one input pin of the ESP32 for each button, and one analog input pin for each direction of the stick -- it's really just a bunch of of buttons and potentiometers conveniently placed on a PCB:
I've connected all buttons pins, but the code only uses the C button to jump and the X analog stick to move.
I've tried to use a Wiimote nunchuck and a Wiimote classic controller, but I didn't have much success. These controllers use an I2C interface to talk to the Wiimote, so it seems like they should be easy to use with the ESP32 -- and it actually works, but it's very unreliable. The controller stops replying for no apparent reason, a lot of times requiring an unplug/re-plug to start working again. I've tried it with no pullup resistors, 4.7K pullups, 10K pullups, all for nothing. The strangest thing is that it works perfectly with an Arduino Uno (using the same exact test code), even with no pullup resistors. I say people saying that the I2C part of the ESP32 Arduino library isn't that great, so maybe that's the problem?
Another nice option would be to use the Wiimote itself, which uses Bluetooth. That's probably the next thing I'll work on in this project.