Changes between Version 9 and Version 10 of pps/tutorial_basic
- Timestamp:
- Sep 30, 2008, 8:12:28 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
pps/tutorial_basic
v9 v10 81 81 You should now be able to fire quicker. It doesn't yet go faster than the framerate though. [[br]][[br]] 82 82 83 === XML loading ===83 === Declare XML loading === 84 84 This part is about how you can load class parameters with XML. Unlike ConfigValues, XML parameters are per object instead of per class. That means you can load multiple objects of the same class with different settings. We are now going to add one XML parameter for the TutorialShip class. [[br]] 85 1.Find the ''XMLPort()'' function in the source file. You can see that there is comment but no statement after it. That's where you can insert the macro which specifies a parameter. Keep in mind that when loading with XMLPort, you need to have an access and a store function (not just a variable). These have already been created for the ''specialEffects'' parameter which tells the underlaying !SpaceShip whether to visualise the special effects. The syntax for XML parameters is:85 Find the ''XMLPort()'' function in the source file. You can see that there is comment but no statement after it. That's where you can insert the macro which specifies a parameter. Keep in mind that when loading with XMLPort, you need to have an access and a store function (not just a variable). These have already been created for the ''specialEffects'' parameter which tells the underlaying !SpaceShip whether to visualise the special effects. The syntax for XML parameters is: 86 86 {{{ 87 XMLPortParam(class 87 XMLPortParam(classname, parameter name as string, setSpecialEffects, hasSpecialEffects, xmlelement, mode); 88 88 }}} 89 89 (You only need to adjust the first two macro parameters) 90 91 === Configuring the XML parameter === 92 Where to modify that XML stuff now? Of course in an XML file. It is the same that you have already opened previously when switching from !SpaceShip to TutorialShip. Look at the XML attributes: The first ones sound cryptic and are on one line. Ignore them and add a new line afterwards. Here you can configure your self declared XML parameter: 93 {{{ 94 <TutorialShip 95 # Some unimportant parameters. Better don't mess with them ;) 96 camera="true" position="0,0,0"....... 97 # Your own. Set it to "false" to disable showing special effects. 98 name-of-your-parameter="true" 99 /> 100 }}} 90 101 91 102 === Logging messages ===