Posts Tagged ‘Flare3D Labs’

Using AIR Gamepad in your Flare3D game

Thursday, August 28th, 2014

Walk through our deferred lighting demo using Adobe AIR Gamepad!

Walk through demo using Adobe AIR Gamepad

turning your mobile device into a joystick with Adobe AIR Gamepad

One of the latest features released with AIR was Adobe AIR Gamepad. Basically, if you have adobe AIR installed in your Android phone or tablet you can use it as a joystick in your game. The integration is really easy (check out Adobe’s tutorial here) and provides you with a lot of possibilities such as adding the joystick functionality for your game or else you can use it as a second screen for interactive applications.
To play the demo you must follow the following steps:
Important: Flash Player 14 (or higher) is required

  • Open the demo here
  • Launch Adobe AIR application in your phone or tablet.
  • Shake your device to enable AIR Gamepad.
    AIR Gamepad

    AIR Gamepad enabled in your device.

     

  • Type into the demo the code that appears in your device and press “connect”

    Type the code that appears in your device.

    Type the code that appears in your device.

  • Once you get connected your device will vibrate and you will see on the device screen the touch areas for walking and looking around into the demo.

The demo

This demo uses our “Deferred lightning” example. You will find the demo’s source code at Flare3D Labs in a new folder called “gamepad” which has been added into src.
The VirtualPad class receives a gamepad’s reference and handle the input in the same way. This class was made to detect traditional touch events, but with a few changes was adapted to work with AIR Gamepad. As a complementary information you can checkout AIR Gamepad docs here.

Download the demo

Interpreting the input

AIR Gamepad recognizes Multi Touch and gestures input and send them to your application. So you can catch the input as if your app would be running in the mobile device. Once the connection between the app and the device has been established you are able to skin the device’s screen sending an image. In our demo, we are sending an image that shows a reference indicating the touch areas on to the screen.

 

It’s time to play! :-)