Quote:
Originally posted by leight
Ps: This is a great thread, we can discuss ways of coding. Tom, maybe you want to add this to a sticky.
we want a sticky, we want a sticky...
Quote:
Just habit mainly.
The first frame has everything defined on it, prototypes / functions / classes etc and then the 2nd frame is just the actions layer with:
init();
attractMode();
stop();
and that's it. It just my way of making sure everything is initialised for when I start running things.
It's prolly not needed, but another one of my quirky little habits.
Squize.
hmmm. I might start doing that, it looks nicer. what i do at the moment is put init(); etc at the bottom of my code...
Quote:
In my current game template I have 300 frames, not all used, I space the sections out every 20 or so frames. the sections go as follows (frame labels):
*preload *logo *error *splash *menu *controls *options *instructions *highscores *gameInit *game
*gameInit is 5 frames long and holds all the code that is needed in the actual game
*gameInit frames 1 and 2 contain globals, prototypes, here I place all movieclips that will be attached at some point during the game.
*gameInit frame 3 contains all variables used in building the game, this may be tilesize, worldwidth / height, buildspeed (used for eye cany in the games); things that will directly change the gameplay
*gameInit frame 4 contains level information
*gameInit frame 5 containg all the code functions used in the game, these may be seperated into sections and stored as seperate .as files (to make finding and changing code easier), depending on the number of lines.
the game frame simply contianes two lines used to set the ball rolling
stop ();
newGame (0);
any other code used in the game is generally imported as packages (classes), if possibl I make it a point never to directly attach scripts to buttons and movieclips. all code is put onto frames > myButton.onPress=function(){}. and where possible; I try to keep code on the main timeline (apart from the obvious stop() commands)
A game I'm currently re-writing has code on two frames, and 1 class. that's all (and the gameplay is complete)
Having said all that, go with what works best for you!
always comment your code : )
I dont know if it would, but wouldent that affect file size quite a bit???