Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 9 and Version 10 of pps/tutorial_basic


Ignore:
Timestamp:
Sep 30, 2008, 8:12:28 PM (16 years ago)
Author:
rgrieder
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • pps/tutorial_basic

    v9 v10  
    8181You should now be able to fire quicker. It doesn't yet go faster than the framerate though. [[br]][[br]]
    8282
    83 === XML loading ===
     83=== Declare XML loading ===
    8484This 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:
     85Find 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:
    8686{{{
    87 XMLPortParam(class name, parameter name as string, setSpecialEffects, hasSpecialEffects, xmlelement, mode);
     87XMLPortParam(classname, parameter name as string, setSpecialEffects, hasSpecialEffects, xmlelement, mode);
    8888}}}
    8989(You only need to adjust the first two macro parameters)
     90
     91=== Configuring the XML parameter ===
     92Where 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}}}
    90101
    91102=== Logging messages ===