Friday, January 12, 2007

Flash PnC tutorial – 5. layout and common commands

Overview: a PnC adventure game has typically four or five segments:
- Preloader. The preloader ensures the entire game is loaded into memory before it begins, and displays the load progress to the player. They usually consist of two frames and three layers, they can be simple or fancy, and many can be downloaded as freeware from sites such as flashkit.com.
- Introductory scenes may include some animation, sets the storyline, and may have a help screen to explain how to navigate and so on.
- Help screen (could be part of the intro, but depending on your game, you may want it accessible from any point during gameplay)
- Game: rooms/walls, puzzles, scenery, cutscenes, etc.
- Ending scene(s) and credits.

It is definitely better for your sanity to place (most) all your scenes and name your frames first before setting up any navigation buttons or other action. It may behoove you to write a list of backdrops, the frame number, and what you named the frame. There’s so much stuff on the Flash 8 screen that there is not enough room to display everything at once unless you have enormous screen real estate. I found myself constantly switching between Actions and Properties, and scrolling the Layers window up and down, and scrolling the Actions up and down. It’s really pretty annoying and I wish Actions and Properties could be moveable windows, rather than being glued in place below the picture.

Commonly used commands

Important note: Flash is case sensitive. If you name an object ObjectName, this is different from objectname and objectName. Be really careful to stay consistent. This applies to commands as well, and Flash commands have a very annoying casing scheme. onRelease is a fish halfway out of the water. Fortunately the action panel's + and target icons will insert the correct command or object name.

Flash is more often employed as a way of making movies and animations. Normally frames flow. With a PnC, however, the action is stopping at pretty much every single frame (aka room). So the Actionscript for pretty much every frame in your Actions layer is going to end with
stop();

The navigation button moves you from one frame to another, whether left, right, up, down. Its code is usually
On (release) {
gotoandPlay(“SomeOtherFrame”) ;
}

or if being coded externally,
navbuttonname.onRelease = function () {
gotoandPlay(“SomeOtherFrame”) ;
}


Displaying text in your dialog box is always done externally (you did set its type as “dynamic text” in Properties, didn’t you?) In the Actionscript for a button, code as follows:
on (release) {
_root.DialogBoxName.text = “You are now in some other room.” ;
}


or in the frame’s Actionscript:
objectname.onRelease = function () {
_root.DialogBoxName.text = “This is a box of unknown function.” ;
}

No comments: