User Tools

Site Tools


proton_entity_part2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
proton_entity_part2 [2010/10/27 14:22] sethproton_entity_part2 [2010/10/27 14:29] seth
Line 2: Line 2:
 What is the most useful component, one that we've already used several times at once on each entity in the last tutorial? What is the most useful component, one that we've already used several times at once on each entity in the last tutorial?
  
-The answer may surprise you.+The answer may surprise you... we'll use an extremely simple example to contrast the "old way" with the "new way".
  
 Traditionally in an entity system, you may have said I want to be able to fade out my entity by doing a simple **Entity::FadeOut(int fadeTimeMS);** Or possibly a more fancy **Entity::FadeOut(int fadeTimeMS, int delayBeforeStartingFadeMS);** Traditionally in an entity system, you may have said I want to be able to fade out my entity by doing a simple **Entity::FadeOut(int fadeTimeMS);** Or possibly a more fancy **Entity::FadeOut(int fadeTimeMS, int delayBeforeStartingFadeMS);**
Line 65: Line 65:
 </code> </code>
  
-Yeah, it's almost so simple we don't even need the FadeOutEntity() wrapper at all.+Yeah, it's almost so simple we don't even need the **FadeOutEntity()** wrapper at all.
  
 ====Getting fancy: eInterpolateType and scheduling==== ====Getting fancy: eInterpolateType and scheduling====
Line 75: Line 75:
  
 Interpolate type is an optional setting that allows you to control how the interpolation works.  The enum gives you these options: Interpolate type is an optional setting that allows you to control how the interpolation works.  The enum gives you these options:
-<code>+<code cpp>
 enum eInterpolateType enum eInterpolateType
 { {
Line 88: Line 88:
 </code> </code>
 If you are an animator you'll shrug and know what most of these mean already.  If not, go visit [[http://sol.gfxile.net/interpolation/index.html|Sol_HSA's excellent page about interpolation here]]. If you are an animator you'll shrug and know what most of these mean already.  If not, go visit [[http://sol.gfxile.net/interpolation/index.html|Sol_HSA's excellent page about interpolation here]].
 +**
 +INTERPOLATE_SMOOTHSTEP** is the one you'll use the most, it's just so.. smooooooth.
  
-INTERPOLATE_SMOOTHSTEP is the one you'll use the most, it's just so.. smooooooth. +The last two tell the engine that the **uint32** should be treated as a color.  (it will break it up into four bytes and interpolate all four separately)
- +
-The last two tell the engine that the uint32 should be treated as a color.  (it will break it up into four bytes and interpolate all four separately)+
  
-The delayBeforeActionMS parm is self explanatory, it's useful to schedule things to happen in advance at specific times.  So you can play a sound effect, fade out, and then kill the entity step by step instead of all at once.+The **delayBeforeActionMS** parm is self explanatory, it's useful to schedule things to happen in advance at specific times.  So you can play a sound effect, fade out, and then kill the entity step by step instead of all at once.
  
-So, finally, let's take a look at the actual FadeEntity() function in EntityUtils.cpp:+So, finally, let's take a look at the actual **FadeEntity()** function in **EntityUtils.cpp**:
  
 <code cpp> <code cpp>
proton_entity_part2.txt · Last modified: 2012/02/07 09:45 by aki