# HG changeset patch # User Wuzzy # Date 1687354394 0 # Node ID 9cee5aab336dd99766c044b9dcbe0739e6a1442c # Parent 3e97c75aaddcf9789a7b788727c92f949666c3f7 LuaLibraryAnimate: Explain BlowHog example better diff -r 3e97c75aaddc -r 9cee5aab336d LuaLibraryAnimate.wiki --- a/LuaLibraryAnimate.wiki Wed Jun 21 13:10:24 2023 +0000 +++ b/LuaLibraryAnimate.wiki Wed Jun 21 13:33:14 2023 +0000 @@ -86,19 +86,21 @@ 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. Example: -function BlowHog(deadHog) - AnimInsertStepNext({func = DeleteGear, args = {deadHog}, swh = false}) - AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog), GetY(deadHog), vgtBigExplosion, 0, true}, swh = false}) - AnimInsertStepNext({func = AnimWait, args = {deadHog, 1200}}) - AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) + 20, GetY(deadHog), vgtExplosion, 0, true}, swh = false}) - AnimInsertStepNext({func = AnimWait, args = {deadHog, 100}}) - AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) + 10, GetY(deadHog), vgtExplosion, 0, true}, swh = false}) - AnimInsertStepNext({func = AnimWait, args = {deadHog, 100}}) - AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) - 10, GetY(deadHog), vgtExplosion, 0, true}, swh = false}) - AnimInsertStepNext({func = AnimWait, args = {deadHog, 100}}) - AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) - 20, GetY(deadHog), vgtExplosion, 0, true}, swh = false}) +-- Show explosion effects around hedgehog `liveHog`, then delete it +function BlowHog(deadHog) + AnimInsertStepNext({func = DeleteGear, args = {deadHog}, swh = false}) + AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog), GetY(deadHog), vgtBigExplosion, 0, true}, swh = false}) + AnimInsertStepNext({func = AnimWait, args = {deadHog, 1200}}) + AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) + 20, GetY(deadHog), vgtExplosion, 0, true}, swh = false}) + AnimInsertStepNext({func = AnimWait, args = {deadHog, 100}}) + AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) + 10, GetY(deadHog), vgtExplosion, 0, true}, swh = false}) + AnimInsertStepNext({func = AnimWait, args = {deadHog, 100}}) + AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) - 10, GetY(deadHog), vgtExplosion, 0, true}, swh = false}) + AnimInsertStepNext({func = AnimWait, args = {deadHog, 100}}) + AnimInsertStepNext({func = AnimVisualGear, args = {deadHog, GetX(deadHog) - 20, GetY(deadHog), vgtExplosion, 0, true}, swh = false}) end -cinem = {{func = AnimCustomFunction, args = {liveHog, BlowHog, {deadHog}}}} +cinem = {{func = AnimCustomFunction, args = {liveHog, BlowHog, {deadHog}}}} +AddAnim(cinem) ==== `ShowAnimation()` ==== 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)`.