Resources are not declared by script code, but by the existence of files in the game or a scene's directory. To declare a new resource, create a file with a recognizable extension, and the compiler will convert it into an AGAST resource file, and declare an identifier that can be used in script files. Some types of resources are recognized in their native format.

When a source file such as MyBackground.image.pcx is created in a game or scene directory, the compiler will call the 2image program to convert it into the resource file MyBackground.image, and it can be refered to in a script file as MyBackgound_image, as in


background = MyBackground_image;

The resource identifier will have the same scope as the elements declared inside script files in the same directory.

The "sprite", "image", and "font" resources are all compatible. An image is just a sprite with one frame, and font is just a sprite in which each frame corresponds to ASCII characters 33 and above.

Sound and music resources do not have to be converted because AGAST uses them in their native format. Sound resources must have the extention "wav", "wave", or "sound" (for Windows Wave files); and music resources must have the extention "mid", "midi" or "rmi" (for MIDI files); "mod"; "s3m"; "xm"; "it"; "mp2"; "mp3"; and "ogg".

There is nothing special to say about "path" and "zbuffer" resources. (There is more information about them in the tutorials, and in the documention for 2path and 2zbuffer.)

The last type of resource is "bin", which is just a custom binary data resource without any particular format. The script programmer can use this resource in any way.

See Also...