Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 2 and Version 3 of pps/tutorial_basic


Ignore:
Timestamp:
Sep 28, 2008, 10:54:51 PM (16 years ago)
Author:
rgrieder
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • pps/tutorial_basic

    v2 v3  
    3636'''Now we extend the Ship'''
    3737As you might have recognized some features of the Ship were missing:
    38  * You can't fire (quite limitating)
    39  * ...
    40 In order to change this there are a few steps required:
    41  1. Open the files TutorialShip.cc and TurorialShip.h (in trunk/src/orxonox/objects) with your favorite IDE or console
    42  2. (???)
    43  3. ...
    44  4. Now edit the levelfile ( Media/levels/sample.oxw ) to use TutorialShip instead of !SpaceShip instead
    45    - find the line where the the !SpaceShip gets loaded
    46    - change !SpaceShip to TutorialShip
    47    - add the new parameters (???)
    48    - save and close the levelfile
     38 * No special effects
     39 * You can't fire in continuous mode
     40
     41== TutorialShip Class ==
     42We have derived a new type of SpaceShip for you: TutorialShip. The back end doesn't have to bother you (you will notice that some functions don't seem to be doing anything at all). [[br]]
     43At the moment, you are using the SpaceShip class. We would like to change this. Fortunately this can be done in an XML file where we load the level.
     44 1. Go to your media repository (orxonox/Media) and open ''tutorial.oxw'' in the ''level'' folder with a text editor like vim, nano, etc.
     45 1. Find the second paragraph (about 5th line) and change ''SpaceShip'' to ''TutorialShip''
     46 1. Save the file. You can keep it open, we need it again later.
     47Next thing will be to change the code accordingly, since the game will probably crash now when started. [[br]]
     48We organise our source files via CMake as you have already found out. You now have to tell CMake to also compile the ''TutorialShip'':
     49 1. Open orxonox/trunk/src/orxonox/CMakeLists.txt
     50 1. You will see a large list of source files (*.cc). You can add "TutorialShip.cc" anywhere you like, but it is preferred to organise the file a little bit. So look for SpaceShip.cc and add things there.
     51 1. Save and close.
     52The interesting part: Modifying the C++ code. '''Open orxonox/trunk/src/orxonox/objects/TutorialShip.cc'''. As you have already heard from Fabian, the Core Framework is like a language extension to C++. But it cannot be 100% automatic. That means you have to add a few lines accordingly:
     53 1. Find the constructor (TutorialShip::TutorialShip()) and add '''RegisterObject(TutorialShip)''' as the first statement. This is used for the class hierarchy and for the ObjectLists.
     54 1. do more stuff
     55 1. (???)
     56 1. ...
     57
    4958'''Now start the game again and do some fancy in-game-stuff'''
    5059 1. (???)