Joystick / Joypad in Flash
I’ve always wanted to use a Joytick with my Flash games.
A while ago I was working on small game for Lorial – in-store advertising for Biotherm – through a great company Eness. It was a simple “catch the falling objects with a timelimit game” made in Flash, but needeed to be controlled using a joytick as it had to be simple and easy to use for anyone walking through Myer.
After a little research I found the amazing program AutoHotKey. This lets you specify macros to do things like using a joystick as a mouse or keys, or pressing a combination of keys and starting a program. Using this amazing peice of software (Windows only sorry) and hacking around with some of their joystick input exampels it was easy to map joystick movements and buttons to the arrow keys and “A” on the keyboard, which were then read by Flash.
On a recent game I’ve been working on (Scarygirl) I’ve found that user testing on the keyboard really gets in the way of the gameplay itself, especially for those not used to games. It was a lot easier to hand them a Playstation 2 DualShock controlller attached via a USB converter and have an AutoHotKey script running that converted the D-Pad and buttons to input. The hardest part of this is finding which button on the controller relates to what input into windows. The easiest way I found to work with this was Start->Control Panel->Controllers and just writing down a list of buttons as I pressed them.
So yeah. Easy. And fun. Some games are just so much better with a good controller – just never let me catch you playing an FPS on a console!
This entry was posted on Monday, April 14th, 2008 at 3:25 am and is filed under Flash, Games, Input / Output. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
6 comments
-
jorge
August 20th, 2008 at 6:16 amHi, I’ve been trying to control a flash game with a Joypad.
I managed to create an script to capture the direction buttons of the joypad and send left, right, up, down to notepad or the browser, but in flash doesn`t.
¿Any clues? -
August 20th, 2008 at 11:13 amwhen you test the movie in flash, look under control>disable shortcut keys in the top menu. You might need to turn that on to get keys working properly- otherwise flash hijacks some of them
-
September 8th, 2008 at 9:55 pmHi – first off I’m going to say that scarygirl looks absolutely amazing! Well done and I look forward to playing it. I completely agree with you about Flash + Joystick = brilliant, and I’m definitely going to have a play with Auto Hotkey, but I’m sure you’ll agree that Adobe need to make it work in the browser – check out my little “campaign” on my blog:
http://blog.iainlobb.com/2008/08/no-joy-my-campaign-for-joystick-and.html
Wishing there was an easy way to bring Flash games to consoles too – Scarygirl would rock on Xbox Live arcade. I’m learning C#/XNA so that I can get round this.
-
-
November 13th, 2008 at 4:25 amIn the past I’ve used a Japanese program called joy2key to use controllers in Flash. It’s got a really easy to use interface, usually takes a couple minutes to setup the key mapping.
This Scarygirl game looks friggin awesome! I found this place from a concave shape discussion on the motor2 source page.
Looking forward to seeing the game release!
-