DimensioneX Change language On-screen objects


Home
Features
Play Online
Download
Forum
Tutorial
Documentation
Wiki
Support
Resources
Members
Gadgets
Contacts
Links






free screen-saver
Fantasy Screensavers and Desktop Backgrounds

 


DimensioneX on SourceForge.net

 

Using On-screen objects

KB Article n. 013
Date: 27 April 2003
Originally for: DimensioneX 5.0.5

Abstract

This article explains how to use the SHOW and SHOWAREA keywords for adding realism and impact to adventure games developed on DimensioneX

 

In the beginning...

In the beginning, DimensioneX was showing the visible items and characters by means of a list of labelled icons placed at the right side of the scene picture (see below).

When DimensioneX rel. 5 was initially released, the characters and players started being displayed by default directly on the screen, while the items remained accessible via the usual icons list.

From the release 5.0.5 it is possible to further control this behaviour, and extend this feature to ITEM objects, so to achieve a result as in the following example:

If you want to learn how to do it, just follow this simple tutorial.

About the SHOW modes

Basically, characters and items can be shown in three modes: 

  • SHOW OFFSCREEN
  • SHOW ONSCREEN
  • SHOW ICON

OFFSCREEN means that the object will be shown in the icons list, i.e. as in the picture below, indicated by the green arrow: 

This is still the default behaviour for all ITEM objects.

ONSCREEN means that the object should be shown on the scene picture (i.e. as the trash can and the surfer in the picture below): 

This is the default behaviour for all players and characters.

ICON means that the object is displayed as an icon on the scene picture (i.e. the keys in the above picture).

The chosen show modes (where different from the default) should be specified in the game file while describing the CHARACTER or ITEM object.

Positioning: the baseline

Characters and items usually move across the game environment. Determining for each room picture where exactly to place the object is definitely not a trivial task, as it normally requires a number of data about the scene geometry and the objects' spatial coordinates.

DimensioneX is designed to be simple and quick, so a compromise was sought, found and adopted.
DimensioneX uses the concept of the baseline. The baseline is the line on which all on-screen objects appear sitting on, and it is drawn in yellow in the picture below.

it ideally runs across the picture from side to side and it is placed at 10% of the scene's height (yellow line).

By placing characters on the baseline, DimensioneX displays and handles correctly most of the situations. Later, you can refine this behaviour for the scene pictures in which the layout is not correct.

The yellow baseline defines implicitly a second, lower baseline. All ITEMs are placed on the second baseline, which is always placed at half height (orange line, picture below), so that items are not hidden by players and characters.

A quick summary

  • All players and characters, by default, are displayed ONSCREEN
  • All items, by default, are displayed OFFSCREEN
  • This behaviour can be changed by you in the definition of any CHARACTER or ITEM. 
  • All on-screen objects are placed on the baseline
  • You can change the position and the size of this baseline for any scene picture.

Syntax of SHOW modes

To specify a SHOW mode for an object, simply state it by using the SHOW keyword, like this example:

ITEM key1
NAME a key
DESCRIPTION Each lock is opened by a key... and each key opens a lock... isn't it?
POSITION spiaggia2
ICON icoKey.gif
ATTRLIST pickable
IMAGE 67x50 chiavegold.gif
SHOW ICON

As you see, it is sufficient to add a SHOW mode line in the object's definition. 

The above example refers to a key object which appears, in form of an on-screen icon, placed on the scene's baseline.

Its complete syntax is defined in the Programmers' Reference, which you should always consult in case of need.

If you're not satisfied of the default placement of your object, or also if you want to achieve a particular layout (i.e. hiding an object in a picture) you can specify additional coordinates in the form x,y which tell the engine where to display the object. The origin (0,0) is the lower-left corner of the picture. 

Example #1: The trash can is positioned in the lower-right corner of the screen.

ITEM trash
'... other parameters
SHOW ONSCREEN 250,0

The co-ordinates (250,0) are easily calculated: 250 is the scene width (350) less the trash picture width (100). The y coordinated is 0 so the trash bin is shown sitting on the bottom border of the scene.

Example #2: Only y co-ordinate is specified so that the y placement is defined, but the x position is random. This is used to show the butterfly icon higher in the picture.

ITEM butterfly
'... other parameters
SHOW ICON -1,100

Please not the use of the special value -1 meaning "use the dafault" for the x co-ordinate, while the y co-ordinate has been set to 100. In fact, the butterfly is displayed higher up in the picture, while the frog icon, which uses the default automatic placement, is sitting on the items' baseline.

Always refer to the latest Programmers' Reference for more details or if in doubt.

Beware: it is recommended to use the co-ordinates only for those objects which cannot be moved. Otherwise, when used on a different scene, the co-ordinates may produce an incorrect display.

Refining the baseline

While testing your game, you may detect a strange situation like this:

This is because, by having a baseline which runs across the picture, it may happen that characters are shown as they could walk on the water.

If this is not what you want, you should redefine the scene's baseline by specifying the SHOWAREA keyword, like this:

IMAGE SHOWAREA 165,300,50 scnBay.jpg

The part in bold was added to the IMAGE tag so to redefine the baseline. The syntax is the following:

SHOWAREA x1, x2, y

which completely defines the new baseline, so that you have the following, correct situation:

The rooster is now sitting on the new baseline.

Conclusions

  • Dimensionex rel 5.0.5 and later lets you show game objects on the scene picture.
  • The default behaviour can be changed by using the SHOW tag in the object definition. 
  • All objects sit on the scene's baseline, or you can specify their placement your own.
  • The scene's baseline can be redefined at your preference to avoid strange effects.
  • See Programmers' Reference for the syntax.
  • Test your game to spot and fix display errors.

Send us your work

We are looking forward to receive new games to be put online. Submit your work to us, and you will become an effective member of the DimensioneX project, also you will enjoy a number of benefits. Full credit is given to contributors.