Help! How do I generate classes for a new project?

Ok readers, I gave you my indispensable Gamepad class, now I need something back: Whenever I start a new game, I make a whole bunch of classes that extend my base classes, so:

  • com.blah.Game extends com.iainlobb.Game and has some setup code
  • com.blah.Player extends com.iainlobb.Player, and has some setup code
  • etc
Now all I need is a way to generate these classes at the start of the project so I don't have to create each one manually. It will save me at least an hour of faffing around per game. So how do I do it? I normally use FlashDevelop but I also have FlexBuilder 3, or I'm happy to download whatever other software I need (PC). Thanks. I'm looking forward to your thoughts - check back to this post for the solution soon (hopefully!)


In FlashDevelop there is an option called "templates" that lets you generate classes. Explained here:

"First, inside of FlashDevelop access “Tools > Application Files” from the menu. This should open an explorer window where you see a few folders. Drill down into the following folders: Templates > ProjectFiles > AS3Project."

Adds options to the right click menu. Doesn't add all the classes at once like I originally wanted though...

Update 2:

I think we have a winner! No lesser person than Philippe from the FlashDevelop team has suggested this in the comments:

Duplicate FlashDevelop's AS3 project and add whatever classes you need (FD/Projects in Program Files).
At first I thought he meant look in the AppData>Local>FlashDevelop>Projects but there was nothing there. So, I re-read and found what I was looking for in C:\Program Files\FlashDevelop\Projects. I copied this folder and pasted it into the AppData>Local>FlashDevelop>Projects, and renamed to "001 Game". Now when I hit new project, I have an option called "Game" which builds the folder structure I need, creates and names my classes, etc. This is really powerful! Thanks again Philippe for an amazing bit of software and for your help. Readers who haven't used FlashDevelop: you have no idea what you're missing (and it's free ffs!)


Jolyon said…
There's this cool new project Adobe have been working on called AIR, not sure if you've heard about it :P

It runs on Windows/Mac/Linux and has access to the file system.

With your coding skillz, you could probably knock something up in about an hour.

Have a look at the docs page for File:

You're not the first that's asked this question and I'm not the first to answer with AIR:
markstar said…
I agree with Jolyon, I would use AIR. I've done things like this before where I'd load in a template file, change a few parameters and then spit out the new version of the file.

If you create your own app for it then it'll be easy to upgrade it when you need to and it'll be specific to your needs!

Philippe said…
Duplicate FlashDevelop's AS3 project and add whatever classes you need (FD/Projects in Program Files).
Jolyon said…
The other option is to create Interfaces instead of SuperClasses, so you implement your Game code instead.

Not sure how FlashDevelop handles this, but in FDT, when you create a class and set an interface, it will generate all the interfaces' methods for you.

You could always extend AND implement.
Karl said…
Did you already post about these base classes you're talking about? Sounds interesting.. ;)
Iain said…
@Karl ha ha one thing at a time. Doing open source etc is all new to me, but my policy is to not release any code that I wouldn't be happy to put my name to, and I'm not anywhere neat there yet with game framework.
Anonymous said…
I'm with @Philippe - use FlashDevelop's own functionality to create a new project type that auto-generates your classes for you :)
Tahir Ahmed said…
Oh Thanks so much for this; it will save me tons of time too.

FlashDevelop keeps on surprising.

- Tahir.
derek knox said…
Nice, I switched to FD a while back from FB3 and I'm digging it. Just took your notes to help create a custom auto generated Class file, thanks a ton.