 |
You can make a very involved adventure game using only the
core features of the AGAST Programming Language. Even if you have no
programming experience, you can learn everything you need to know on
this site.
As a prerequisite, you will need to at least have the skills to
make and remove directories, copy and rename files, edit text and
graphics files, and run programs.
How do I begin making a game?
Download and install AGAST.
In order for your OS to "see" the AGAST tools (the compiler,
interpreter, etc.), you may type something like the following
command at the command prompt:
SET PATH=%PATH%;c:\AGAST\Tools
To find out about more convenient ways to set the Path,
please read your OS's documentation.
AGAST includes a bare-minimum game in the "AGAST\SkeletonGame" directory. This game will compile as is, and includes a single scene (in the "AGAST\SkeletonGame\Tree" folder), as well as basic character, interface, and font graphics. You can use this game directly as a basis for your own projects, by copying all of it into a new folder, or you can just copy over the script files and insert your own resources. The scripts define what keyboards do, scripts like walk and turn for directing objects, and other important stuff.
In this project, "SkeletonGame" is the game directory.
You can put this directory anywhere you would like and rename it
to match your game's name. AGAST does not place any significance
on this directory name.
The scene directory names, though, are significant,
because they determine the name of each scene in the game.
The Sample Game has one scene, called "Tree," and therefore
one scene called Tree.
You can modify existing script files, and create new script files
simply by creating new text files with the ".s" extension.
You can give a script file any name. The only significance
that name has is to help you remember what's in it. Those
scripts in your game directory will declare game elements that
are part of the entire game, while those in the scene directory
will declare elements that are only in that particular scene.
Resources, such as sounds an animations, can be put in the
game directory to be available anywhere in the game, or in a
scene directory to be available in that scene only.
To define a game, you just have to define all the elements: objects
that your player can carry, objects that appear on the screen,
and events that happen when the user does something. You do all
these things by writing code in the script files.
See Also...
How do I add a new scene?
Suppose you want to make a game where you visit the local
mall and, say, later discover that it is really an alien spacecraft.
You might decide you want a parking lot, an entrance, a few halls,
some shops, and an alien bridge.
This is how such a game might look. The game directory is
highlighted in yellow and the various scenes are sub-directories
that branch from it.
To add a new scene, create a new directory that branches
from your game directory. The name of the new directory will
determine the name of the scene. Then create a script file,
and define an enter event inside it. That event code will be
triggered when the player enters the scene, so it should load the
background image, zbuffer and path, place the objects wherever
you want them to go, and generally setup the whole place.
See Also...
>What are events and how are they triggered?
Events are blocks of code that are triggered when
something happens: (1) when the game is started, (2) when a new scene
is entered, or (3) when the player uses an inventory object on something.
The main event is started when a new game begins. Inside, you
must select the player object, get all the inventory objects the player has when the
game begins, and enter the first scene.
Each scene has its own enter event that is triggered
every time the player enters it. It is responsible
for loading that scene's background image, for
placing the player in the start position, and whatever
else you want.
Other events are triggered when the player clicks
an object on another object in the inventory bar, or
clicks an inventory object on an environment object; these events make the
scene interactive. For example, here's an event that is triggered
when the player looks at his golden mop.
event Lookat <> GoldenMop
{
EGO:
"It's my trusty golden mop."
"I got that years ago for saving the galaxy."
}
The line EGO: says that the script is directing
the object named Ego. Each line in quotes is spoken by the
currently active object. (As far as I know, the term "Ego" was
coined by Sierra On-Line, in order to represent the player's
character without changing from game to game. AGAST's example code
uses it out of tradition.)
See Also...
How do I position objects and set up their animation?
Objects are controlled by setting their properties and
calling certain functions, which are documented elsewhere on
this site. An object can be repositioned with the setPosition
function.
Suppose you have an object named Ogre and you want to set
him 300 pixels from the left of the screen and 400 pixels from
the top. First you have to select the object.
OGRE:
Then you must tell it what to do with a function.
setPosition(300, 400);
The units are in pixels from the top-left corner
of the background image. When the image is scrolled, the
objects move along with it automatically (unless their
Absolute property is set to true, then they
will remain fixed to the screen).
There are many objects that you'll want the player to click
with the mouse pointer or inventory objects. To set the
object's clickable area, use:
setClickArea(-20, -20, 20, 20);
That will create an area of 40x40 pixels centered around
the the object.
But sometimes objects are just used for scenery and
you don't want them to be interactive. You can just
disable their Clickable property like so:
clickable = false;
To animate an object, you just have to specify which
sprites get displayed when the object is doing different
things like walking, talking, or just standing around.
To do this you use one or more of the "set anim" functions.
See Also...
How do I create these objects?
To create an object, you have to declare it, and
then define it by setting properties and calling functions.
The declaration looks like this:
object Bob
{
setPosition(509, 332);
clickable = false;
visible = true;
priority = PRIORITY_AUTO;
// and so on...
}
You can add code inside the braces that will be
started when the object's scene is entered. For game
objects (those declared inside a script file in the
game's main directory), the script will only be started
once when the game starts (right before the main event).
See Also...
How do I make objects talk?
Talking is really simple; just select an object
and tell it what to say.
Object selection is accomplished by using the
object's name followed by a colon. Here is a
conversation between Bob and Fred, two fictional
demonstration characters without much to say.
FRED:
"So, what do you want to talk about?"
BOB:
"I don't know."
delay 10;
"Did you ever stop and think how infinitely large the universe is?"
FRED:
"Yeah."
delay 10;
"You think intergalactic travel will ever be possible?"
BOB:
"I don't know."
delay 20;
"Maybe."
The delays add short pauses between the speech for effect.
(Timing is everything, isn't it?)
See Also...
What are variables and how do I use them?
Variables are simply values that have names. They are
used to store the state of your game by keeping track
of things that happen.
To use variables, you just have to learn the
assignment-statement (to set them) and the if-statement (to take
different action based in their value).
You can declare a variable called TalkedToGiantLizard
like this:
var TalkedToGiantLizard = false;
Actually, you can leave off the "= false" part, because
variables are automatically initialized to 0 or false.
Then, when the player really talks to a giant lizard,
add this statement to the "talk to giant lizard" event:
TalkedToGiantLizard = true;
Now you can use an if-statement to find out
if the conversation has already taken place. Here's how
it looks:
var TalkedToGiantLizard;
event Talkto -> GiantLizard
{
if TalkedToGiantLizard {
"Since he won't talk to me, I won't talk to him either."
}
else {
"Hi up there, Gozira!"
delay 10;
"He probably can't hear me, or he doesn't speak English."
TalkedToGiantLizard = true;
}
}
The first block of code is executed when the variable is true,
and when it's false the second block is executed instead.
See Also...
How do I organize all the game's files?
You need to know how to create and remove directories
(or folders) using DOS or Windows. Then just read
the section about the directory structure that is used.
See Also...
How do I load a background image?
There are some general properties that control the game. One
of them is the background image, and another is the zbuffer
(a mask that lets the player walk in front and behind different
things in the background).
You need to make to pictures with a paint program, and name
them according to a certain convention, in order for the compiler
to "see" them. The convention is "Name.resource.extension",
as in "MyBackground.image.pcx" and "MyBackground.zbuffer.pcx".
The ".resource" part tells AGAST what kind of resource it is
supposed to convert the file into, and the ".extension" tells
AGAST, Windows and other applications the type of the original
file. The original file is never deleted or altered,
and whenever you modify it, the compiler will notice that the
timestamp is updated, and re-convert the associated resource
file.
Just put them in the scene's directory, and the compiler
will convert and import them automatically. Then, to load
them along with your scene, just put these lines in that
scene's enter event:
backgroundImage = MyBackground_sprite;
backgroundZbuffer = MyBackground_zbuffer;
See Also...
|