Posts tagged "Market"

Garroter, a Hangman clone for Android

I’ve built an AIR-based connected mobile application, ‘Garroter’ for Android devices. Garroter is just like any other classic Hangman game. I’ve built this game to illustrate the idea of making your mobile applications services-aware. Your AIR-based application can have the capability of performing a live update by connecting with external web services.

Garroter’s built-in dictionary can be updated over HTTP. In this way, the game data can be updated without pushing the updated application to the market. There will be a clear demarcation between your application and your application’s data.

Try the application ‘Garroter‘ in the Android Market.

Building your first AIR-based mobile game in Burrito

The Adobe Flash Platform provides an elegant way to build, distribute, monetize, and play games on the  mobile platform. Once you learn the basics of ActionScript, Flex, and AIR, you can easily build simple to advanced games targeting various mobile devices.

Mobile games have gained immense popularity in the recent years primarily because of their ability to provide entertainment on the go. What does it mean for developers? There are numerous opportunities for game developers to produce and monetize their games on different online channels including the Android Market.

While you can use any language and tool to produce mobile games,  Flash Builder allows you to develop market-ready games with minimal effort. Moreover, Flash Builder provides a neat interface for building your game engine/levels and also allows you to debug your game on a connected device.

In this post, I’ll show you how you can build a simple Accelerometer-based game for the Android market using Adobe AIR and Flash Builder (Burrito). The objective of this game is to guide the earth ( image) towards the black hole (image) by using the accelerometer of the mobile device.

Now, if Accelerometer is available on the mobile device, you can initialize and handle the Accelerometer event as follows:

var acl:Accelerometer;
...
accl.setRequestedUpdateInterval(200);
acl.addEventListener(AccelerometerEvent.UPDATE, handleACLUpdate);
...

private function handleACLUpdate(event:AccelerometerEvent):void{

    rollingX = (event.accelerationX * FACTOR) + (rollingX * (1-FACTOR));
    rollingY = (event.accelerationY * FACTOR) + (rollingY * (1-FACTOR));
    rollingZ = (event.accelerationZ * FACTOR) + (rollingZ * (1-FACTOR));

    earth.x = Math.round(earth.x - (rollingX*rollingSpeed));
    earth.y = Math.round(earth.y - (rollingY*rollingSpeed));
    ...
}

Accelerometer data obtained from the device has some degree of inaccuracy. You can use a moving average of recent data to smooth out the movement of the earth. For more information on the Accelerometer class, read the documentation.

You can move the earth by simply tilting the mobile device on any particular direction. You should also remember to align the earth back in to the stage when it moves out of screen bounds. To achieve this, we’ll use the Flex effects:

<s:Bounce id="beffect" />

<s:Move id="topbounce" target="{earth}" yBy="2" duration="100" />
<s:Move id="bottombounce" target="{earth}" yBy="-2" duration="100"   />
<s:Move id="leftbounce" target="{earth}" xBy="2" duration="100"
        easer="{beffect}" repeatCount="1"  />
<s:Move id="rightbounce" target="{earth}" xBy="-2" duration="100"
        easer="{beffect}" repeatCount="1"  />

The trick is to move the earth by a very few pixels in the opposite direction with a short animation so that the continuous Accelerometer effect on the earth image does not make the earth movement jerky. You can also vary the duration of the animation and the amount of pixels to move to achieve better smoothness.

At this point, you should read the Flex 4 documentation for more information on Flex effects.

You can use Flash Builder to create mobile views for adding the media assets. Learn more on Flex Mobile Views and Navigators. You can drag and drop images on the stage using the design view.

You need to embed the images for the effects to work.

After obtaining the Accelerometer inputs, you can choose to calculate the distance between the Black Hole image and the earth’s image. If the center points of both the images collide, raise an event to handle the collision. In our game, we increase the score. You can use the same concept to decrease the score when the earth hits any other rigid body apart from the black hole. The game play involves steering the earth to the black hole by carefully avoiding any stationary or moving objects.

I have built this simple game that will enable you to:

  • Create game levels. In this game, each View is a level.
  • Build ActionScript game engines. You can view and modify the sample code pertaining to health, score, and HUD management.
  • Understand and handle timers. Game timers control the duration of the game play. Excessive usage of timers will affect the game’s performance. Be warned!
  • Persist game data. You can serialize the game objects to the application storage directory. The sample game stores high scores for each level and supports auto saving.

Getting Started

  1. Before you begin, download and install Flash Builder Burrito.
  2. Download the Black Hole Flash Builder Project. Extract the archive to get the BlackHole.fxp file.
  3. Click File > Import Flash Builder Project and select BlackHole.fxp
  4. To run the sample game, select Run > Run. For the launch method, select ‘On device’ and click Run. Make sure that your Android device is connected to your computer through USB.

Also, in the sample game, you can drag and drop the earth in to the black hole if you get tired of using the Accelerometer. This test game is also available in the Android Market as ‘Black Hole’.

Happy Gaming!

Tour de Mobile Flex

Tour de Flex is now available on Android!

You  can start building Flex applications for mobile devices with the Flex Hero prerelease. To learn the basics of developing cool applications for your mobile devices, use the Tour de Mobile Flex from the Android Market. Tour de Mobile Flex has been created using Flex Hero and AIR for Android. Try this application today. This is a great way to explore the capabilities of Adobe AIR and Flex on mobile devices. Get it from the Android Market by searching for “Tour de Mobile Flex”!

Guess what? You can try running Tour de Mobile Flex on your Blackberry Playbook!

Android Market filters

Android Market uses filter restrictions to determine whether to show your application to a user who is browsing or searching for applications on a given device. A filtered application may not be visible on all Android devices.

When you publish your AIR-based applications, you get the Android Market filter notification indicating that your application will be available for download only on specific devices. In the figure shown above, the Android Market filtering notification denotes that the application is only available for touch-based Android devices having an ARMv7-A processor.

AIR 2.5 is here

The much awaited, game-changing release is here. AIR 2.5 was released today and is available for download from adobe.com!

Just to share the primary links with you all: You can grab AIR 2.5 runtime and SDK from the download page. The documentation available on this page, includes core documentation, ActionScript resources, quick starts, HTML developers guide, etc. AIR 2.5 for Android is already available via Android Market. AIR 2.5 supports desktop OSes, smart phone OSes, tablets, and televisions!

If you wish to follow more resources in the social media space, AIR team blogs here and tweets here.