| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This is a tutorial to show how you can use Crystal Entity Layer in your own applications.
The source files of this tutorial can be found in the ‘apps/tutorial/walktut’ directory that is included with CEL. The world and entity file can be found in the ‘data’ directory (‘walktut_world’ and ‘walktut_entities’).
Remember that the first time you run this application you have to add the ‘-relight’ commandline option so that the lightmaps are correctly updated.
During the game you can use the following inputs:
This tutorial features:
Here is the tutorial:
| 4.2.1.1 main.cpp | ||
| 4.2.1.2 app.h | ||
| 4.2.1.3 app.cpp | ||
| 4.2.1.4 behave.h | ||
| 4.2.1.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="pcobject.mesh">
<action name="LoadMeshPath">
<par name="path" string="/this/model" />
<par name="filename" string="monkey" />
<par name="factoryname" string="monkey" />
</action>
</propclass>
<propclass name="pcobject.mesh.select" />
<propclass name="pctools.properties">
<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="pctools.timer">
<action name="WakeUp">
<par name="time" long="5000" />
<par name="repeat" bool="true" />
</action>
</propclass>
<propclass name="pcmove.linear">
<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 ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated using texi2html 1.76.