Donkey Kong Junior Gamepad Support!

Recently added gamepad support to the DKJ game. Had to experiment for another project at work, so I thought I’d play around with it here. Not sure why I didn’t do this sooner.

Wasn’t as smooth as I thought, since Phaser doesn’t have a couple equivalent functions for button/d-pad presses as it does for key presses. Mostly figured it out, though. I’m not 100% convinced that the d-pad works as I want it to – kind of running into the same issues that a 4-direction joystick game has when using an 8-direction game stick. You are able to have both the up and left or right (or down and left and right, etc.) pressed at the same time – so the question is, which one should prevail? I think it mostly works – but if anyone plays the game and happens to read this, feel free to drop a comment here to let me know if you think it sucks.

It only works with the d-pad for now. I personally think it’s easier to use than the joysticks (because of the same issues above, but even more so?) I’ll eventually add support for the joysticks (both?) as well, so hang tight if you prefer to use those…

I added support for the left joystick now as well. I like it better than I thought I would. With the joystick, I can compare the “magnitude of direction” for any given direction – for example, I can determine if the joystick is more “left” than it is “up” (in this case, I would set left = true and up = false). I don’t have this luxury with the d-pad, so I may need to rethink the above logic for that.

Leave a Reply

Your email address will not be published. Required fields are marked *