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:
"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...
- 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!)
I've also posted this on Stack Overflow.
Update1:
In FlashDevelop there is an option called "templates" that lets you generate classes. Explained here: http://catfacegames.com/2009/01/19/flashdevelop-templates/
"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!)
Comments
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: http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/filesystem/File.html
You're not the first that's asked this question and I'm not the first to answer with AIR: http://www.fdt.powerflasher.com/forum/viewtopic.php?f=21&t=7356
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!
Mark
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.
FlashDevelop keeps on surprising.
- Tahir.