[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This is a tutorial to show how you can use Crystal Entity Layer in your own applications. The game data needed by this tutorial can be downloaded from:
http://www.crystalspace3d.org/celtutorial.zip
Here are the five source files of this tutorial:
4.2.1 main.cpp | ||
4.2.2 app.h | ||
4.2.3 app.cpp | ||
4.2.4 behave.h | ||
4.2.5 behave.cpp |
Except for the level and player entities all other entities are defined in the `entities' file. Here is an example of how such an entity looks:
<addon plugin="celentity" entityname="badone"> <propclass name="pcmesh"> <action name="LoadMeshPath"> <par name="path" string="/this/model" /> <par name="filename" string="monkey" /> <par name="factoryname" string="monkey" /> </action> </propclass> <propclass name="pcmeshselect" /> <propclass name="pcproperties"> <property name="pos1" vector="9,2,8" /> <property name="pos2" vector="6,2,8" /> <property name="pos3" vector="6,2,12" /> <property name="pos4" vector="7,5,10" /> <property name="pos5" vector="8,1,7" /> <property name="pos6" vector="9,2,8" /> <property name="up1" vector="0,1,0" /> <property name="up2" vector="0,1,0" /> <property name="up3" vector="0,1,0" /> <property name="up4" vector="0,1,0" /> <property name="up5" vector="0,1,0" /> <property name="up6" vector="0,1,0" /> <property name="forward1" vector="-1,0,0" /> <property name="forward2" vector="0,0,1" /> <property name="forward3" vector="1,1,-1" /> <property name="forward4" vector="1,-1,-1" /> <property name="forward5" vector="1,1,1" /> <property name="forward6" vector="-1,0,0" /> <property name="time1" long="1000" /> <property name="time2" long="1000" /> <property name="time3" long="1000" /> <property name="time4" long="1000" /> <property name="time5" long="1000" /> <property name="time6" long="1000" /> </propclass> <propclass name="pctimer"> <action name="WakeUp"> <par name="time" long="5000" /> <par name="repeat" bool="true" /> </action> </propclass> <propclass name="pclinearmovement"> <action name="InitCD"> <par name="body" vector=".2,.2,.2" /> <par name="legs" vector=".2,.2,.2" /> <par name="offset" vector="0,-.3,0" /> </action> <action name="SetPosition"> <par name="position" vector="9,3,8" /> <par name="sector" string="Scene" /> <par name="yrot" float="0" /> </action> </propclass> <behaviour name="badone_behave" /> </addon> |
In this particular example we use the `cel.addons.celentity' addon (see section CelEntity Addon) to create an entity with the name `badone'. It has the following property classes:
We also create the entity with the `badone_behave' behaviour.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated using texi2html 1.76.