The previous example offered very little gameplay. Let's make it more appealing.
We will add a nice background, and a few interesting commands for the player.
ROOM main { IMAGE { "gr/idol.jpg" // Backdrop picture } WALK { "gr/idol_bm.gif" // Walking area } ITEM Indy // My hero :) { ANIMATION { // --- standby images --- 0 0 "gr/indy_d.gif" 1 // Looking South 0 1 "gr/indy_r.gif" 1 // Looking West 0 2 "gr/indy_u.gif" 1 // Looking North 0 3 "gr/indy_l.gif" 1 // Looking East // --- walking animation --- 1 0 "gr/indy_wd.gif" 4 // Looking South 1 1 "gr/indy_wr.gif" 6 // Looking West 1 2 "gr/indy_wu.gif" 4 // Looking North 1 3 "gr/indy_wl.gif" 6 // Looking East // --- talking animation --- 2 0 "gr/indy_td.gif" 7 // Looking South 2 1 "gr/indy_tr.gif" 4 // Looking West 2 2 "gr/indy_tu.gif" 1 // Looking North 2 3 "gr/indy_tl.gif" 4 // Looking East } POSITION { 170 170 0 } ITEM whip { ICON { "gr/whip.gif" } } } ITEM Idol // An archeological marvel ! { IMAGE { 0 0 "gr/idol.gif" } POSITION { 155 135 0 } } /* And now, a bit of foreground vegetation */ ITEM plant_1 { IMAGE { 0 0 "gr/plant_1.gif" } POSITION { 0 182 0 } } ITEM plant_2 { IMAGE { 0 0 "gr/plant_2.gif" } POSITION { 256 182 38 } } ITEM plant_3 { IMAGE { 0 0 "gr/plant_3.gif" } POSITION { 190 182 0 } } /* Triggers */ COMMAND "Look at" whip { SAY indy "I never get out without it!" } COMMAND * whip // This will match any sentence refering to the "whip" object { SAY indy "I can't do that" } }
Backgrounds are essential in this kind of games, but adding a background is
not about just specifying a picture. You need to specify a walkable area for the player.
If you don't, realism will be lost since the player will freely walk across the screen,
giving the impression of flying above everything. The areas are defined in a two-color
(black&white) picture with exactly the same pixel size as the backdrop, as show below.
Care must be taken of initially placing the character in a "walkable" area of
the room, otherwise it won't be able to move at all!
The image files are specified in the room's IMAGE and WALK sections.
In the listing, you can also see the item's ANIMATION section detailed.
There are 4 directions (N,S,E,W) and several attitudes (STANDBY, WALKING, TALKING) for
each item. Each attitude and each direction is associated to a number. For example,
"talking" is attitude #2 and "south" is direction #0 for the system.
The last number after the filename is the actual number of frames in the animation. As you
can see below, an animation file is made up of an horizontal stripe of frames included
into a single regular picture.
You only need to specify images for the directions and attitudes that are really going to
be used throughout the game. For example, the vegetation items are never going to move, so
only one image is specified for them.
The 3 coordinates system is quite simple. The first 2 coordinates are absolute pixel
position within the background picture, with point (0,0) being the topleft corner of the
background. The third coordinate is the elevation from the floor (normally zero).
Notice the use of the wildcard character "*"
to match words in sentences.
As before, you have to import this script into the engine, and test it.