Crystal Space
Welcome, Guest. Please login or register.
December 22, 2014, 09:10:37 pm

Login with username, password and session length
Search:     Advanced search
9032 Posts in 2046 Topics by 9305 Members
Latest Member: Fabiorzad
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  some questiones about cel tutorial
« previous next »
Pages: [1] Print
Author Topic: some questiones about cel tutorial  (Read 1706 times)
Jr. Member
**
Posts: 81


View Profile Email
« on: March 06, 2009, 10:46:30 am »

   I am new in CEL.
   When I run cel-tutorial, I found that the entity's behaviour( like player_behave) and entity's properties( like player's properties) seemed independently to each other, I don't understand how did they communicate to each other.
   And if I want to use some user-defined type message to drive the actor's behaviour, what can I do?   
       
Logged
Vincent
Full Member
***
Posts: 191


View Profile WWW
« Reply #1 on: May 19, 2009, 06:47:57 pm »

I'll try to answer, from what I understand in the question... I guess you're talking about walktut ?
Anyway...
In the application (app.cpp) you can see that when an entity is created in CreatePlayer(),
a behaviour is set for it (player_behave) and a set of property classes are attached to the entity.
In the behaviour code (behaviour.cpp), it is said that when 'player_behave' named behaviour is requested,
the BehaviourPlayer class should be used.
Now, this class will receive messages (that is, its SendMessage() member will be called)
depending on the property classes the entity has.
For example, the entity was attached 'pctools.inventory' propclass, so its behaviour will receive all
messages that this propclass sends, namely pcinventory_addchild and pcinventory_removechild upon
addition and removal of inventory elements (other entities).
Each time a propclass sends a message to the player's entity behaviour, BehaviourPlayer::SendMessage()
is called, with a "message ID" (so one can distinguish what message was sent), and possibly a parameter
block, which in case of an inventory message holds the entity which was added or removed.

I hope this clears things up a bit.
Also note that this is with the "old" messaging system, with the newer one one can just subscribe to message,
there's no separate class for behaviour, if I understood it well wink
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 3.37 seconds with 14 queries.