views:

63

answers:

4

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.

A: 

SourceMate plugin for Flash Builder and (I think) flex 3, its a great tool, and it assist will massive amounts of boring stuff - for example building 1,000,000 classes on a new project.

http://www.elementriver.com/sourcemate/ - It well worth the cash. only £50

Glycerine
A: 

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...

Iain
+1  A: 

If you're using FlashDevelop you can create your own project template based off of one of the defaults. The templates are in:

Your FlashDevelop Install dir\Projects\

A typical template file looks like this, and it shouldn't be very hard to change them up to extend your basic framework instead. You can add multiple files to a project template. Not super sure about adding the import though, that might have to be a manual step, unless you feel comfortable adding a copy of it to each project.

package $(PackageName)$(CSLB){
    import flash.display.Sprite;
    import flash.events.Event;

    /**
    $(CBI)* ...
    $(CBI)* @author $(DefaultUser)
    $(CBI)*/
    public class Main extends Sprite $(CSLB){

        public function Main():void $(CSLB){
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }

        private function init(e:Event = null):void $(CSLB){
            removeEventListener(Event.ADDED_TO_STAGE, init);
            // entry point
        }

    }

}
grapefrukt
A: 

Using FDT, its possible to import Project as folder tree or zipped archive in your current workspace. So you only need to have an archive of a blank project filled with your classes and linked to your libraries and import it to create a clone.

sroucheray