This section is to introduce you to Flash, Actionscript 3.0 (as3), and some associated terms.
Game programming can be fun and enjoyable, but it is hardly ever easy.
You can learn the basics from other people, but a lot of stuff you’ll have to struggle through and figure out yourself.
The most fun part for me is seeing your creations come to life, especially after putting a lot of time, and effort into making things work the way you want to.
Let me know if you create any cool games based off my tutorials, or if you don’t understand some of the information!
Why Create Games Using Flash?
Once you learn the basic programming techniques in any programming language, you can program games in any other language much easier.
But why program games using flash?
Some of the things that makes flash a good candidate for game programming are:
- Easy to have other people play your games, which leads to quicker and a lot more feedback, which helps you learn and refine your games. Flash runs in the browser, and your game will get a lot more exposure if all someone has to do is click on it, versus needing to download and install it, risking potential viruses.
- Many tools already built in. It’s very easy to display graphics quickly using Actionscript, as well as play sounds, load XML, and even communicate with servers to store data on the web.
- Easier to get started than C++. In flash, you can quickly focus on the core game-play, whereas other programming languages like C++ using DirectX or OpenGL, you have to handle window initialization, troubleshooting library importing issues, and handling memory management. In Flash, most is handled for you, which allows you to focus on creating your game.
Some drawbacks to programming in Flash:
- Flash is much slower than C++ or Java. For very intensive games or applications, flash has too much overhead and significantly slower than a similar program created using C++ or Java.
- The Flash IDE and Flex Builder IDE are limited in code completion, and more difficult than other IDE’s to program in (but this can be fixed by using FlashDevelop).
- Limited choices. TO make development easier, a lot of choices/ freedom is removed in flash. You can’t decide on a different renderer, there are a limited number of IDE’s, you can’t clean up memory that is no longer being used, and apple has decided not to allow their devices to view flash content.
All in all, with using FlashDevelop, I think Actionscript is a great language for beginners looking how to program games.
It’s pretty simple to use, pretty forgiving, but also has the power of a full language, to create objects, classes, class inheritance, and pretty much everything you would have available using C++.
Some Terms to Know
When talking about game programming in flash, there are some terms you need to know.
The flash player: This is what is installed on any computer able to see flash videos, or games online. The user has to install this browser plugin, which will allow them to view flash content.
Most computers already have this installed, and an easy way to tell if a moving video/ game is being rendered using flash is to right click on it and check for ‘Adobe Flash Player’.
The flash player runs on Windows, Linux, Android 2.2 and above (Froyo), and even Mac OsX. Apple has chosen not to let their users use it on iPods, iPhones, and iPads.
Actionscript: Actionscript is the programming language used to program flash content. ActionScript 3.0 (also known as as3) is the current version, and is a full object oriented language, unlike its previous versions.
Object Oriented Language: This is a language that allows you to program by creating objects.
For instance, if you want to create a table in your game, you create a CLASS called ‘Table’.
From this class, which is basically a blueprint of what the object can be, you can create Table objects.
For example, you can create a table class that can contain the number of legs, and the height of the table, and create two different tables by filling in how many legs each will have, and how tall.
This will be explained further in future tutorials.
Flash Develop : This is the preferred IDE (Integrated Development Environment) for programming in ActionScript, and is offered completely free and open source!
An IDE allows you to input text/code, check to make sure the code syntax is correct (looks for simple errors), and compiles your code into a program that can be run.
In addition, FlashDevelop has intelligent code hinting for your code and built in functions, which makes it easier to learn, and quickly look up function parameters.
It also auto imports any libraries you need as you create objects that depend on them, as well as being fast and efficient to code and compile in.
The Flash IDE, aka Flash CS3, Flash CS4, Flash CS5, ect: This is the IDE created by Adobe, which is primarily used as an animation tool.
It uses timelines to easily be able to put together animations, as well as features tools for drawing similar to Adobe illustrator. Flash cartoons are created using this, and you can even create a SouthPark like cartoon using it!
It does support using ActionScript, but it is best used for controlling drawings on stage, rather than as a full programming environment. Flash CS5 has limited code hinting, but is a chore to use compared to FlashDevelop.
The best things to use this are for creating vector images, animations, or for simpler ActionScript commands, such as making quick animations on a flash based website. You can use it for programming ActionScript, but it’s much more of a chore than using FlashDevelop, and can be a pain to use at times, since it’s built primarily for animating.
Flex and MXML: Flex is an SDK released by Adobe, which allows FlashDevelop to compile flash programs, as well as introducing a language used for programming applications called ‘mxml’.
It is pretty easy to get started in it, and very useful for developing desktop applications using Adobe Air.
Adobe Air provides additional functions, to allow you to load and save to disk, drag and drop files/ images directly into the application, and giving you all the told you need to make a complete desktop application fairly quickly.
Flex and MXML can also be used for creating web applications, but it’s very useful for creating desktop applications.
Flash Builder aka Flex Builder: Flash Builder (which was known as Flex Builder) is Adobe’s IDE for developing Flex Applications. It is built upon the open source ‘Eclipse’ Platform.
FlashDevelop can also build Flex applications, but Flash Builder has tools to make it easier. It includes a visual layout view, so that you can drag components, such as textfields, buttons, drop down menus, ect, directly onto your application. It is also pretty good at code hinting for Flex tags, but still lacks for code hinting for Actionscript.
So now you should have some idea about the terminology surrounding Flash and ActionScript game development.
In the next section, I’ll show you how to download and setup FlashDevelop, and compiling your first program.
Where to go from here?
First check out the next tutorial. After that, there are several books on flash game programming using ActionScript , as well as blogs and websites.
I’ll post the ones that I have found helpful, or refer to often in the ‘Resources’ section on the toolbar at the top of the page.