Tutorial Step 6 – Lock the door

Tutorial Step 6 – Lock the door

Now, we need to get the door locked.

As you will see if you consult the Developers’ Reference, this can be done by adding some attributes to the door (LINK object). In practice, you tell DimensioneX that the door is closed and locked.

Edit the world.dxw file, and modify the LINK definition for passage w2 so that it looks like this (modifications are in bold):

LINKS
LINK w1 park-bungalow N
LINK w2 bungalow-bedroom N
NAME a door
ICON icoDoor.gif
ATTRLIST open=0,locked=1
END_LINKS

Now save, and restart the game for another test, exactly as you did for. You will see that the door is closed, and if you try to open it the system tells you it’s locked.

Look at the inserted code:

  • door is closed –> open=0
  • door is locked –> locked=1

In DimensioneX, much of the object behaviour is controlled by the objects’ attributes. The system already knows how to handle the most frequent cases (closed, locked doors, heavy or hidden objects, etc) so no programming effort is required from you. Everything else is done by you via simple scripts (this may require little programming skills).

You just had a demonstration of what the open and locked attributes can do; a programming example will be left as the last step.

Now, proceed to the next step.

 

Next Step of Tutorial (old site) >>
Tutorial Step 5 - Define the game's plot

Leave a Reply

Your email address will not be published. Required fields are marked *