I never thought development of web games can be that simple until I started development of my first game with Adobe Flex. I made two games, without any prior experience with Action script, in only ten months: "Fitter" and "RGB".

I found many answers to my questions on different forums and web sites, and it is time to share my knowledge with Flex community.

Monday, October 26, 2009

Setting up project environment

In this chapter you will learn how to set up new project for the game development, without use of Flex Builder (creation of new project in Builder should be trivial).

Inside the folder, where you keep your other projects, create new folder and name it SnakesAdventure. For example, I keep my projects in c:\myProjects folder in Windows and /home/user/myProjects folder in Linux. SnakesAdventures folder is now the root folder of the project, later it will contain all scripts, images, sounds and source code files. If you would like to keep different file types in different folders, create folders Classes, Images and Sounds inside project folder.

Build script

Now we will create new script file, that compiles all source code files and builds all content files into single SWF file. Open text editor, create empty file, copy content of the script for your system and follow the instructions. If you are Windows user, I recommend you do not edit source code and scripts in Windows Notepad, use advanced text editor that supports syntax highlighting (Notepad2, UltraEdit...).

Build script for Windows

Enter correct path to compiler executable (mxmlc.exe) on your system and save file as Make.bat:
C:\PROGRA~1\Flex3\bin\mxmlc.exe SnakesAdventure.mxml
Build script for Linux

Enter correct path to compiler executable in MXMLC definition and save file as Makefile:
MXMLC = ~Flex/bin/mxmlc
MFLAGS = -benchmark

TARGETS = SnakesAdventure.swf

all: $(TARGETS)


.SUFFIXES: .mxml .swf

Execute the build script

On Windows: open Command Prompt, enter project root folder and start the script with command make.bat. On Linux: open terminal, enter project root folder and start the script with command make.

Script execution should fail, because source file SnakesAdventure.mxml is not available, yet. Flex compiler reports following message on my system (Windows):
Error: unable to open 'SnakesAdventure.mxml'

Use 'mxmlc -help' for information about using the command line.

1 comment:

  1. If you want to stop compiler window from closing in case you recieve errors add a new line to your make.bat and write pause.