SFS2X Docs / ExamplesFlash / cannon-combat
» Cannon Combat
» Overview
The Cannon Combat game is a sample application that utilizes the Adobe AIR 2 runtime and deploys the same code base to multiple mobile platforms.
The game itself is a sort of multiplayer version of the popular Angry Birds game developed by Rovio Mobile, with simplified mechanics due to its educational purpose. It is a turn based game where a cannon shoots a ball at their opponents desk items. The physics is achieved with the use of the Box2D engine and the game can be deployed on both Apple iOS devices and Android devices.
The game contains just one arena, but more can be added following the same approach used in the class representing it.
>> DOWNLOAD the source files <<
IMPORTANT
The Cannon Combat game and walk-through are distributed for educational purposes only. You must retain all the copyright notices appearing in the user interface, source code and any other accompanying file.
Please read the license file contained in the game folder for more informations.
Contact us if you are interested in buying a commercial license which removes the restrictions.
» Installation
The Cannon Combat game is built with two distinct projects that use the same code base. The first version (dev) runs in AIR 2 for testing purposes and will run on your workstation. The second version (prod) runs on the specified mobile device supported by Flash Builder 4.5.
» Running the example
In order to run the dev version of the game, follow these steps:
- copy the cannonCombat folder from the /deploy/extensions folder to your SFS2X installation folder, under /SFS2X/extensions;
- copy the CannonCombat.zone.xml file (containing the Zone configuration) from the /deploy/zones folder to your SFS2X installation folder, under /SFS2X/zones;
- start SmartFoxServer 2X;
- install the SFS2X_CannonCombat_DEV Adobe Air application available in the /deploy/client folder following the on-screen instructions;
- run the SFS2X Cannon Combat application.
» Source code setup
On the client side, in order to share the same common source package, both dev and prod projects have an external source folder (src) which you should configure under Project -> Properties -> Flex Build Path -> Source Path. Therefore, they differentiate in their Default Application mxml file only and obviously, descriptors.
The client projects are contained in the /source/client folder: import the two Flash Builder projects by pointing at the /source/client/dev and /source/client/prod folders. You will need to adjust the path to the external source folder as described above.
The projects must target Flex SDK 4.6 or later and the Air SDK 2.0 or later; in order to do this you have to perform one of the following actions. Flex SDKs can be found here: http://opensource.adobe.com/wiki/display/flexsdk.
More informations are available in the walk-through below.
Cannon Combat also features a server-side Extension, as described in the walk-through. In order to access its code, create and setup a new project in your Java IDE of choice as described in the Writing a basic Extension document. Copy the content of the /source/server/src folder to your project's source folder.
» Walk-through
Cannon Combat was developed by A51 Integrated. You can download and read the developer's walk-through, which discusses the main SmartFoxServer 2X features and techniques implemented in the game.
>> READ the developer's walk-through <<
» More resources
You can learn more about the involved SFS2X features by consulting the following resources: