DimensioneX Change language Step 7


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

 

Add items and a character

It's the right moment to add the items, and our computer controlled character. Paste this text after the END_LINKS tag but before the final END_WORLD tag:

CHARACTERS

CHARACTER surfer
	NAME		a surfer
	DESCRIPTION	Walks here and there, it seems he's got nothing to do
	POSITION	park
	ACCEPTS		key1,key2,key3
	IMAGE		120x120	chrSurfista.gif
	
END_CHARACTERS


' *****
ITEMS

ITEM box
	NAME		a cardboard box
	POSITION	bedroom
	ICON		icoScatola.gif
	DESCRIPTION	This box looks sealed.
	IMAGE		80x64	box.gif
	SHOW		ONSCREEN

ITEM	key1
	NAME		a key
	POSITION	rndSet(setPark)
	DESCRIPTION	It's a key...
	ATTRLIST	pickable,type=key
	ICON		icoKey.gif
	IMAGE		67x50 chiavegold.gif
	SHOW		ICON


ITEM	key2
	NAME		a key
	POSITION	rndSet(setPark)
	DESCRIPTION	It's a key...
	ATTRLIST	pickable,type=key
	ICON		icoKey.gif
	IMAGE		67x50 chiavegold.gif
	SHOW		ICON


ITEM	key3
	NAME		a key
	POSITION	rndSet(setPark)
	DESCRIPTION	It's a key...
	ATTRLIST	pickable,type=key
	ICON		icoKey.gif
	IMAGE		67x50 chiavegold.gif
	SHOW		ICON

ITEM 	scissors
	NAME		the scissors
	POSITION	surfer
	DESCRIPTION	Some nice and sharp scissors.
	ATTRLIST	pickable
	ICON		icoScissors.gif
	IMAGE		100x73	scissors.gif
	SHOW		ICON

END_ITEMS

' *****
SETS
SET setPark	park,bungalow
END_SETS

Now save the game file, Restart the game and test it all, verify you can pick up keys and do other things (a typical screenshot below).

Understanding what the code means

Before proceeding, let's comment the added code. Everything is explained in detail in the Developer's Reference.

  • The CHARACTER definition, closed in a CHARACTERS section, specifies how the surfer is like. Its location is specified in the POSITION tag. Notice also how we specified what items he can accept. By default it will accept nothing. 

  • Notice that all the objects are referenced via their ID.

  • There is an ITEMS section, including data on all game items.

  • The keys have an additional attribute: type=key. This will let the game engine distinguish the keys from all other objects in step 9

  • SHOW ICON means that the object will appear on the scene with its ICON. SHOW ONSCREEN means that the object will appear with its full IMAGE. There's a tutorial on this topic here if you're interested (but don't do it now, please)

  • The SETS section below is interesting: It defines a set made of two rooms which is used for positioning items at random. The rndSet( ) function used in the POSITION attribute for the keys tells DimensioneX that each of the key must be positioned, at game start, in a random room chosen between the ones included in the specified set named setPark. A useful tip to introduce a bit of unpredictability.

Even though we have all the elements, the game still misses interactivity. Also, we can't unlock the door. This will be added in the next step.

If you have troubles at this point, you may want to download the tutorial game as it should appear now

Previous Next