LuaLibraryAnimate.wiki
changeset 2246 9cee5aab336d
parent 2245 3e97c75aaddc
child 2247 fdd314eb697f
equal deleted inserted replaced
2245:3e97c75aaddc 2246:9cee5aab336d
    84 
    84 
    85 ==== `AnimInsertStepNext(step)` ====
    85 ==== `AnimInsertStepNext(step)` ====
    86 Inserts `step` after the current step (read: action) in the cinematic array. Useful when an action depends on variables (e.g. positions). It can be used mostly with `AnimCustomFunction`. Note: In case of multiple consecutive calls, steps need to be added in reverse order.
    86 Inserts `step` after the current step (read: action) in the cinematic array. Useful when an action depends on variables (e.g. positions). It can be used mostly with `AnimCustomFunction`. Note: In case of multiple consecutive calls, steps need to be added in reverse order.
    87 
    87 
    88 Example:
    88 Example:
    89 <code language="lua">function BlowHog(deadHog)
    89 <code language="lua">-- Show explosion effects around hedgehog `liveHog`, then delete it
    90   AnimInsertStepNext({func = DeleteGear, args = {deadHog}, swh = false})
    90 function BlowHog(deadHog)
    91   AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog), GetY(deadHog), vgtBigExplosion, 0, true}, swh = false})
    91     AnimInsertStepNext({func = DeleteGear, args = {deadHog}, swh = false})
    92   AnimInsertStepNext({func = AnimWait, args = {deadHog, 1200}})
    92     AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog), GetY(deadHog), vgtBigExplosion, 0, true}, swh = false})
    93   AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) + 20, GetY(deadHog), vgtExplosion, 0, true}, swh = false})
    93     AnimInsertStepNext({func = AnimWait, args = {deadHog, 1200}})
    94   AnimInsertStepNext({func = AnimWait, args = {deadHog, 100}})
    94     AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) + 20, GetY(deadHog), vgtExplosion, 0, true}, swh = false})
    95   AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) + 10, GetY(deadHog), vgtExplosion, 0, true}, swh = false})
    95     AnimInsertStepNext({func = AnimWait, args = {deadHog, 100}})
    96   AnimInsertStepNext({func = AnimWait, args = {deadHog, 100}})
    96     AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) + 10, GetY(deadHog), vgtExplosion, 0, true}, swh = false})
    97   AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) - 10, GetY(deadHog), vgtExplosion, 0, true}, swh = false})
    97     AnimInsertStepNext({func = AnimWait, args = {deadHog, 100}})
    98   AnimInsertStepNext({func = AnimWait, args = {deadHog, 100}})
    98     AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) - 10, GetY(deadHog), vgtExplosion, 0, true}, swh = false})
    99   AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) - 20, GetY(deadHog), vgtExplosion, 0, true}, swh = false})
    99     AnimInsertStepNext({func = AnimWait, args = {deadHog, 100}})
   100 end
   100     AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) - 20, GetY(deadHog), vgtExplosion, 0, true}, swh = false})
   101 cinem = {{func = AnimCustomFunction, args = {liveHog, BlowHog, {deadHog}}}}</code>
   101 end
       
   102 cinem = {{func = AnimCustomFunction, args = {liveHog, BlowHog, {deadHog}}}}
       
   103 AddAnim(cinem)</code>
   102 
   104 
   103 ==== `ShowAnimation()` ====
   105 ==== `ShowAnimation()` ====
   104 Performs the current action in the cinematic and returns `true` if finished, otherwise `false`. It needs to be used in `onGameTick`. Cut-scenes need to be added with `AddAnim(steps)`.
   106 Performs the current action in the cinematic and returns `true` if finished, otherwise `false`. It needs to be used in `onGameTick`. Cut-scenes need to be added with `AddAnim(steps)`.
   105 
   107 
   106 ==== `Animate(steps)` ====
   108 ==== `Animate(steps)` ====