|
InteractivityNow we have to add some degree of interactivity. Here are the issues we have to fix:
(Issues from 2 to 4 are solved in Step 8) If we need to add interactivity, then an EVENTS section has to be added. So, please add it after the END_SETS keyword and before the END_WORLD keyword. Like this (copy+paste just the code in bold):
Please note that the EVENTS section only delimits a text area. In this text area, you program in a very simple but yet classic programming language, called SmallBasic. SmallBasic is similar to VisualBasic or QBasic. You find all the necessary information in the Programmers' Reference. This section is used to specify the behaviour of the game in relation to EVENTS. In order to fully understand what we will do now, you should go and read the section named "The DimensioneX EVENT model" in the Programmers' Reference. However, I suggest you can skip this by now and do it later. Now we will program one event for each issue we have to solve, from the above numbered list. Let's go. Unlocking the doorTo unlock the door, you USE a key (say, key1) WITH the door (whose ID is w2) by using the USE WITH command. When you do this, a onUseWith event triggers. So, we specify what should be done in that case by using SmallBasic (insert code in the EVENTS section):
Here is a simple explanation of the above.
Save the game, restart it and try it - it works and you can now enter the room. But you cannot yet open the box. See the next step. Note: If you do not like the USE WITH interface, you should know that you can design a custom command such as "Lock/Unlock", even render it as a graphic button. See the tutorial on Custom panels for this (but later, please, now continue this one until the finish)
|