diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2010-10-11 14:47:20 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2010-10-11 14:47:20 +0400 |
commit | 4814ffa07bbc8b55c60e540e7db70a18b2f3e992 (patch) | |
tree | ac8896389acc6c7ee85045f16f858ed04edd5f4a /source/gameengine/Ketsji/KX_Scene.cpp | |
parent | e444c777145ccf297bc00f8e4690b78ed4ea85c9 (diff) |
BGE object.life - gives you the life countdown for temporary objects.
Whenever using AddObject actuator, this feature gives you control over morbid events (a.k.a. trigger events before the object ends).
Demo file here:
http://blenderecia.orgfree.com/blender/tmp/cube_life.blend
Feature implemented as part of the BGE development workshop in BlenderPRO 2010 - Fortaleza, Brazil
Diffstat (limited to 'source/gameengine/Ketsji/KX_Scene.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index a30591d8da1..3d7fcb25f2b 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -812,6 +812,8 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject, // add a timebomb to this object // for now, convert between so called frames and realtime m_tempObjectList->Add(replica->AddRef()); + // this convert the life from frames to sort-of seconds, hard coded 0.02 that assumes we have 50 frames per second + // if you change this value, make sure you change it in KX_GameObject::pyattr_get_life property too CValue *fval = new CFloatValue(lifespan*0.02); replica->SetProperty("::timebomb",fval); fval->Release(); |