This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:tutorials:objects:lifetime [2019/05/29 06:25 (3 years ago)] sausage [Track Lifetime] |
en:tutorials:objects:lifetime [2020/08/31 18:18 (22 months ago)] (current) 66.249.64.26 ↷ Links adapted because of a move operation |
||
---|---|---|---|
Line 5: | Line 5: | ||
But you can also specify one or more literals to create lifetime situations that are a little richer. | But you can also specify one or more literals to create lifetime situations that are a little richer. | ||
- | Before getting into that, let's [[en:tutorials:creating_your_own_project|create a blank project using the init script]]. | + | Before getting into that, let's [[en:tutorials:projects:creating_your_own_project|create a blank project using the init script]]. |
===== Numeric Lifetime ===== | ===== Numeric Lifetime ===== | ||
Line 73: | Line 73: | ||
Run that and as soon as the appearance sound is finished, the object's life is over. | Run that and as soon as the appearance sound is finished, the object's life is over. | ||
+ | |||
+ | |||
+ | ===== Anim Lifetime ===== | ||
+ | |||
+ | For an object, using the ''anim'' literal means that when all animations have finished playing on your object, then the object will be destroyed. | ||
+ | |||
+ | <code ini> | ||
+ | [Object] | ||
+ | Graphic = @ | ||
+ | Texture = logo.png | ||
+ | SoundList = @ | ||
+ | Sound = appear.ogg | ||
+ | Pivot = center | ||
+ | AngularVelocity = 18 | ||
+ | FXList = FadeIn # ColorCycle | ||
+ | LifeTime = anim | ||
+ | </code> | ||
+ | |||
+ | Check out the [[en:tutorials:main#animation|animation tutorials]] to learn about the animation system and give the ''anim'' literal a try. | ||
===== Child Lifetime ===== | ===== Child Lifetime ===== | ||
Line 113: | Line 132: | ||
- | ===== Track Lifetime (in development) ===== | + | ===== Track Lifetime ===== |
Using this literal, the object's life will end when the attached track has finished it's job. | Using this literal, the object's life will end when the attached track has finished it's job. | ||
Line 132: | Line 151: | ||
===== Multiple Lifetime literals ===== | ===== Multiple Lifetime literals ===== | ||
- | You can combine two or more literals, or a value if you wish. If you do this, the object's lifetime will not end until all of the conditions are exhausted. For example: | + | You can combine two or more literals. If you do this, the object's lifetime will not end until all of the conditions are exhausted. For example: |
<code ini> | <code ini> | ||
Line 143: | Line 162: | ||
AngularVelocity = 18 | AngularVelocity = 18 | ||
FXList = FadeIn # ColorCycle | FXList = FadeIn # ColorCycle | ||
- | LifeTime = 15 # fx | + | LifeTime = sound fx |
</code> | </code> | ||
- | In this case, the fx will complete it's single cycle, and then the object will continue to live for a total of 15 seconds. Once both conditions are complete, it's curtains for the object. | + | In this case, the sound will play and the fx will complete it's single cycle. Once both conditions are complete, it's curtains for the object. |
==== Conclusion ==== | ==== Conclusion ==== | ||
- | There's a lot of combinations and scenarios that be covered with multiple lifetimes. I can see sound, fx and track being extremely useful. You can get more info on usage at: [[en:orx:config:settings_structure:orxobject|orxOBJECT structure]] | + | There's a lot of combinations and scenarios that be covered with multiple lifetimes. I can see sound, fx and track being extremely useful. |
+ | ===== See also ===== | ||
+ | - [[en:examples:objects:kill_parent_object_when_children_die|Having a Parent Object die after all children have died]] | ||
+ | - [[en:orx:config:settings_structure:orxobject|orxOBJECT structure]] |