< Start
Every class must comply to certain rules, so we can verify that the code works as expected. When creating a new class this means:
There are three use cases for mapping areas in a rendered image:
The first and the last case are very similar. Only in the first case the entries already exist and have to be replaced. All the mapping in the game (not the startup) are defined in mainScreen.xml. For each rendering there is a image section. within this section each area is defined with a polygon. The polygon has a speaking name identifying the part of the image in a unique way. A z-index can also be specified. This index specifies the back to front order. This allows simpler definitions of shapes if another shape is in the forefront. A high index indicates the object to be in the back. An area is defined by a number of points.
<!-- Properties for the images -->
<images>
<image name="portScene.png" crop="BOTTOM" maxCrop="920" type="o">
<!-- coordinates of the polygon in the unmodified image -->
<polygons>
<polygon name="LoadingCrane" z-index="1">
<point x="558" y="755"/>
<point x="558" y="628"/>
<point x="591" y="583"/>
<point x="610" y="494"/>
<point x="762" y="500"/>
<point x="760" y="538"/>
<point x="720" y="634"/>
<point x="716" y="755"/>
</polygon>
...
</polygons>
</image>
...
</images>
To figure out the coordinates open the image in painting application like Gimp. Move the cursor to a location that defines a corner of the shape and note the location within the image. Repeat this until you have all the points making up the shape. The coordinates reference points in the image with the original resolution. In the game the image will probably be scaled. The same scaling will be applied to the coordinates.
As there might be different resolutions there are three ways the image is prepared before it is displayed:
For the first step to work additional data must be specified in the image tag. The optional crop attribute defines where the image can be croped (TOP, RIGHT, LEFT, BOTTOM). The cropMax attribute then defines the maximal amount that can be cut away.
All these steps are staigt forward when starting at the definition of the scene in the mainScreen.xml and implementing the switch to the new scene. Starting the application now will gradualy pop up exceptions pointing to the next step to be implemented.
HowTo create Dialogs
HowTo integrate Dialogs in NoticeBoard
HowTo use DependentValue
HowTo implement a cheat command
Messages
Savegames
Visually test dialogs
HowTo define image segments
Wiki: Home
Wiki: HowToCheatCommand
Wiki: HowToDependentValue
Wiki: HowToDevDialogInNoticeBoard
Wiki: HowToDialog
Wiki: HowToMessages
Wiki: HowToSavegamee