TILT- A Platformer


@Stage\n\nwhen I receive [__render level v]\nif <(_GAME LEVEL) < [51]> then\n    if <(_GAME LEVEL) < [41]> then\n        switch backdrop to (grid gradient v)\n    else\n        switch backdrop to (red backdrop v)\n    end\n    set [color v] effect to (_COLOUR - GLOBAL)\nelse\n    clear graphic effects\n    switch backdrop to (nor v)\nend\n\nwhen I receive [__main menu v]\nswitch backdrop to (menu backdrop v)\n\nwhen I receive [@menu buttons tick v]\nset [color v] effect to (_COLOUR - GLOBAL)\n\n@Thumbnail\n\nwhen flag clicked\nset size to (101) %\nhide\nforever\n    set [time track v] to (timer)\nend\n\nwhen [timer v] > ((time track) + (0.2))\ngo to x: (0) y: (0)\nswitch costume to (thumbnail v3 v)\ngo to [front v] layer\nshow\n\nwhen I receive [___game complete v]\nhide\nwait (3) seconds\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nswitch costume to (thumbnail v3 v)\ngo to [front v] layer\nshow\nrepeat (200)\n    change [ghost v] effect by (-0.5)\nend\n\n@Player\n\ndefine Change Y by (y)\nchange [_player y v] by (y)\nGet IsSolid\nrepeat ([ceiling v] of ([abs v] of (y) ) )\n    if <(is solid) = [0]> then\n        stop [this script v]\n    end\n    change [_player y v] by ((0) - ((y) / ([abs v] of (y) )))\n    if <((y) * (_GRAVITY)) > [0]> then\n        set [jumping v] to [9999]\n    else\n        if <(falling) > [2]> then\n            if <<(_GRAVITY) > [0]> and <(_PLAYER YV) < [-4]>> then\n                start sound [Land v]\n            else\n                if <(_PLAYER YV) > [4]> then\n                    start sound [Land v]\n                end\n            end\n        end\n        set [jumping v] to [0]\n        set [falling v] to [0]\n    end\n    Get IsSolid\n    set [_player yv v] to [0]\nend\n\ndefine Position\ngo to x: (((round (_PLAYER X)) - ((_LEVEL X) * (480))) + (round (_LEVEL SHAKE X))) y: (((round (_PLAYER Y)) - ((_LEVEL Y) * (360))) + (round (_LEVEL SHAKE Y)))\n\ndefine Get IsSolid\nPosition\nif <<<touching (level v)?> or <touching (mob v)?>> or <touching (door v)?>> then\n    set [is solid v] to [1]\nelse\n    set [is solid v] to [0]\nend\n\ndefine Change X by (x)\nchange [_player x v] by (x)\nrepeat ([ceiling v] of ((7) * (_SIZE)) )\n    Get IsSolid\n    if <(is solid) = [1]> then\n        change [_player y v] by ((1) * (_GRAVITY))\n    else\n        stop [this script v]\n    end\nend\nchange [_player y v] by (((0) - ([ceiling v] of ((7) * (_SIZE)) )) * (_GRAVITY))\nrepeat ([ceiling v] of ([abs v] of (x) ) )\n    if <(is solid) = [0]> then\n        stop [this script v]\n    end\n    set [_player xv v] to [0]\n    change [_player x v] by ((0) - ((x) / ([abs v] of (x) )))\n    Get IsSolid\nend\n\ndefine Animate\nif <<(falling) > [2]> or <(jumping) > [0]>> then\n    if <((_PLAYER YV) * (_GRAVITY)) > [0]> then\n        set [costume v] to [3]\n    else\n        set [costume v] to [4]\n    end\nelse\n    if <([abs v] of (_PLAYER XV) ) > [0.1]> then\n        set [costume v] to (([floor v] of (((timer) * (12)) mod (4)) ) + (5))\n    else\n        set [costume v] to (([floor v] of (((timer) * (5)) mod (2)) ) + (1))\n    end\nend\nif <(_GRAVITY) = [1]> then\n    switch costume to (costume)\nelse\n    switch costume to ((costume) + (8))\nend\n\ndefine Spawn\nclear graphic effects\nset [_player yv v] to [0]\nset [_player xv v] to [0]\nset [_player x v] to (_PLAYER SPAWN X)\nset [_player y v] to (_PLAYER SPAWN Y)\nset [_death v] to [0]\nset [_gravity v] to [1]\nset rotation style [left-right v]\nif <(_PLAYER X) > [0]> then\n    point in direction (-90)\nelse\n    point in direction (90)\nend\nset size to ((101) * (_SIZE)) %\nset [_level x v] to [0]\nset [_level y v] to [0]\nset [_level shake v] to [0]\nset [_level shake y v] to [0]\nset [_level shake x v] to [0]\nset [_moving platform xv v] to [0]\nset [_moving platform yv v] to [0]\nset [_keys collected v] to [0]\nset [_keys total v] to [0]\nset [_game mode v] to [1]\nset [_timer v] to [0]\nbroadcast (_RESET LEVEL MOBS v) and wait\nbroadcast (_DOOR v)\nerase all\nbroadcast (__MUSIC UPDATE v)\nbroadcast (__RENDER LEVEL v)\nbroadcast (_FIND SPAWN POSITION v)\n\nwhen I receive [player tick v]\nif <(_DEATH) = [0]> then\n    switch costume to (hitbox v)\n    show\n    Get IsSolid\n    if <(is solid) > [0]> then\n        change [_player x v] by (_MOVING PLATFORM XV)\n        change [_player y v] by (_MOVING PLATFORM YV)\n        Get IsSolid\n        if <(is solid) > [0]> then\n            Find Available Space | X: (_PLAYER X) Y: (_PLAYER Y) Max Distance: ([ceiling v] of ((12) * (_SIZE)) )\n            if <(is solid) > [0]> then\n                set [_death v] to [1]\n            end\n        end\n    else\n        Change X by (_MOVING PLATFORM XV)\n        Change Y by (_MOVING PLATFORM YV)\n    end\n    set [_moving platform xv v] to [0]\n    set [_moving platform yv v] to [0]\n    if <(_GAME MODE) = [1]> then\n        Timer Tick\n        if <[_controls v] contains [Right]?> then\n            point in direction (90)\n            change [_player xv v] by (1.8)\n        else\n            if <[_controls v] contains [Left]?> then\n                point in direction (-90)\n                change [_player xv v] by (-1.8)\n            end\n        end\n        if <([abs v] of (_PLAYER XV) ) > [0.4]> then\n            Change X by ((_PLAYER XV) * (_SIZE))\n        else\n            set [_player xv v] to [0]\n        end\n        if <<<(_GRAVITY) = [1]> and <[_controls v] contains [Up]?>> or <<(_GRAVITY) = [-1]> and <[_controls v] contains [Down]?>>> then\n            if <<(falling) < [4]> or <(jumping) > [0]>> then\n                if <(jumping) < [8]> then\n                    if <(jumping) = [0]> then\n                        start sound [Jump v]\n                    end\n                    change [jumping v] by (1)\n                    if <([abs v] of (_PLAYER YV) ) < [7.5]> then\n                        set [_player yv v] to ((7.5) * (_GRAVITY))\n                        if <([floor v] of ((jumping) / (2)) ) = ((jumping) / (2))> then\n                    end\n                end\n            end\n        else\n            set [jumping v] to [0]\n        end\n    end\n    set [_player xv v] to ((_PLAYER XV) * (0.75))\n    change [falling v] by (1)\n    Change Y by ((_PLAYER YV) * (_SIZE))\n    change [_player yv v] by ((-1) * (_GRAVITY))\n    if <(_PLAYER YV) < [-24]> then\n        set [_player yv v] to [-24]\n    else\n        if <(_PLAYER YV) > [24]> then\n            set [_player yv v] to [24]\n        end\n    end\n    switch costume to (large v)\n    Position\n    switch costume to (danger hitbox v)\n    if <<touching (spikes v)?> or <touching (moving spikes v)?>> then\n        set [_death v] to [1]\n    end\n    switch costume to (hitbox v)\nend\n\ndefine // (comment)\n\nwhen I receive [player editor tick v]\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    change [_player x v] by (12)\nelse\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [_player x v] by (-12)\n    end\nend\nif <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n    change [_player y v] by (12)\nelse\n    if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n        change [_player y v] by (-12)\n    end\nend\nPosition\nAnimate\n\ndefine Find Available Space | X: (x) Y: (y) Max Distance: (max dist)\nset [distance v] to [1]\nrepeat (max dist)\n    if <(_GRAVITY) > [0]> then\n        set [direction v] to [0]\n    else\n        set [direction v] to [-180]\n    end\n    repeat (16)\n        set [_player x v] to ((x) + (([sin v] of (direction) ) * (distance)))\n        set [_player y v] to ((y) + (([cos v] of (direction) ) * (distance)))\n        Get IsSolid\n        if <(is solid) > [0]> then\n            change [direction v] by (22.5)\n        else\n            stop [this script v]\n        end\n    end\n    change [distance v] by (1)\nend\n\nwhen I receive [__game start v]\nset [__is mobile? v] to [1]\nset [_editor v] to [0]\nset [_level shake v] to [0]\nset [_light v] to [100]\nif <(_GAME LEVEL) = [1]> then\n    set [done intro v] to [0]\nelse\n    set [done intro v] to [1]\nend\nset [__speedrun timer v] to [0]\nset [__speedrun time display v] to [0'00]\nforever\n    broadcast (_DELETE TEXT v) and wait\n    broadcast (_DELETE PARTICLES v) and wait\n    broadcast (_DELETE MOBS v) and wait\n    broadcast (_LOAD LEVEL v) and wait\n    delete all of [_controls v]\n    delete all of [_particle spawns v]\n    Spawn\n    go to [front v] layer\n    if <(_EXIT) = [1]> then\n        broadcast (_FADE IN v)\n    end\n    if <(done intro) = [0]> then\n        Intro\n        set [done intro v] to [1]\n    end\n    set [_exit v] to [0]\n    repeat until <(_EXIT) > [0]>\n        if <<key (e v) pressed?> and > then\n            Toggle Editor\n            wait until <not <key (e v) pressed?>>\n        end\n        Switch Levels\n        if <(_DEATH) = [1]> then\n            // [Death]\n            broadcast (_DELETE TEXT v) and wait\n            set [_game mode v] to [1]\n            start sound [Hit v]\n            hide\n            Particle Dot Shower [20]\n            Particle | X: (_PLAYER X) Y: (_PLAYER Y) Id: [4]\n            set [_level shake v] to [5]\n            repeat (20)\n                Game Tick\n            end\n            Spawn\n            Game Tick\n        end\n        if <(_EDITOR) > [0]> then\n            // [Editor Tick]\n            if <(_GAME MODE) > [0]> then\n                broadcast (First Tick v)\n                broadcast (Player Editor Tick v)\n                broadcast (Moving Spikes Tick v)\n                broadcast (Mob Tick v)\n                broadcast (Background Particles Tick v)\n                broadcast (Light Tick v)\n                broadcast (Particle Tick v)\n                broadcast (Animate v)\n            end\n        else\n            // [Normal Game Tick]\n            Game Tick\n        end\n    end\n    // [Level Complete]\n    change [_game level v] by (1)\n    broadcast (_FADE OUT v)\n    if <(_GAME LEVEL) > [50]> then\n        if <(_GAME LEVEL) = [51]> then\n            // [Entry to the Kingdom of Nor]\n            set [_music v] to [6]\n            start sound [Connect v]\n            broadcast (__MUSIC UPDATE v)\n            wait (3) seconds\n        else\n            // [Game Complete]\n            repeat (15)\n            set [speech # v] to [1]\n            broadcast (_DELETE TEXT v) and wait\n            broadcast (_DELETE PARTICLES v) and wait\n            broadcast (_DELETE MOBS v) and wait\n            broadcast (_LOAD LEVEL v) and wait\n            delete all of [_controls v]\n            delete all of [_particle spawns v]\n            hide\n            broadcast (_FADE IN v)\n            repeat (length of [conclusion text v])\n                set [_outro frame v] to (speech #)\n                broadcast (_FADE IN v)\n                repeat until <not <<key (z v) pressed?> or <mouse down?>>>\n                    broadcast (Text Animate v)\n                    broadcast (_CONCLUSION v)\n                end\n                repeat (15)\n                    broadcast (Text Animate v)\n                    broadcast (_CONCLUSION v)\n                end\n                add (item (speech #) of [conclusion text v]) to [_text to write v]\n                repeat until <<key (z v) pressed?> or <mouse down?>>\n                    broadcast (Text Animate v)\n                    broadcast (_CONCLUSION v)\n                end\n                add [] to [_text to write v]\n                change [speech # v] by (1)\n                wait (0) seconds\n                repeat (15)\n                    broadcast (Text Animate v)\n                    broadcast (_CONCLUSION v)\n                end\n                broadcast (_FADE OUT v) and wait\n            end\n            broadcast (___GAME COMPLETE v)\n            stop [this script v]\n        end\n    else\n        start sound [Connect v]\n        repeat (15)\n            Timer Tick\n        end\n    end\nend\n\nwhen flag clicked\nerase all\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [first tick v]\nif <(__IS MOBILE?) > [0]> then\n    if <key (any v) pressed?> then\n        set [__is mobile? v] to [0]\n    end\nend\nchange [_timer v] by (0.033)\nswitch costume to (large v)\nPosition\nswitch costume to (hitbox v)\n\ndefine Particle | X: (x) Y: (y) Id: (id)\nadd (x) to [_particle spawns v]\nadd (y) to [_particle spawns v]\nadd (id) to [_particle spawns v]\n\ndefine Particle Dot Shower (size)\nrepeat (size)\n    Particle | X: (_PLAYER X) Y: (_PLAYER Y) Id: [1]\nend\n\ndefine Switch Levels\nif <((_PLAYER X) - ((_LEVEL X) * (480))) > [240]> then\n    change [_level x v] by (1)\n    broadcast (_DELETE PARTICLES v) and wait\n    erase all\n    broadcast (__RENDER LEVEL v)\nelse\n    if <((_PLAYER X) - ((_LEVEL X) * (480))) < [-240]> then\n        change [_level x v] by (-1)\n        broadcast (_DELETE PARTICLES v) and wait\n        erase all\n        broadcast (__RENDER LEVEL v)\n    end\nend\nif <((_PLAYER Y) - ((_LEVEL Y) * (360))) > [180]> then\n    change [_level y v] by (1)\n    broadcast (_DELETE PARTICLES v) and wait\n    erase all\n    broadcast (__RENDER LEVEL v)\nelse\n    if <((_PLAYER Y) - ((_LEVEL Y) * (360))) < [-180]> then\n        change [_level y v] by (-1)\n        broadcast (_DELETE PARTICLES v) and wait\n        erase all\n        broadcast (__RENDER LEVEL v)\n    end\nend\n\nwhen I receive [shake level v]\nset [_level shake x v] to (round (pick random (_LEVEL SHAKE) to ((0) - (_LEVEL SHAKE))))\nset [_level shake y v] to (round (pick random (_LEVEL SHAKE) to ((0) - (_LEVEL SHAKE))))\n\ndefine Intro\nset [_game mode v] to [2]\nset [speech # v] to [1]\nset [speech v] to [The last thing Mello could remember was a blinding light appearing in the sky.]\nadd (speech) to [_text to write v]\nrepeat until <(speech) = []>\n    if <<<key (z v) pressed?> or <mouse down?>> and <(z pressed) = [0]>> then\n        change [speech # v] by (1)\n        if <(speech #) = [2]> then\n            set [speech v] to [Now, Mello has woken up in an unusual, but somewhat familiar place.]\n        else\n            if <(speech #) = [3]> then\n                set [speech v] to [But it seems different this time.]\n            else\n                if <(speech #) = [4]> then\n                    set [speech v] to [This time, it won't let Mello escape.]\n                else\n                    if <(speech #) = [5]> then\n                        set [speech v] to []\n                    end\n                end\n            end\n        end\n        if <(speech) > []> then\n            add (speech) to [_text to write v]\n        end\n    end\n    if <key (x v) pressed?> then\n        delete all of [_text to write v]\n        add [] to [_text to write v]\n        set [_game mode v] to [1]\n        stop [this script v]\n    end\n    if <<key (z v) pressed?> or <mouse down?>> then\n        set [z pressed v] to [1]\n    else\n        set [z pressed v] to [0]\n    end\n    Game Tick\nend\ndelete all of [_text to write v]\nadd [] to [_text to write v]\nset [_game mode v] to [1]\n\ndefine Tick - Player Can't Move\nbroadcast (First Tick v)\nbroadcast (Shake Level v)\nbroadcast (Position Level v)\nbroadcast (Moving Platform Tick v)\nbroadcast (Moving Spikes Tick v)\nbroadcast (Mob Tick v)\nbroadcast (Background Particles Tick v)\nbroadcast (Light Tick v)\nbroadcast (Particle Tick v)\nbroadcast (Text Animate v)\nbroadcast (Animate v)\n\ndefine Toggle Editor\nerase all\nset [_game mode v] to [1]\nbroadcast (_DELETE PARTICLES v) and wait\nif <(_EDITOR) = [0]> then\n    broadcast (_DELETE MOBS v) and wait\n    broadcast (_LOAD LEVEL v) and wait\n    set [_editor v] to [1]\nelse\n    broadcast (_SAVE MOB LEVEL v) and wait\n    set [_editor v] to [0]\n    broadcast (_DELETE MOBS v) and wait\n    broadcast (_LOAD LEVEL v) and wait\n    set [_keys collected v] to [0]\n    set [_keys total v] to [0]\n    broadcast (_RESET LEVEL MOBS v) and wait\n    broadcast (__MUSIC UPDATE v)\n    if <(_KEYS TOTAL) > [0]> then\n        broadcast (_DOOR v)\n    end\nend\nset size to ((101) * (_SIZE)) %\nset [_level shake x v] to [0]\nset [_level shake y v] to [0]\nbroadcast (__RENDER LEVEL v) and wait\n\nwhen I receive [animate v]\nswitch costume to (large v)\nPosition\nAnimate\n\ndefine Game Tick\nif <(_GAME MODE) > [0]> then\n    if <(round (_LEVEL SHAKE)) > [0]> then\n        broadcast (Shake Level v)\n        broadcast (Position Level v)\n        broadcast (First Tick v)\n        broadcast (Moving Platform Tick v)\n        broadcast (Moving Spikes Tick v)\n        broadcast (Control Tick v)\n        broadcast (Player Tick v)\n        broadcast (Mob Tick v)\n        broadcast (Background Particles Tick v)\n        broadcast (Light Tick v)\n        broadcast (Particle Tick v)\n        broadcast (Animate v)\n        broadcast (Text Animate v)\n        erase all\n        set [_level shake v] to ((_LEVEL SHAKE) * (0.88))\n        broadcast (__RENDER LEVEL v) and wait\n    else\n        broadcast (First Tick v)\n        broadcast (Moving Platform Tick v)\n        broadcast (Moving Spikes Tick v)\n        broadcast (Control Tick v)\n        broadcast (Player Tick v)\n        broadcast (Mob Tick v)\n        broadcast (Background Particles Tick v)\n        broadcast (Light Tick v)\n        broadcast (Particle Tick v)\n        broadcast (Animate v)\n        broadcast (Text Animate v)\n        if <(_LEVEL SHAKE) > [0]> then\n            set [_level shake v] to [0]\n            set [_level shake x v] to [0]\n            set [_level shake y v] to [0]\n            erase all\n            broadcast (__RENDER LEVEL v) and wait\n        end\n    end\nend\n\nwhen I receive [_find spawn position v]\nshow\nswitch costume to (hitbox v)\nChange Y by [-10]\nAnimate\n\n// [Wall Jumping]\nif <<(falling) > [2]> and <[_controls v] contains [Up]?>> then\n    set [_player yv v] to [12]\n    set [_player xv v] to ((0) - (((direction) / ([abs v] of (direction) )) * (20)))\nend\n\ndefine Timer Tick\nif <(_GAME LEVEL) < [51]> then\n    change [__speedrun timer v] by ((1) / (30))\n    if <(length of ([floor v] of ((__SPEEDRUN TIMER) mod (60)) )) < [2]> then\n        set [__speedrun time display v] to (join (join ([floor v] of ((__SPEEDRUN TIMER) / (60)) ) ['0]) ([floor v] of ((__SPEEDRUN TIMER) mod (60)) ))\n    else\n        set [__speedrun time display v] to (join (join ([floor v] of ((__SPEEDRUN TIMER) / (60)) ) [']) ([floor v] of ((__SPEEDRUN TIMER) mod (60)) ))\n    end\nend\n\nwhen I receive [_set sfx volume v]\nset volume to ((100) * (_SOUNDS ON/OFF)) %\n\n@Level\n\nwhen I receive [__render level v]\nset [costume v] to (join (join [Level_] (_GAME LEVEL)) (join (join [ x] (_LEVEL X)) (join [ y] (_LEVEL Y))))\nswitch costume to (costume)\nif <(costume [name v]) = (costume)> then\n    show\n    if <(_GAME LEVEL) < [51]> then\n        Outline | Width ([ceiling v] of ((20) * (_SIZE)) ) Colour: (_COLOUR - GLOBAL) Transparency: [97] Brightness: [0]\n        Outline | Width ([ceiling v] of ((14) * (_SIZE)) ) Colour: (_COLOUR - GLOBAL) Transparency: [97] Brightness: [0]\n        if <(_LEVEL SHAKE) > [0]> then\n            Outline | Width ([ceiling v] of ((9) * (_SIZE)) ) Colour: (_COLOUR - GLOBAL) Transparency: [95] Brightness: [0]\n            Outline | Width ([ceiling v] of ((6) * (_SIZE)) ) Colour: (_COLOUR - GLOBAL) Transparency: [87] Brightness: [0]\n            Outline | Width ([ceiling v] of ((3) * (_SIZE)) ) Colour: (_COLOUR - GLOBAL) Transparency: [87] Brightness: [0]\n        else\n            Outline | Width ([ceiling v] of ((9) * (_SIZE)) ) Colour: (_COLOUR - GLOBAL) Transparency: [96] Brightness: [0]\n            Outline | Width ([ceiling v] of ((8) * (_SIZE)) ) Colour: (_COLOUR - GLOBAL) Transparency: [99] Brightness: [0]\n            Outline | Width ([ceiling v] of ((7) * (_SIZE)) ) Colour: (_COLOUR - GLOBAL) Transparency: [97] Brightness: [0]\n            Outline | Width ([ceiling v] of ((6) * (_SIZE)) ) Colour: (_COLOUR - GLOBAL) Transparency: [95] Brightness: [0]\n            Outline | Width ([ceiling v] of ((5) * (_SIZE)) ) Colour: (_COLOUR - GLOBAL) Transparency: [90] Brightness: [0]\n        end\n        Outline | Width ([ceiling v] of ((3) * (_SIZE)) ) Colour: (_COLOUR - GLOBAL) Transparency: [70] Brightness: [0]\n        Outline | Width ([ceiling v] of ((2) * (_SIZE)) ) Colour: (_COLOUR - GLOBAL) Transparency: [0] Brightness: [20]\n        Outline | Width ((1) * (_SIZE)) Colour: (_COLOUR - GLOBAL) Transparency: [0] Brightness: [85]\n        clear graphic effects\n        set [brightness v] effect to (-100)\n    else\n        clear graphic effects\n        switch costume to (join (costume) [ Decor])\n        set size to (200) %\n        stamp\n        set size to (101) %\n        set [ghost v] effect to (100)\n        switch costume to (costume)\n    end\n    go to x: (round (_LEVEL SHAKE X)) y: (round (_LEVEL SHAKE Y))\nelse\n    hide\nend\n\ndefine Outline | Width (width) Colour: (colour) Transparency: (transp) Brightness: (bright)\ngo to x: (round (_LEVEL SHAKE X)) y: (round (_LEVEL SHAKE Y))\nset [brightness v] effect to (bright)\nset [color v] effect to (colour)\nset [ghost v] effect to (transp)\nchange y by (width)\nstamp\nchange x by (width)\nstamp\nchange y by ((0) - (width))\nstamp\nchange y by ((0) - (width))\nstamp\nchange x by ((0) - (width))\nstamp\nchange x by ((0) - (width))\nstamp\nchange y by (width)\nstamp\nchange y by (width)\nstamp\n\nwhen flag clicked\nset size to (101) %\ngo to [front v] layer\n\nwhen I receive [position level v]\ngo to x: (round (_LEVEL SHAKE X)) y: (round (_LEVEL SHAKE Y))\n\nwhen flag clicked\nhide\n\n@Spikes\n\nwhen I receive [__render level v]\nset [costume v] to (join (join [Level_] (_GAME LEVEL)) (join (join [ x] (_LEVEL X)) (join [ y] (_LEVEL Y))))\nswitch costume to (costume)\nif <(costume [name v]) = (costume)> then\n    set size to (101) %\n    show\n    clear graphic effects\n    set [color v] effect to (_COLOUR - GLOBAL)\n    set [brightness v] effect to (100)\n    go to x: (round (_LEVEL SHAKE X)) y: (round (_LEVEL SHAKE Y))\nelse\n    hide\nend\n\nwhen I receive [position level v]\ngo to x: (round (_LEVEL SHAKE X)) y: (round (_LEVEL SHAKE Y))\n\nwhen flag clicked\nhide\n\n@Moving Spikes\n\nwhen I receive [__render level v]\nset [costume v] to (join (join [Level_] (_GAME LEVEL)) (join (join [ x] (_LEVEL X)) (join [ y] (_LEVEL Y))))\nswitch costume to (costume)\nif <(costume [name v]) = (costume)> then\n    set size to (101) %\n    show\n    go to x: (_LEVEL SHAKE X) y: ((round (_LEVEL SHAKE Y)) + ([floor v] of ((move y) * (_SIZE)) ))\n    clear graphic effects\n    set [color v] effect to (_COLOUR - GLOBAL)\n    set [brightness v] effect to (100)\nelse\n    hide\nend\n\nwhen I receive [position level v]\ngo to x: (round (_LEVEL SHAKE X)) y: ((round (_LEVEL SHAKE Y)) + ([floor v] of ((move y) * (_SIZE)) ))\n\nwhen I receive [moving spikes tick v]\nif <(_EDITOR) > [0]> then\n    go to x: (round (_LEVEL SHAKE X)) y: (round (_LEVEL SHAKE Y))\nelse\n    go to x: (_LEVEL SHAKE X) y: ((round (_LEVEL SHAKE Y)) + ([floor v] of ((move y) * (_SIZE)) ))\n    if <(mode) = [0]> then\n        // [Going Down]\n        change [move y v] by (((-25) - (move y)) / (4))\n        if <(time) > [35]> then\n            // [Switch to Going Up]\n            set [mode v] to [1]\n            set [time v] to [0]\n        end\n        change [time v] by (1)\n    else\n        if <(mode) = [1]> then\n            // [Going Up]\n            change [move y v] by (((0) - (move y)) / (5))\n            if <(time) > [35]> then\n                // [Switch to Going Down]\n                set [mode v] to [0]\n                set [time v] to [0]\n            end\n            change [time v] by (1)\n        end\n    end\nend\n\nwhen I receive [_reset level mobs v]\nset [move y v] to [0]\nset [mode v] to [1]\nset [time v] to [0]\n\ndefine // (comment)\n\nwhen flag clicked\nhide\n\n@Mob Barriers\n\nwhen I receive [__render level v]\nset [costume v] to (join (join [Level_] (_GAME LEVEL)) (join (join [ x] (_LEVEL X)) (join [ y] (_LEVEL Y))))\nswitch costume to (costume)\nif <(costume [name v]) = (costume)> then\n    set size to (101) %\n    go to x: (round (_LEVEL SHAKE X)) y: (round (_LEVEL SHAKE Y))\n    if <(_EDITOR) > [0]> then\n        set [ghost v] effect to (40)\n    else\n        set [ghost v] effect to (100)\n    end\n    show\nelse\n    hide\nend\n\nwhen flag clicked\ngo to [front v] layer\nhide\n\nwhen I receive [position level v]\ngo to x: (round (_LEVEL SHAKE X)) y: (round (_LEVEL SHAKE Y))\n\n@Mob\n\nwhen I receive [record mob data v]\nif <(id) > []> then\n    add (x) to [_mob data v]\n    add (y) to [_mob data v]\n    add (id) to [_mob data v]\n    add (data) to [_mob data v]\nend\n\ndefine Mob | X (x) Y (y) Id (id)\nset [x v] to (x)\nset [y v] to (y)\nset [id v] to (id)\ncreate clone of (_myself_ v)\nset [id v] to []\n\nwhen I receive [mob tick v]\nif <(id) > []> then\n    if <<([abs v] of ((x) - ((_LEVEL X) * (480))) ) < [240]> and <([abs v] of ((y) - ((_LEVEL Y) * (360))) ) < [180]>> then\n        if <(_EDITOR) > [0]> then\n            set [show? v] to [1]\n            Position\n            go to [front v] layer\n            show\n            Editor - Set Tile Costume (id)\n            if <mouse down?> then\n                if <(mouse down) = [0]> then\n                    if <(_EDITOR BRUSH) = [0]> then\n                        if <touching (mouse-pointer v)?> then\n                            delete this clone\n                        end\n                    end\n                end\n                set [mouse down v] to [1]\n            else\n                set [mouse down v] to [0]\n                if <(id) = [26]> then\n                    if <touching (mouse-pointer v)?> then\n                        say (data)\n                        if <key ((join [/] []) v) pressed?> then\n                            set [_game mode v] to [0]\n                            ask (join [Enter New Data | Current: ] (data)) and wait\n                            set [_game mode v] to [1]\n                            set [data v] to (answer)\n                        end\n                    else\n                        say []\n                    end\n                end\n            end\n        else\n            if <(is moving platform) = [0]> then\n                set [show? v] to [1]\n                Position\n                show\n                if <(id) < [3]> then\n                    if <(id) = [1]> then\n                        // [Flag]\n                        switch costume to (([floor v] of (((timer) * (10)) mod (8)) ) + (1))\n                        if <(_DEATH) = [0]> then\n                            if <<([abs v] of ((x) - (_PLAYER X)) ) < ((15) * (_SIZE))> and <([abs v] of ((y) - (_PLAYER Y)) ) < ((30) * (_SIZE))>> then\n                                set [_exit v] to [1]\n                            end\n                        end\n                    else\n                        if <(id) = [2]> then\n                            // [Spawn]\n                            delete this clone\n                        end\n                    end\n                else\n                    if <(id) < [9]> then\n                        if <(id) = [5]> then\n                            // [Arrow Right]\n                            change x by (([sin v] of (((timer) + (y)) * (140)) ) * (5))\n                            switch costume to (arrow right v)\n                        else\n                            if <(id) = [6]> then\n                                // [Arrow Left]\n                                change x by (([sin v] of (((timer) + (y)) * (140)) ) * (5))\n                                switch costume to (arrow left v)\n                            else\n                                if <(id) = [7]> then\n                                    // [Arrow Up]\n                                    change y by (([sin v] of (((timer) + (x)) * (140)) ) * (5))\n                                    switch costume to (arrow up v)\n                                else\n                                    if <(id) = [8]> then\n                                        // [Arrow Down]\n                                        change y by (([sin v] of (((timer) + (x)) * (140)) ) * (5))\n                                        switch costume to (arrow down v)\n                                    end\n                                end\n                            end\n                        end\n                    else\n                        if <(id) < [12]> then\n                            if <(id) = [9]> then\n                                // [Trampoline]\n                                if <(stop time) > [0]> then\n                                    switch costume to (bounced v)\n                                    Particle | X: (_PLAYER X) Y: ((_PLAYER Y) - (8)) Id: [2]\n                                    change [stop time v] by (-1)\n                                else\n                                    switch costume to (bounce v)\n                                    if <touching (player v)?> then\n                                        set [_player yv v] to [18]\n                                        set [stop time v] to [6]\n                                        start sound [Big Boing v]\n                                    end\n                                end\n                            else\n                                if <(id) = [10]> then\n                                    // [Key]\n                                    if <(collected) = [0]> then\n                                        switch costume to (white key v)\n                                        change y by ((([sin v] of (((timer) + (x)) * (140)) ) * (5)) * (_SIZE))\n                                        if <<([abs v] of ((x) - (_PLAYER X)) ) < ((30) * (_SIZE))> and <([abs v] of ((y) - (_PLAYER Y)) ) < ((30) * (_SIZE))>> then\n                                            set [collected v] to [1]\n                                            change [_keys collected v] by (1)\n                                            Particle Dot Shower | X: (x) Y: (y) Size: [5]\n                                            start sound [Clang v]\n                                        end\n                                        set [show? v] to [1]\n                                        show\n                                    else\n                                        set [show? v] to [0]\n                                        hide\n                                    end\n                                else\n                                    if <(id) = [11]> then\n                                        // [Sawblade]\n                                        switch costume to (saw v)\n                                        set rotation style [all around v]\n                                        turn right (10) degrees\n                                        if <touching (player v)?> then\n                                            set [_death v] to [1]\n                                        end\n                                    end\n                                end\n                            end\n                        else\n                            if <(id) < [15]> then\n                                if <(id) = [12]> then\n                                    // [Wizard NPC]\n                                    if <(_GAME LEVEL) < [51]> then\n                                        set [pixelate v] effect to (pick random (0) to (pick random (0) to (pick random (0) to (30))))\n                                        set [mosaic v] effect to (pick random (0) to (pick random (0) to (pick random (0) to (pick random (0) to (pick random (0) to (pick random (0) to (pick random (0) to (30))))))))\n                                        switch costume to (pick random (29) to (pick random (29) to (pick random (29) to (31))))\n                                    else\n                                        switch costume to (join [Real Wizard] (([floor v] of (((timer) * (7)) mod (3)) ) + (1)))\n                                    end\n                                    Tick NPC\n                                else\n                                    if <(id) = [14]> then\n                                        // [Swinging Club]\n                                        switch costume to (club hitbox v)\n                                        set rotation style [all around v]\n                                        turn right (5) degrees\n                                        if <touching (player v)?> then\n                                            set [_death v] to [1]\n                                        end\n                                        switch costume to (club v)\n                                    end\n                                end\n                            else\n                                if <(id) < [22]> then\n                                    if <(id) = [15]> then\n                                        // [Cannon]\n                                        point towards (player v)\n                                        set rotation style [all around v]\n                                        if <(stop time) > [35]> then\n                                            if <<(_GAME MODE) = [1]> and <(_DEATH) = [0]>> then\n                                                switch costume to (join [Cannon Shoot] ([floor v] of (((stop time) - (35)) / (2)) ))\n                                                if <(stop time) > [45]> then\n                                                    set [stop time v] to [0]\n                                                    set [id v] to [16]\n                                                    set [direction v] to (direction)\n                                                    change [x v] by (([sin v] of (direction) ) * ((7) * (_SIZE)))\n                                                    change [y v] by (([cos v] of (direction) ) * ((7) * (_SIZE)))\n                                                    start sound [Shot v]\n                                                    create clone of (_myself_ v)\n                                                    set [id v] to [15]\n                                                    change [x v] by (([sin v] of (direction) ) * ((-7) * (_SIZE)))\n                                                    change [y v] by (([cos v] of (direction) ) * ((-7) * (_SIZE)))\n                                                end\n                                            else\n                                                set [stop time v] to [0]\n                                            end\n                                        else\n                                            if <(stop time) < [11]> then\n                                                switch costume to (join [Cannon] ((((stop time) / (2)) mod (5)) + (1)))\n                                            else\n                                                switch costume to (cannon1 v)\n                                            end\n                                        end\n                                        change [stop time v] by (1)\n                                    else\n                                        if <(id) = [16]> then\n                                            // [Cannon Ball]\n                                            set rotation style [all around v]\n                                            turn right (10) degrees\n                                            change [x v] by (([sin v] of (direction) ) * ((7) * (_SIZE)))\n                                            change [y v] by (([cos v] of (direction) ) * ((7) * (_SIZE)))\n                                            change [stop time v] by (1)\n                                            Position\n                                            switch costume to (cannon ball hitbox v)\n                                            if <(stop time) > [3]> then\n                                                Get IsSolid\n                                                if <(is solid) > [0]> then\n                                                    Particle Dot Shower | X: (x) Y: (y) Size: [4]\n                                                    delete this clone\n                                                else\n                                                    if <touching (player v)?> then\n                                                        set [_death v] to [1]\n                                                        Particle Dot Shower | X: (x) Y: (y) Size: [4]\n                                                        delete this clone\n                                                    end\n                                                end\n                                            end\n                                            switch costume to (cannon ball v)\n                                        else\n                                            if <(id) = [21]> then\n                                                // [Chicken]\n                                                switch costume to (chickenhitbox v)\n                                                if <(mode) = [1]> then\n                                                    change [stop time v] by (1)\n                                                    Tick Walker [1]\n                                                    if <(falling) = [0]> then\n                                                        switch costume to (chicken edge check v)\n                                                        Get IsSolid\n                                                        if <(is solid) = [0]> then\n                                                            set [direction v] to ((0) - (direction))\n                                                        end\n                                                    end\n                                                    switch costume to (chickensquishbox v)\n                                                    if <touching (player v)?> then\n                                                        if <(_PLAYER YV) < [-2]> then\n                                                            start sound [Pluck v]\n                                                            set [_player yv v] to [15]\n                                                            set [mode v] to [2]\n                                                            set [stop time v] to [0]\n                                                        else\n                                                            if <(stop time) > [15]> then\n                                                                switch costume to (chickenhitbox v)\n                                                                if <touching (player v)?> then\n                                                                    set [_death v] to [1]\n                                                                end\n                                                            end\n                                                        end\n                                                    end\n                                                    if <([abs v] of (xv) ) > [0.2]> then\n                                                        switch costume to (([floor v] of (((timer) * (6)) mod (2)) ) + (54))\n                                                    else\n                                                        switch costume to (chickenstand v)\n                                                    end\n                                                else\n                                                    change [stop time v] by (1)\n                                                    if <(stop time) < [6]> then\n                                                        switch costume to (join [ChickenSquish] ([ceiling v] of ((stop time) / (2)) ))\n                                                    else\n                                                        if <(stop time) > [37]> then\n                                                            switch costume to (join [ChickenUnsquish] ([ceiling v] of (((stop time) - (37)) / (2)) ))\n                                                            if <(stop time) > [45]> then\n                                                                set [mode v] to [1]\n                                                                set [stop time v] to [0]\n                                                            end\n                                                        else\n                                                            switch costume to (chickensquish2 v)\n                                                        end\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                else\n                                    if <(id) < [26]> then\n                                        if <(id) = [22]> then\n                                            // [Axe]\n                                            set rotation style [all around v]\n                                            point in direction ((([sin v] of (((_TIMER) + ((x) * (0.2342525526))) * (100)) ) * (90)) + (90))\n                                            switch costume to (axe hitbox v)\n                                            if <touching (player v)?> then\n                                                set [_death v] to [1]\n                                            end\n                                            switch costume to (axe v)\n                                        else\n                                            if <(id) = [23]> then\n                                                // [Floater]\n                                                point in direction (direction)\n                                                switch costume to (floater hitbox v)\n                                                Tick Floater [2.5]\n                                                change y by ((([sin v] of (((_TIMER) + ((starting x) + (starting y))) * (200)) ) * (6)) * (_SIZE))\n                                                if <touching (player v)?> then\n                                                    set [_death v] to [1]\n                                                end\n                                                if <(([floor v] of ((((timer) + ((starting x) + (starting y))) * (14)) mod (20)) ) - (15)) < [1]> then\n                                                    switch costume to (floater1 v)\n                                                else\n                                                    switch costume to (join [Floater] (([floor v] of ((((timer) + ((starting x) + (starting y))) * (14)) mod (20)) ) - (15)))\n                                                end\n                                            else\n                                                if <(id) = [24]> then\n                                                    // [Gravity - Upside Down]\n                                                    if <(_GRAVITY) = [1]> then\n                                                        switch costume to (gravity flip hitbox v)\n                                                        set [ghost v] effect to (0)\n                                                        if <touching (player v)?> then\n                                                            set [_gravity v] to [-1]\n                                                            set [_player yv v] to ((_PLAYER YV) * (0.4))\n                                                            Particle Dot Shower | X: (x) Y: (y) Size: [10]\n                                                            start sound [Futuristic Terminal v]\n                                                        end\n                                                    else\n                                                        set [ghost v] effect to (50)\n                                                    end\n                                                    switch costume to (join [Upside Down] (([floor v] of (((timer) * (12)) mod (7)) ) + (1)))\n                                                else\n                                                    if <(id) = [25]> then\n                                                        // [Gravity - Right Side Up]\n                                                        if <(_GRAVITY) = [-1]> then\n                                                            switch costume to (gravity flip hitbox v)\n                                                            set [ghost v] effect to (0)\n                                                            if <touching (player v)?> then\n                                                                set [_gravity v] to [1]\n                                                                set [_player yv v] to ((_PLAYER YV) * (0.4))\n                                                                Particle Dot Shower | X: (x) Y: (y) Size: [10]\n                                                                start sound [Futuristic Terminal v]\n                                                            end\n                                                        else\n                                                            set [ghost v] effect to (50)\n                                                        end\n                                                        switch costume to (join [Right Side Up] (([floor v] of ((((timer) * (12)) + (2)) mod (7)) ) + (1)))\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n                hide\n                hide\n            end\n        end\n        stop [this script v]\n    else\n        if <(_EDITOR) > [0]> then\n            set [show? v] to [0]\n            hide\n        else\n            if <(is moving platform) = [0]> then\n                set [show? v] to [0]\n                hide\n            end\n        end\n    end\n    if <(id) = [16]> then\n        // [Cannon balls delete if offscreen]\n        delete this clone\n    end\nelse\n    if <(_EDITOR) > [0]> then\n        go to (mouse-pointer v)\n        set [ghost v] effect to (60)\n        if <(_EDITOR BRUSH) > [0]> then\n            show\n            if <mouse down?> then\n                if <(mouse down) = [0]> then\n                    set [data v] to [0]\n                    Mob | X ((x position) + ((_LEVEL X) * (480))) Y ((y position) + ((_LEVEL Y) * (360))) Id (_EDITOR BRUSH)\n                end\n                set [mouse down v] to [1]\n            else\n                set [mouse down v] to [0]\n            end\n        else\n            hide\n        end\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nset [id v] to []\nhide\n\ndefine Encode Mob Data\nset [encoded v] to []\nset [i v] to [1]\nrepeat (length of [_mob data v])\n    set [encoded v] to (join (encoded) (join (item (i) of [_mob data v]) [_]))\n    change [i v] by (1)\nend\n\ndefine Load Mob Data\nset [i v] to [1]\nrepeat until <(letter (i) of (item (_GAME LEVEL) of [_save codes v])) = [|]>\n    change [i v] by (1)\n    if <not <(i) < (length of (item (_GAME LEVEL) of [_save codes v]))>> then\n        stop [this script v]\n    end\nend\nchange [i v] by (1)\nrepeat until <not <(i) < (length of (item (_GAME LEVEL) of [_save codes v]))>>\n    set [x v] to []\n    set [y v] to []\n    set [id v] to []\n    Read Save Code Data (item (_GAME LEVEL) of [_save codes v])\n    set [x v] to (encoded)\n    Read Save Code Data (item (_GAME LEVEL) of [_save codes v])\n    set [y v] to (encoded)\n    Read Save Code Data (item (_GAME LEVEL) of [_save codes v])\n    set [id v] to (encoded)\n    Read Save Code Data (item (_GAME LEVEL) of [_save codes v])\n    set [data v] to (encoded)\n    if <(id) = [2]> then\n        set [_player spawn x v] to (x)\n        set [_player spawn y v] to (y)\n    end\n    set [starting x v] to (x)\n    set [starting y v] to (y)\n    create clone of (_myself_ v)\nend\nset [id v] to []\n\nwhen I receive [_load mob level v]\nif <(id) = []> then\n    Load Mob Data\nend\n\nwhen I receive [_delete mobs v]\ndelete this clone\n\nwhen I start as a clone\nclear graphic effects\nset size to ((100) * (_SIZE)) %\nset rotation style [left-right v]\npoint in direction (90)\nset [is moving platform v] to [0]\nset [stop time v] to [0]\nif <(id) = [3]> then\n    // [Horizontal Wide Platform]\n    set [direction v] to [90]\n    set [is moving platform v] to [1]\nelse\n    if <(id) = [4]> then\n        // [Vertical Wide Platform]\n        set [direction v] to [0]\n        set [is moving platform v] to [1]\n    else\n        if <(id) = [13]> then\n            // [Breaking Platform]\n            set [ghost v] to [100]\n            set [stop time v] to [0]\n            set [is moving platform v] to [1]\n            set [mode v] to [1]\n        else\n            if <(id) = [14]> then\n                // [Swinging Club]\n                go to [front v] layer\n            else\n                if <(id) = [16]> then\n                    // [Cannon Ball]\n                    hide\n                else\n                    if <(id) = [17]> then\n                        // [Crusher - Down]\n                        set [is moving platform v] to [1]\n                        set [mode v] to [1]\n                        set [direction v] to [-180]\n                    else\n                        if <(id) = [18]> then\n                            // [Crusher - Up]\n                            set [is moving platform v] to [1]\n                            set [mode v] to [1]\n                            set [direction v] to [0]\n                        else\n                            if <(id) = [19]> then\n                                // [Crusher - Right]\n                                set [is moving platform v] to [1]\n                                set [mode v] to [1]\n                                set [direction v] to [90]\n                            else\n                                if <(id) = [20]> then\n                                    // [Crusher - Left]\n                                    set [is moving platform v] to [1]\n                                    set [mode v] to [1]\n                                    set [direction v] to [-90]\n                                else\n                                    if <(id) = [21]> then\n                                        // [Chicken]\n                                        set [mode v] to [1]\n                                        set [direction v] to [90]\n                                        set [start direction v] to (direction)\n                                    else\n                                        if <(id) = [22]> then\n                                            // [Swinging Axe]\n                                            go to [front v] layer\n                                        else\n                                            if <(id) = [23]> then\n                                                // [Floater]\n                                                set [direction v] to [90]\n                                                set [start direction v] to (direction)\n                                            else\n                                                if <(id) = [24]> then\n                                                    // [Gravity Flip]\n                                                else\n                                                    if <(id) = [26]> then\n                                                        // [Snake Platforms]\n                                                        set [is moving platform v] to [1]\n                                                        set [i v] to [1]\n                                                        Read Mob Data (data)\n                                                        set [information v] to (encoded)\n                                                        Read Mob Data (data)\n                                                        set [information 2 v] to (encoded)\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nif <(is moving platform) = [1]> then\n    set [starting x v] to (x)\n    set [starting y v] to (y)\n    set [start direction v] to (direction)\nend\n\nwhen [i v] key pressed\nif <(id) = []> then\n    change [_editor brush v] by (1)\n    if <(_EDITOR BRUSH) > [26]> then\n        set [_editor brush v] to [0]\n    end\n    Editor - Set Tile Costume (_EDITOR BRUSH)\nend\n\ndefine Editor - Set Tile Costume (id)\nset size to ((100) * (_SIZE)) %\nclear graphic effects\nset rotation style [all around v]\npoint in direction (90)\nif <(id) = [1]> then\n    // [Flag Goal]\n    switch costume to (flag1 v)\nelse\n    if <(id) = [2]> then\n        // [Player Spawning Position]\n        switch costume to (player spawn v)\n    else\n        if <(id) = [3]> then\n            // [Moving Platform - Horizontal Wide]\n            switch costume to (horizontal wide v)\n            set [color v] effect to (_COLOUR - GLOBAL)\n        else\n            if <(id) = [4]> then\n                // [Moving Platform - Vertical Wide]\n                switch costume to (vertical wide v)\n                set [color v] effect to (_COLOUR - GLOBAL)\n            else\n                if <(id) = [5]> then\n                    // [Arrow Right]\n                    switch costume to (arrow right v)\n                else\n                    if <(id) = [6]> then\n                        // [Arrow Left]\n                        switch costume to (arrow left v)\n                    else\n                        if <(id) = [7]> then\n                            // [Arrow Up]\n                            switch costume to (arrow up v)\n                        else\n                            if <(id) = [8]> then\n                                // [Arrow Down]\n                                switch costume to (arrow down v)\n                            else\n                                if <(id) = [9]> then\n                                    // [Trampoline]\n                                    switch costume to (bounce v)\n                                else\n                                    if <(id) = [10]> then\n                                        // [Key]\n                                        switch costume to (white key v)\n                                    else\n                                        if <(id) = [11]> then\n                                            // [Sawblade]\n                                            switch costume to (saw v)\n                                        else\n                                            if <(id) = [12]> then\n                                                // [Wizard NPC]\n                                                switch costume to (wizard npc v)\n                                            else\n                                                if <(id) = [13]> then\n                                                    // [Breaking Platform]\n                                                    switch costume to (breaking platform v)\n                                                    set [color v] effect to (_COLOUR - GLOBAL)\n                                                else\n                                                    if <(id) = [14]> then\n                                                        // [Swinging Club]\n                                                        switch costume to (club v)\n                                                    else\n                                                        if <(id) = [15]> then\n                                                            // [Cannon]\n                                                            switch costume to (cannon shoot1 v)\n                                                        else\n                                                            if <(id) = [16]> then\n                                                                // [Cannon Ball]\n                                                                switch costume to (cannon ball v)\n                                                            else\n                                                                if <<(id) > [16]> and <(id) < [21]>> then\n                                                                    // [Crushers]\n                                                                    switch costume to (crusher v)\n                                                                    set [color v] effect to (_COLOUR - GLOBAL)\n                                                                    if <(id) = [17]> then\n                                                                        point in direction (90)\n                                                                    else\n                                                                        if <(id) = [18]> then\n                                                                            point in direction (-90)\n                                                                        else\n                                                                            if <(id) = [19]> then\n                                                                                point in direction (0)\n                                                                            else\n                                                                                if <(id) = [20]> then\n                                                                                    point in direction (180)\n                                                                                end\n                                                                            end\n                                                                        end\n                                                                    end\n                                                                else\n                                                                    if <(id) = [21]> then\n                                                                        // [Chicken]\n                                                                        switch costume to (chickenstand v)\n                                                                    else\n                                                                        if <(id) = [22]> then\n                                                                            // [Swinging Axe]\n                                                                            switch costume to (axe v)\n                                                                        else\n                                                                            if <(id) = [23]> then\n                                                                                // [Floater]\n                                                                                switch costume to (floater1 v)\n                                                                            else\n                                                                                if <(id) = [24]> then\n                                                                                    // [Gravity Flip]\n                                                                                    switch costume to (upside down1 v)\n                                                                                else\n                                                                                    if <(id) = [25]> then\n                                                                                        // [Gravity Flip]\n                                                                                        switch costume to (right side up1 v)\n                                                                                    else\n                                                                                        if <(id) = [26]> then\n                                                                                            // [Snake Blocks]\n                                                                                            set [color v] effect to (_COLOUR - GLOBAL)\n                                                                                            switch costume to (snake v)\n                                                                                        end\n                                                                                    end\n                                                                                end\n                                                                            end\n                                                                        end\n                                                                    end\n                                                                end\n                                                            end\n                                                        end\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine // (comment)\n\ndefine Position\ngo to x: (((round (x)) - ((_LEVEL X) * (480))) + (round (_LEVEL SHAKE X))) y: (((round (y)) - ((_LEVEL Y) * (360))) + (round (_LEVEL SHAKE Y)))\n\ndefine Moving Platform - Check for Player\nchange y by ((1) * (_GRAVITY))\nif <touching (player v)?> then\n    set [_moving platform xv v] to ((x) - (last x))\n    set [_moving platform yv v] to ((y) - (last y))\nend\nchange y by ((-1) * (_GRAVITY))\n\nwhen I receive [moving platform tick v]\nif <(id) > []> then\n    if <(is moving platform) = [1]> then\n        show\n        set [show? v] to [1]\n        if <<([abs v] of ((starting x) - ((_LEVEL X) * (480))) ) < [240]> and <([abs v] of ((starting y) - ((_LEVEL Y) * (360))) ) < [180]>> then\n            if <(id) = [3]> then\n                // [Horizontal Wide]\n                switch costume to (([floor v] of (((timer) * (5)) mod (5)) ) + (10))\n                set [color v] effect to (_COLOUR - GLOBAL)\n                set rotation style [don't rotate v]\n                Tick Moving Platform | Speed: [3.5]\n            else\n                if <(id) = [4]> then\n                    // [Vertical Wide]\n                    switch costume to (([floor v] of (((timer) * (5)) mod (5)) ) + (15))\n                    set [color v] effect to (_COLOUR - GLOBAL)\n                    set rotation style [don't rotate v]\n                    Tick Moving Platform | Speed: [3.5]\n                else\n                    if <(id) = [13]> then\n                        // [Breaking Platform]\n                        Position\n                        switch costume to (breaking platform v)\n                        set [color v] effect to (_COLOUR - GLOBAL)\n                        set [ghost v] effect to (ghost)\n                        if <(mode) = [1]> then\n                            if <(ghost) > [0]> then\n                                change [ghost v] by (-20)\n                            end\n                            change y by (2)\n                            if <touching (player v)?> then\n                                set [mode v] to [2]\n                                set [stop time v] to [0]\n                            end\n                            change y by (-2)\n                        else\n                            if <(mode) = [2]> then\n                                if <(ghost) > [0]> then\n                                    change [ghost v] by (-20)\n                                end\n                                change x by ((pick random (-2) to (2)) * (_SIZE))\n                                change y by ((pick random (-2) to (2)) * (_SIZE))\n                                change [stop time v] by (1)\n                                if <(stop time) > [15]> then\n                                    start sound [Breaking v]\n                                    set [mode v] to [3]\n                                    set [stop time v] to [0]\n                                    Particle Dot Shower | X: ((x) + ((20) * (_SIZE))) Y: (y) Size: [7]\n                                    Particle Dot Shower | X: ((x) - ((20) * (_SIZE))) Y: (y) Size: [7]\n                                end\n                            else\n                                if <(mode) = [3]> then\n                                    set [ghost v] to [100]\n                                    change [stop time v] by (1)\n                                    if <(stop time) > [35]> then\n                                        show\n                                        if <touching (player v)?> then\n                                    end\n                                    set [show? v] to [0]\n                                    hide\n                                end\n                            end\n                        end\n                    else\n                        if <<(id) > [16]> and <(id) < [21]>> then\n                            // [Crusher]\n                            set [color v] effect to (_COLOUR - GLOBAL)\n                            set rotation style [all around v]\n                            point in direction ((start direction) - (90))\n                            if <(mode) = [1]> then\n                                Tick Crusher Movement | [11]\n                            else\n                                Tick Crusher Movement | [2.5]\n                            end\n                            if <(mode) = [1]> then\n                                switch costume to (crusher v)\n                            else\n                                if <(stop time) < [6]> then\n                                    switch costume to (crusher v)\n                                else\n                                    switch costume to (crusher blink v)\n                                end\n                            end\n                        else\n                            if <(id) = [26]> then\n                                // [Snake platforms]\n                                Position\n                                set [color v] effect to (_COLOUR - GLOBAL)\n                                set [show? v] to [1]\n                                if <((([floor v] of ((_TIMER) / (1.25)) ) mod (information 2)) + (1)) = (information)> then\n                                    switch costume to (snake v)\n                                    show\n                                    if <touching (player v)?> then\n                                        hide\n                                    end\n                                else\n                                    if <((([floor v] of (((_TIMER) + (0.7)) / (1.25)) ) mod (information 2)) + (1)) = (information)> then\n                                        switch costume to (snake3 v)\n                                        hide\n                                    else\n                                        switch costume to (snake2 v)\n                                        hide\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        else\n            set [show? v] to [0]\n            hide\n        end\n    else\n        hide\n    end\nend\n\ndefine Tick Moving Platform | Speed: (speed)\nset [is moving platform v] to [1]\nset [last x v] to (x)\nset [last y v] to (y)\nif <(stop time) < [1]> then\n    change [x v] by (((speed) * ([sin v] of (direction) )) * (_SIZE))\n    change [y v] by (((speed) * ([cos v] of (direction) )) * (_SIZE))\n    Moving Platform - Check for Player\n    Position\n    if <<<touching (level v)?> or <touching (mob barriers v)?>> or <touching (door v)?>> then\n        set [stop time v] to [5]\n        change [direction v] by (180)\n        repeat ([ceiling v] of ([abs v] of (speed) ) )\n            change [x v] by ((((speed) * ([sin v] of (direction) )) * (_SIZE)) / ([abs v] of (((speed) * ([sin v] of (direction) )) * (_SIZE)) ))\n            change [y v] by ((((speed) * ([cos v] of (direction) )) * (_SIZE)) / ([abs v] of (((speed) * ([cos v] of (direction) )) * (_SIZE)) ))\n            Position\n            if <not <<<touching (level v)?> or <touching (mob barriers v)?>> or <touching (door v)?>>> then\n                Moving Platform - Check for Player\n                stop [this script v]\n            end\n        end\n    end\n    Moving Platform - Check for Player\nelse\n    change [stop time v] by (-1)\nend\nPosition\n\ndefine Particle | X: (x) Y: (y) Id: (id)\nadd (x) to [_particle spawns v]\nadd (y) to [_particle spawns v]\nadd (id) to [_particle spawns v]\n\ndefine Particle Dot Shower | X: (x) Y: (y) Size: (size)\nrepeat (size)\n    Particle | X: (x) Y: (y) Id: [1]\nend\n\nwhen I receive [_reset level mobs v]\nif <(id) > []> then\n    set [stop time v] to [0]\n    if <(id) = [10]> then\n        // [Key]\n        set [collected v] to [0]\n        change [_keys total v] by (1)\n    else\n        if <(id) = [14]> then\n            // [Swinging Club]\n            point in direction (90)\n        else\n            if <(id) = [15]> then\n                // [Cannon]\n                set [stop time v] to [0]\n            else\n                if <(id) = [13]> then\n                    // [Breaking Platform]\n                    set [ghost v] to [100]\n                    set [is moving platform v] to [1]\n                    set [mode v] to [1]\n                else\n                    if <(id) = [16]> then\n                        // [Cannon Ball]\n                        delete this clone\n                    else\n                        if <(id) = [21]> then\n                            // [Chicken]\n                            set [mode v] to [1]\n                            set [x v] to (starting x)\n                            set [y v] to (starting y)\n                            set [direction v] to (start direction)\n                        else\n                            if <(id) = [23]> then\n                                // [Floater]\n                                set [x v] to (starting x)\n                                set [y v] to (starting y)\n                                set [direction v] to (start direction)\n                            else\n                                if <(is moving platform) > [0]> then\n                                    set [x v] to (starting x)\n                                    set [y v] to (starting y)\n                                    set [direction v] to (start direction)\n                                    if <<(id) > [16]> and <(id) < [21]>> then\n                                        // [Crushers]\n                                        set [mode v] to [1]\n                                        set [stop time v] to [0]\n                                    else\n                                        if <(id) = [26]> then\n                                            set [i v] to [1]\n                                            Read Mob Data (data)\n                                            set [information v] to (encoded)\n                                            Read Mob Data (data)\n                                            set [information 2 v] to (encoded)\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Read Save Code Data (input)\nset [encoded v] to []\nrepeat until <(letter (i) of (input)) = [_]>\n    set [encoded v] to (join (encoded) (letter (i) of (input)))\n    change [i v] by (1)\n    if <(i) > (length of (input))> then\n        stop [this script v]\n    end\nend\nchange [i v] by (1)\n\nwhen [o v] key pressed\nif <(id) = []> then\n    change [_editor brush v] by (-1)\n    if <(_EDITOR BRUSH) < [0]> then\n        set [_editor brush v] to [26]\n    end\n    Editor - Set Tile Costume (_EDITOR BRUSH)\nend\n\ndefine Tick NPC\nif <(_PLAYER X) > (x)> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\nif <(_GAME MODE) = [1]> then\n    say []\n    set [npc is active? v] to [0]\n    if <(length of [z coords v]) = [0]> then\n        if <([abs v] of ((x) - (_PLAYER X)) ) < ((40) * (_SIZE))> then\n            if <([abs v] of ((y) - (_PLAYER Y)) ) < ((40) * (_SIZE))> then\n                add (x) to [z coords v]\n                add (y) to [z coords v]\n                if <<<key (z v) pressed?> or <<mouse down?> and <(distance to [mouse-pointer v]) < [25]>>> and <(z pressed) = [0]>> then\n                    set [_game mode v] to [2]\n                    set [speech # v] to [1]\n                    set [speech v] to (item ((item # of (join [LEVEL_] (_GAME LEVEL)) in [npc speech v]) + (speech #)) of [npc speech v])\n                    set [npc is active? v] to [1]\n                    delete all of [_text to write v]\n                    add (speech) to [_text to write v]\n                    say []\n                end\n            end\n        end\n    end\n    if <<key (z v) pressed?> or <<mouse down?> and <(distance to [mouse-pointer v]) < [25]>>> then\n        set [z pressed v] to [1]\n    else\n        set [z pressed v] to [0]\n    end\nelse\n    if <(npc is active?) > [0]> then\n        if <key (x v) pressed?> then\n            delete all of [_text to write v]\n            add [] to [_text to write v]\n            set [_game mode v] to [1]\n            stop [this script v]\n        end\n        if <<<key (z v) pressed?> or <mouse down?>> and <(z pressed) = [0]>> then\n            change [speech # v] by (1)\n            set [speech v] to (item ((item # of (join [LEVEL_] (_GAME LEVEL)) in [npc speech v]) + (speech #)) of [npc speech v])\n            if <(speech) > []> then\n                if <(speech) = [<|]> then\n                    set [_exit v] to [1]\n                    add [] to [_text to write v]\n                else\n                    add (speech) to [_text to write v]\n                end\n            else\n                set [_game mode v] to [1]\n                add [] to [_text to write v]\n            end\n        end\n        if <<key (z v) pressed?> or <mouse down?>> then\n            set [z pressed v] to [1]\n        else\n            set [z pressed v] to [0]\n        end\n    end\nend\n\ndefine Tick Crusher Movement | (speed)\nset [is moving platform v] to [1]\nset [last x v] to (x)\nset [last y v] to (y)\nif <(stop time) < [1]> then\n    change [x v] by (((speed) * ([sin v] of (direction) )) * (_SIZE))\n    change [y v] by (((speed) * ([cos v] of (direction) )) * (_SIZE))\nelse\n    change [stop time v] by (-1)\nend\nswitch costume to (crusher v)\nMoving Platform - Check for Player\nPosition\nswitch costume to (crusher hitbox v)\nif <<<touching (level v)?> or <touching (mob barriers v)?>> or <touching (door v)?>> then\n    if <(mode) = [1]> then\n        // [Crush]\n        if <(_SIZE) > [0.5]> then\n            if <(_LEVEL SHAKE) < ((4) * (_SIZE))> then\n                set [_level shake v] to ((4) * (_SIZE))\n            end\n        end\n        Particle Dot Shower | X: ((x) + (10)) Y: ((y) - (10)) Size: [2]\n        Particle Dot Shower | X: ((x) - (10)) Y: ((y) - (10)) Size: [2]\n        set [stop time v] to [20]\n        set [mode v] to [2]\n        start sound (pick random (6) to (10))\n    else\n        set [stop time v] to [30]\n        set [mode v] to [1]\n    end\n    change [direction v] by (180)\n    repeat ([abs v] of (speed) )\n        change [x v] by ((((speed) * ([sin v] of (direction) )) * (_SIZE)) / ([abs v] of (((speed) * ([sin v] of (direction) )) * (_SIZE)) ))\n        change [y v] by ((((speed) * ([cos v] of (direction) )) * (_SIZE)) / ([abs v] of (((speed) * ([cos v] of (direction) )) * (_SIZE)) ))\n        Position\n        if <not <<<touching (level v)?> or <touching (mob barriers v)?>> or <touching (door v)?>>> then\n            switch costume to (crusher v)\n            Moving Platform - Check for Player\n            stop [this script v]\n        end\n    end\nend\nswitch costume to (crusher v)\nMoving Platform - Check for Player\n\nwhen I receive [animate v]\nif <(id) > []> then\n    if <(show?) > [0]> then\n        show\n    else\n        hide\n    end\nend\n\ndefine Get IsSolid\nPosition\nif <<<touching (level v)?> or <touching (mob v)?>> or <touching (door v)?>> then\n    set [is solid v] to [1]\nelse\n    set [is solid v] to [0]\nend\n\ndefine Change X by (x)\nset [wall collision v] to [0]\nchange [x v] by (x)\nrepeat (7)\n    Get IsSolid\n    if <(is solid) = [1]> then\n        change [y v] by (1)\n    else\n        stop [this script v]\n    end\nend\nchange [y v] by (-7)\nrepeat ([ceiling v] of ([abs v] of (x) ) )\n    set [wall collision v] to [1]\n    if <(is solid) = [0]> then\n        stop [this script v]\n    end\n    change [x v] by ((0) - ((x) / ([abs v] of (x) )))\n    set [xv v] to [0]\n    Get IsSolid\nend\n\ndefine Change Y by (y)\nchange [y v] by (y)\nGet IsSolid\nrepeat ([ceiling v] of ([abs v] of (y) ) )\n    if <(is solid) = [0]> then\n        stop [this script v]\n    end\n    change [y v] by ((0) - ((y) / ([abs v] of (y) )))\n    if <(y) > [0]> then\n    Get IsSolid\n    set [yv v] to [0]\nend\n\ndefine Tick Walker (speed)\npoint in direction (direction)\nchange [falling v] by (1)\nif <(direction) > [0]> then\n    change [xv v] by (speed)\nelse\n    change [xv v] by ((0) - (speed))\nend\nif <([abs v] of (xv) ) > [0.4]> then\n    Change X by ((round (xv)) * (_SIZE))\n    if <(wall collision) > [0]> then\n        set [direction v] to ((0) - (direction))\n    else\n        if <(direction) > [0]> then\n            if <((x) - ((_LEVEL X) * (480))) > [230]> then\n                set [direction v] to [-90]\n                change [x v] by (((x) - ((_LEVEL X) * (480))) - (230))\n            end\n        else\n            if <((x) - ((_LEVEL X) * (480))) < [-230]> then\n                set [direction v] to [90]\n                change [x v] by (((x) - ((_LEVEL X) * (480))) + (230))\n            end\n        end\n    end\n    set [xv v] to ((xv) * (0.75))\nelse\n    set [xv v] to [0]\nend\nChange Y by ((yv) * (_SIZE))\nchange [yv v] by (-1)\nif <(yv) < [-16]> then\n    set [yv v] to [-16]\nend\n\ndefine Tick Floater (speed)\nchange [x v] by (((speed) * ([sin v] of (direction) )) * (_SIZE))\nchange [y v] by (((speed) * ([cos v] of (direction) )) * (_SIZE))\nPosition\nif <<<touching (level v)?> or <touching (mob barriers v)?>> or <touching (door v)?>> then\n    set [direction v] to ((0) - (direction))\n    repeat ([abs v] of (speed) )\n        change [x v] by ((((speed) * ([sin v] of (direction) )) * (_SIZE)) / ([abs v] of (((speed) * ([sin v] of (direction) )) * (_SIZE)) ))\n        change [y v] by ((((speed) * ([cos v] of (direction) )) * (_SIZE)) / ([abs v] of (((speed) * ([cos v] of (direction) )) * (_SIZE)) ))\n        Position\n        if <not <<<touching (level v)?> or <touching (mob barriers v)?>> or <touching (door v)?>>> then\n            stop [this script v]\n        end\n    end\nend\nif <(direction) > [0]> then\n    if <((x) - ((_LEVEL X) * (480))) > [230]> then\n        set [direction v] to [-90]\n    end\nelse\n    if <((x) - ((_LEVEL X) * (480))) < [-230]> then\n        set [direction v] to [90]\n    end\nend\n\ndefine Add Data to Save Codes\nset [i v] to [1]\nset [encoded v] to []\nrepeat until <(letter (i) of (item (_GAME LEVEL) of [_save codes v])) = [|]>\n    set [encoded v] to (join (encoded) (letter (i) of (item (_GAME LEVEL) of [_save codes v])))\n    change [i v] by (1)\nend\nset [encoded v] to (join (encoded) (letter (i) of (item (_GAME LEVEL) of [_save codes v])))\nchange [i v] by (1)\nrepeat until <not <(i) < (length of (item (_GAME LEVEL) of [_save codes v]))>>\n    repeat (4)\n        repeat until <(letter (i) of (item (_GAME LEVEL) of [_save codes v])) = [_]>\n            set [encoded v] to (join (encoded) (letter (i) of (item (_GAME LEVEL) of [_save codes v])))\n            change [i v] by (1)\n        end\n        set [encoded v] to (join (encoded) (letter (i) of (item (_GAME LEVEL) of [_save codes v])))\n        change [i v] by (1)\n    end\n    set [encoded v] to (join (encoded) [0_])\nend\n\ndefine Read Mob Data (input)\nset [encoded v] to []\nrepeat until <(letter (i) of (input)) = [/]>\n    set [encoded v] to (join (encoded) (letter (i) of (input)))\n    change [i v] by (1)\n    if <(i) > (length of (input))> then\n        stop [this script v]\n    end\nend\nchange [i v] by (1)\n\nwhen I receive [_set sfx volume v]\nset volume to ((100) * (_SOUNDS ON/OFF)) %\n\n@Fade\n\nwhen I receive [_fade in v]\ngo to x: (0) y: (0)\ngo to [front v] layer\nset [ghost v] effect to (0)\nswitch costume to (costume1 v)\nshow\nrepeat (15)\n    change x by (((528) - (x position)) / (8))\n    change [ghost v] effect by (7)\nend\n\nwhen I receive [_fade out v]\ngo to x: (-550) y: (0)\ngo to [front v] layer\nset [ghost v] effect to (100)\nswitch costume to (costume1 v)\nshow\nrepeat (15)\n    change x by (((0) - (x position)) / (6))\n    change [ghost v] effect by (-7)\nend\nclear graphic effects\ngo to x: (0) y: (0)\n\nwhen flag clicked\nhide\n\n@Light\n\nwhen I receive [light tick v]\nif <(init) > [0]> then\n    set [init v] to [0]\n    set [light size v] to (_LIGHT)\nelse\n    change [light size v] by (((_LIGHT) - (light size)) / (4))\nend\nif <(light size) > [99]> then\n    hide\nelse\n    switch costume to (costume2 v)\n    set size to (((light size) * (6)) + (100)) %\n    switch costume to (costume1 v)\n    go to (player v)\n    set [ghost v] effect to (((light size) * (1.2)) - (20))\n    show\nend\n\nwhen flag clicked\nhide\nset [init v] to [1]\n\n@Background\n\nwhen I receive [background particles tick v]\nif <(_GAME LEVEL) < [51]> then\n    if <(id) = []> then\n        if <(pick random (1) to (7)) = [1]> then\n            set [y v] to ((-200) * (_GRAVITY))\n            create clone of (_myself_ v)\n        end\n    else\n        set [color v] effect to (_COLOUR - GLOBAL)\n        change [y v] by ((speed) * (_GRAVITY))\n        set size to ((size) * (_SIZE)) %\n        switch costume to (large v)\n        set y to (y)\n        switch costume to (costume)\n        if <(_GAME LEVEL) > [40]> then\n            set [pixelate v] effect to (pick random (0) to (pick random (0) to (pick random (0) to (pick random (0) to (200)))))\n            switch costume to (spark v)\n        end\n        if <(_GRAVITY) = [1]> then\n            if <(y) > [200]> then\n                delete this clone\n            end\n        else\n            if <(y) < [-200]> then\n                delete this clone\n            end\n        end\n        show\n    end\nelse\n    delete this clone\nend\n\nwhen flag clicked\nset [id v] to []\nhide\n\nwhen I start as a clone\nset [id v] to [1]\nset x to (pick random (-240) to (240))\ngo to [back v] layer\nset [size v] to (pick random (70) to (130))\nset [ghost v] effect to (pick random (40) to (70))\nset [speed v] to (pick random (1.000) to (2.000))\nset [costume v] to [1]\n\ndefine Create First Clones\nrepeat (40)\n    set [y v] to (pick random (-180) to (180))\n    create clone of (_myself_ v)\nend\n\nwhen I receive [__background particles init v]\nCreate First Clones\n\n@Particles\n\ndefine Create Clones\nrepeat (45)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [__game start v]\nset [id v] to []\nCreate Clones\n\nwhen I receive [particle tick v]\nif <(id) > []> then\n    if <(id) = [1]> then\n        // [Explode]\n        switch costume to (large v)\n        change [x v] by ((xv) * (_SIZE))\n        change [y v] by ((yv) * (_SIZE))\n        change [yv v] by (-1.5)\n        Position\n        Fade [6]\n        show\n        switch costume to (explode v)\n    else\n        if <(id) = [2]> then\n            // [Jump]\n            switch costume to (large v)\n            if <(mode) > [0]> then\n                change [mode v] by (-1)\n                Point Towards X (_PLAYER X) Y (_PLAYER Y)\n            end\n            Position\n            Fade [6]\n            show\n            switch costume to (jump v)\n            change size by (-4)\n        else\n            if <(id) = [3]> then\n                // [Doors Unlocked]\n                if <(_KEYS COLLECTED) < (_KEYS TOTAL)> then\n                    set [id v] to []\n                    stop [this script v]\n                end\n                switch costume to (doors unlocked v)\n                show\n                if <(mode) = [1]> then\n                    change y by (((0) - (y position)) / (12))\n                    Fade [-10]\n                    if <([abs v] of ((0) - (y position)) ) < [1]> then\n                        set [mode v] to [2]\n                    end\n                else\n                    if <(mode) = [2]> then\n                        change y by (((80) - (y position)) / (8))\n                        Fade [10]\n                    end\n                end\n            else\n                if <(id) = [4]> then\n                    // [Hat]\n                    switch costume to (large v)\n                    change [y v] by (((yv) * (hat gravity)) * (_SIZE))\n                    if <(yv) < [-10]> then\n                        set [yv v] to [-10]\n                    else\n                        if <(yv) > [10]> then\n                            set [yv v] to [10]\n                        end\n                    end\n                    change [x v] by ((xv) * (_SIZE))\n                    set [xv v] to ((xv) * (0.95))\n                    change [yv v] by (-1)\n                    turn right (xv) degrees\n                    Position\n                    if <(hat gravity) > [0]> then\n                        switch costume to (hat v)\n                    else\n                        switch costume to (hat2 v)\n                    end\n                    show\n                    if <<([abs v] of ((y) - ((_LEVEL Y) * (360))) ) > [200]> or <([abs v] of ((x) - ((_LEVEL X) * (480))) ) > [240]>> then\n                        set [id v] to []\n                    end\n                end\n            end\n        end\n    end\nelse\n    if <(length of [_particle spawns v]) > [0]> then\n        set [x v] to (item (1) of [_particle spawns v])\n        set [y v] to (item (2) of [_particle spawns v])\n        set [id v] to (item (3) of [_particle spawns v])\n        Init Particle\n        delete (1) of [_particle spawns v]\n        delete (1) of [_particle spawns v]\n        delete (1) of [_particle spawns v]\n    end\n    hide\nend\n\ndefine Init Particle\nset [ghost v] to [0]\npoint in direction (90)\ngo to [front v] layer\nclear graphic effects\nif <(id) = [1]> then\n    set [xv v] to (pick random (-6.000) to (6.000))\n    set [yv v] to (pick random (-4) to (15))\n    set size to ((pick random (60) to (100)) * (_SIZE)) %\nelse\n    if <(id) = [2]> then\n        set [mode v] to [2]\n        set rotation style [all around v]\n        set size to ((100) * (_SIZE)) %\n    else\n        if <(id) = [3]> then\n            set size to (100) %\n            set [mode v] to [1]\n            set [ghost v] to [100]\n            go to x: (0) y: (-80)\n        else\n            if <(id) = [4]> then\n                set [ghost v] to [0]\n                set size to ((100) * (_SIZE)) %\n                set [yv v] to [10]\n                set [xv v] to (_PLAYER XV)\n                set [hat gravity v] to (_GRAVITY)\n            end\n        end\n    end\nend\n\ndefine Fade (speed)\nchange [ghost v] by (speed)\nset [ghost v] effect to (ghost)\nif <(ghost) > [99]> then\n    set [id v] to []\nelse\n    if <(ghost) < [0]> then\n        set [ghost v] to [0]\n    end\nend\n\nwhen I receive [_delete particles v]\nset [id v] to []\n\nwhen flag clicked\nhide\n\ndefine // (comment)\n\ndefine Position\ngo to x: (((round (x)) - ((_LEVEL X) * (480))) + (round (_LEVEL SHAKE X))) y: (((round (y)) - ((_LEVEL Y) * (360))) + (round (_LEVEL SHAKE Y)))\n\ndefine Point Towards X (x) Y (y)\npoint in direction (([atan v] of (((x) - (x)) / ((y) - (y))) ) + ((180) * <(y) > (y)>))\n\n@Door\n\nwhen flag clicked\nset size to (101) %\nhide\n\nwhen I receive [position level v]\ngo to x: (round (_LEVEL SHAKE X)) y: (round (_LEVEL SHAKE Y))\n\nwhen I receive [_door v]\nif <(_KEYS TOTAL) > [0]> then\n    set [level v] to (_GAME LEVEL)\n    wait until <not <(_KEYS COLLECTED) < (_KEYS TOTAL)>>\n    if <not <(_GAME LEVEL) = (level)>> then\n        stop [this script v]\n    end\n    wait (0.1) seconds\n    if <not <(_KEYS COLLECTED) < (_KEYS TOTAL)>> then\n        Particle | X: [0] Y: [0] Id: [3]\n        start sound [Door Unlocking v]\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        hide\n    end\nend\n\nwhen I receive [__render level v]\nif <not <(_KEYS COLLECTED) < (_KEYS TOTAL)>> then\n    hide\nelse\n    set [costume v] to (join (join [Level_] (_GAME LEVEL)) (join (join [ x] (_LEVEL X)) (join [ y] (_LEVEL Y))))\n    switch costume to (costume)\n    if <(costume [name v]) = (costume)> then\n        show\n        clear graphic effects\n        go to x: (round (_LEVEL SHAKE X)) y: (round (_LEVEL SHAKE Y))\n    else\n        hide\n    end\nend\n\ndefine Particle | X: (x) Y: (y) Id: (id)\nadd (x) to [_particle spawns v]\nadd (y) to [_particle spawns v]\nadd (id) to [_particle spawns v]\n\n@Save/Load\n\ndefine Save Level Data\nrepeat until <not <(length of [_save codes v]) < (_GAME LEVEL)>>\n    add [] to [_save codes v]\nend\nreplace item (_GAME LEVEL) of [_save codes v] with (encoded)\n\ndefine Encode Mob Data\nset [encoded v] to []\nset [i v] to [1]\nrepeat (length of [_mob data v])\n    set [encoded v] to (join (encoded) (join (item (i) of [_mob data v]) [_]))\n    change [i v] by (1)\nend\n\nwhen I receive [_save mob level v]\ndelete all of [_mob data v]\nbroadcast (RECORD MOB DATA v) and wait\nEncode Mob Data\nset [encoded v] to (join (join (join (join (join (_SIZE) [_]) (join (_COLOUR - GLOBAL) [_])) (join (_MUSIC) [_])) [|]) (encoded))\nSave Level Data\n\nwhen I receive [_load level v]\nset [i v] to [1]\nRead Data (item (_GAME LEVEL) of [_save codes v])\nset [_size v] to (encoded)\nRead Data (item (_GAME LEVEL) of [_save codes v])\nset [_colour - global v] to (encoded)\nRead Data (item (_GAME LEVEL) of [_save codes v])\nset [_music v] to (encoded)\nbroadcast (_LOAD MOB LEVEL v) and wait\n\ndefine Read Data (input)\nset [encoded v] to []\nrepeat until <(letter (i) of (input)) = [_]>\n    set [encoded v] to (join (encoded) (letter (i) of (input)))\n    change [i v] by (1)\n    if <(i) > (length of (input))> then\n        stop [this script v]\n    end\nend\nchange [i v] by (1)\n\n@Music\n\nwhen I receive [__music update v]\nset volume to ((70) * (_MUSIC ON/OFF)) %\nif <(_MUSIC) = []> then\n    stop all sounds\n    stop [this script v]\nend\nif <not <(music) = (_MUSIC)>> then\n    if <(music) > []> then\n        repeat (20)\n            change volume by (-3.5)\n        end\n        wait (1) seconds\n    end\n    set [music v] to (_MUSIC)\n    stop all sounds\nend\n\nwhen flag clicked\nset [music v] to []\nforever\n    if <(music) > [0]> then\n        set volume to ((70) * (_MUSIC ON/OFF)) %\n        play sound (music) until done\n    end\nend\n\n@Text Engine\n\ndefine Write Text (text) At X: (x) Y: (y) | Width: (width) Size: (size) Colour: (clr) Brightness: (bright)\nset [text i v] to [1]\nset [x v] to (x)\nset [y v] to (y)\nset size to (size) %\nset [color v] effect to (clr)\nset [brightness v] effect to (bright)\nforever\n    Position\n    set [new i v] to (text i)\n    repeat until <<(letter (new i) of (text)) = [ ]> or <(new i) > (length of (text))>>\n        set [id v] to (letter (new i) of (text))\n        switch costume to (id)\n        change x by (((item (costume [number v]) of [letter width v]) - (1)) * ((size) / (100)))\n        change [new i v] by (1)\n    end\n    if <(x position) > ((x) + (width))> then\n        set [x v] to (x)\n        change [y v] by ((-22) * ((size) / (100)))\n    end\n    repeat until <(letter (text i) of (text)) = [ ]>\n        Position\n        set [id v] to (letter (text i) of (text))\n        if <<(x position) > ((x) + ((width) + (30)))> or <(id) = [|]>> then\n            set [x v] to (x)\n            change [y v] by ((-22) * ((size) / (100)))\n        end\n        if <not <(id) = [|]>> then\n            create clone of (_myself_ v)\n            switch costume to (id)\n            change [x v] by (((item (costume [number v]) of [letter width v]) - (1)) * ((size) / (100)))\n        end\n        change [text i v] by (1)\n        if <(text i) > (length of (text))> then\n            set [id v] to []\n            stop [this script v]\n        end\n    end\n    change [x v] by (((item (length of [letter width v]) of [letter width v]) - (1)) * ((size) / (100)))\n    change [text i v] by (1)\n    if <(text i) > (length of (text))> then\n        set [id v] to []\n        stop [this script v]\n    end\nend\n\nwhen I start as a clone\nswitch costume to (id)\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\nPosition\nchange y by (-50)\n\nwhen I receive [_delete text v]\nset [frame v] to [0]\nset [ghost v] to [100]\nhide\ndelete this clone\n\ndefine Position\ngo to x: (x) y: (y)\n\nwhen I receive [text animate v]\nif <(id) > []> then\n    if <(length of [_text to write v]) > [0]> then\n        delete this clone\n    end\n    if <(text i) > [0]> then\n        change [text i v] by (-3)\n    else\n        change [ghost v] effect by (-10)\n        change y by (((y) - (y position)) / (8))\n    end\nelse\n    if <(length of [_text to write v]) > [0]> then\n        if <(item (1) of [_text to write v]) > []> then\n            clear graphic effects\n            go to [front v] layer\n            if <(_GAME LEVEL) < [51]> then\n                Write Text (item (1) of [_text to write v]) At X: [-130] Y: [135] | Width: [260] Size: [100] Colour: [130] Brightness: [100]\n            else\n                Write Text (item (1) of [_text to write v]) At X: [-130] Y: [135] | Width: [260] Size: [100] Colour: [130] Brightness: [-100]\n            end\n            start sound [Low Whoosh v]\n            go to x: (0) y: (10)\n            if <(frame) = [0]> then\n                set [frame v] to [1]\n                set [ghost v] to [100]\n            end\n        else\n            set [frame v] to [0]\n        end\n        delete all of [_text to write v]\n    end\n    if <(frame) > [0]> then\n        if <(_GAME LEVEL) < [51]> then\n            switch costume to (frame v)\n        else\n            if <(_GAME LEVEL) = [52]> then\n                switch costume to (frame3 v)\n            else\n                switch costume to (frame2 v)\n            end\n        end\n        set [brightness v] effect to (0)\n        set [color v] effect to (0)\n        set x to (0)\n        change [ghost v] by (((5) - (ghost)) / (8))\n        set [ghost v] effect to (ghost)\n        change y by (((([sin v] of ((timer) * (120)) ) * (4)) - (y position)) / (8))\n        show\n    else\n        if <(ghost) < [99]> then\n            change [ghost v] by (((100) - (ghost)) / (4))\n            change y by (((-50) - (y position)) / (4))\n            set [ghost v] effect to (ghost)\n            show\n        else\n            hide\n        end\n    end\nend\n\nwhen flag clicked\nset [id v] to []\nset [text i v] to [0]\nset [ghost v] to [100]\nhide\n\nwhen I receive [__game start v]\nset volume to ((100) * (_SOUNDS ON/OFF)) %\n\n@Controls\n\nwhen I receive [control tick v]\nif <(id) > []> then\n    delete all of [_controls v]\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        add [Right] to [_controls v]\n    else\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            add [Left] to [_controls v]\n        end\n    end\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        add [Up] to [_controls v]\n    else\n        if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n            add [Down] to [_controls v]\n        end\n    end\n    if <(__IS MOBILE?) > [0]> then\n        go to [front v] layer\n        show\n        if <(_GAME MODE) = [2]> then\n            hide\n        else\n            set [ghost v] effect to (15)\n            if <(grabbed?) = [0]> then\n                change x by ((([x position v] of [controls v]) - (x position)) / (2))\n                change y by ((([y position v] of [controls v]) - (y position)) / (2))\n                if <<(distance to [mouse-pointer v]) < ((15) * ((size) / (100)))> and <<(mouse down) = [0]> and <mouse down?>>> then\n                    set [grabbed? v] to [1]\n                end\n                switch costume to (idle v)\n            else\n                switch costume to (grabbed v)\n                go to (mouse-pointer v)\n                if <(distance to [controls v]) > ((27) * ((size) / (100)))> then\n                    go to (controls v)\n                    point towards (mouse-pointer v)\n                    move ((27) * ((size) / (100))) steps\n                    go to x: (round (x position)) y: (round (y position))\n                end\n                set [stick x v] to ((x position) - ([x position v] of [controls v]))\n                set [stick y v] to ((y position) - ([y position v] of [controls v]))\n                if <(stick x) > [7]> then\n                    add [Right] to [_controls v]\n                else\n                    if <(stick x) < [-7]> then\n                        add [Left] to [_controls v]\n                    end\n                end\n                if <(stick y) > [9]> then\n                    add [Up] to [_controls v]\n                else\n                    if <(stick y) < [-9]> then\n                        add [Down] to [_controls v]\n                    end\n                end\n                if <not <mouse down?>> then\n                    set [grabbed? v] to [0]\n                end\n            end\n            if <mouse down?> then\n                set [mouse down v] to [1]\n            else\n                set [mouse down v] to [0]\n            end\n        end\n    else\n        hide\n    end\nelse\n    go to x: (_JOYSTICK X) y: (-110)\n    if <(__IS MOBILE?) > [0]> then\n        if <(_GAME MODE) = [2]> then\n            hide\n        else\n            if <(_GAME LEVEL) < [51]> then\n                set [color v] effect to (_COLOUR - GLOBAL)\n                switch costume to (base v)\n            else\n                set [color v] effect to (0)\n                switch costume to (base2 v)\n            end\n            set [ghost v] effect to (70)\n            go to [front v] layer\n            go [backward v] (1) layers\n            show\n        end\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nhide\nset size to (150) %\nset [grabbed? v] to [0]\nset [mouse down v] to [0]\nset [id v] to [1]\ncreate clone of (_myself_ v)\nset [id v] to []\n\n@Main Menu\n\nwhen flag clicked\nbroadcast (__BACKGROUND PARTICLES INIT v)\nbroadcast (__MAIN MENU v) and wait\n\nwhen I receive [@menu buttons tick v]\nif <(id) > []> then\n    show\n    if <(id) < [6]> then\n        Page 0 Tick\n        change size by (((size) - (size)) / (8))\n    else\n        if <(id) < [10]> then\n            Page 1 Tick\n            set size to (size) %\n        else\n            if <<(id) > [9]> and <(id) < [15]>> then\n                Position\n                switch costume to ((17) + ((id) - (9)))\n                if <touching (mouse-pointer v)?> then\n                    set size to (110) %\n                else\n                    set size to (101) %\n                end\n                Get Is Clicked\n                if <(is clicked) > [0]> then\n                    set [_game level v] to ((((id) - (9)) * (10)) - (9))\n                    set [_exit v] to [1]\n                end\n            else\n                if <(id) = [15]> then\n                    switch costume to (credits v)\n                    Position\n                end\n            end\n        end\n    end\nelse\n    if <(_MENU PAGE) > [0]> then\n        go to x: (-205) y: (150)\n        switch costume to (back v)\n        show\n        if <touching (mouse-pointer v)?> then\n            set size to (110) %\n        else\n            set size to (100) %\n        end\n        set [is clicked v] to [0]\n        if <<touching (mouse-pointer v)?> and <<mouse down?> and <(mouse down) = [0]>>> then\n            set [_menu page v] to [0]\n        end\n    else\n        hide\n    end\n    if <mouse down?> then\n        set [mouse down v] to [1]\n    else\n        set [mouse down v] to [0]\n    end\n    change [_menu scroll x v] by ((((_MENU PAGE) * (480)) - (_MENU SCROLL X)) / (8))\nend\n\nwhen I receive [_delete menu v]\nhide\ndelete this clone\n\nwhen I receive [__main menu v]\nset [_exit v] to [0]\nset [_music on/off v] to [1]\nset [_sounds on/off v] to [1]\nset [_colour - global v] to (pick random (20) to (180))\nset [_game level v] to [1]\nset [_size v] to [1]\nset [_music v] to [1]\nset [_menu scroll x v] to [0]\nset [_menu page v] to [0]\nset [is clicked v] to [0]\nset [_joystick x v] to [170]\nset [__speedrun time display v] to [0'00]\nset [_timer on/off v] to [0]\nhide variable [__speedrun time display v]\nCreate Menu Clones\nbroadcast (__MUSIC UPDATE v)\nhide\nrepeat until <(_EXIT) > [0]>\n    broadcast (@Menu Buttons Tick v)\n    broadcast (Background Particles Tick v)\nend\nbroadcast (_SET SFX VOLUME v) and wait\nbroadcast (_FADE OUT v)\nrepeat (15)\n    broadcast (@Menu Fade Tick v)\n    broadcast (Background Particles Tick v)\nend\nbroadcast (_DELETE MENU v) and wait\nbroadcast (__GAME START v) and wait\n\ndefine Create Menu Clones\n// [Play Button]\nMenu Object | X: [-110] Y: [0] Id: [1] Page: [0]\n// [Logo]\nMenu Object | X: [0] Y: [0] Id: [2] Page: [0]\n// [Settings]\nMenu Object | X: [-110] Y: [-90] Id: [3] Page: [0]\n// [Select Level]\nMenu Object | X: [110] Y: [0] Id: [4] Page: [0]\n// [Credits]\nMenu Object | X: [110] Y: [-90] Id: [5] Page: [0]\n// [Music On/Off]\nMenu Object | X: [-110] Y: [30] Id: [6] Page: [1]\n// [Music On/Off]\nMenu Object | X: [-110] Y: [-60] Id: [7] Page: [1]\n// [Mobile Left/Right]\nMenu Object | X: [110] Y: [20] Id: [8] Page: [1]\n// [Timer On/off]\nMenu Object | X: [110] Y: [-90] Id: [9] Page: [1]\n// [Level Select]\nMenu Object | X: [-190] Y: [-10] Id: [10] Page: [2]\nMenu Object | X: [-95] Y: [-10] Id: [11] Page: [2]\nMenu Object | X: [0] Y: [-10] Id: [12] Page: [2]\nMenu Object | X: [95] Y: [-10] Id: [13] Page: [2]\nMenu Object | X: [190] Y: [-10] Id: [14] Page: [2]\nMenu Object | X: [0] Y: [0] Id: [15] Page: [3]\n\ndefine Get Is Clicked\nclear graphic effects\nif <([floor v] of (((x) + (240)) / (480)) ) = (_MENU PAGE)> then\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (15)\n    end\n    set [is clicked v] to [0]\n    if <<touching (mouse-pointer v)?> and <<mouse down?> and <(mouse down) = [0]>>> then\n        start sound [Wood Tap v]\n        set [is clicked v] to [1]\n    end\nend\nif <mouse down?> then\n    set [mouse down v] to [1]\nelse\n    set [mouse down v] to [0]\nend\n\ndefine // (comment)\n\ndefine Position\ngo to x: ((x) - (_MENU SCROLL X)) y: (y)\n\ndefine Menu Object | X: (x) Y: (y) Id: (id) Page: (page)\nset [size v] to [101]\nset [x v] to ((x) + ((480) * (page)))\nset [y v] to (y)\nset [id v] to (id)\nif <(id) < [6]> then\n    set size to (0) %\nelse\n    set size to (size) %\nend\ncreate clone of (_myself_ v)\nset [id v] to []\n\ndefine Button Effects\nset [color v] effect to (_COLOUR - GLOBAL)\nif <(pick random (1) to (20)) = [1]> then\n    set [pixelate v] effect to (pick random (8) to (60))\nend\n\ndefine Page 0 Tick\nif <(id) = [1]> then\n    // [Play New Game]\n    switch costume to (play new game v)\n    Position\n    Get Is Clicked\n    if <(is clicked) > [0]> then\n        set [_exit v] to [1]\n    end\n    Button Effects\nelse\n    if <(id) = [2]> then\n        // [Logo]\n        switch costume to (join [Page] (_MENU PAGE))\n        set [x v] to ((_MENU PAGE) * (480))\n        Position\n        change y by (([sin v] of ((timer) * (120)) ) * (7))\n    else\n        if <(id) = [3]> then\n            // [Settings]\n            switch costume to (settings v)\n            Position\n            Get Is Clicked\n            if <(is clicked) > [0]> then\n                set [_menu page v] to [1]\n            end\n            Button Effects\n        else\n            if <(id) = [4]> then\n                // [Select Level]\n                switch costume to (select level v)\n                Position\n                Get Is Clicked\n                if <(is clicked) > [0]> then\n                    set [_menu page v] to [2]\n                end\n                Button Effects\n            else\n                if <(id) = [5]> then\n                    // [Credits Button]\n                    switch costume to (credits button v)\n                    Position\n                    Get Is Clicked\n                    if <(is clicked) > [0]> then\n                        set [_menu page v] to [3]\n                    end\n                    Button Effects\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [_set sfx volume v]\nset volume to ((100) * (_SOUNDS ON/OFF)) %\n\ndefine Page 1 Tick\nif <(id) = [6]> then\n    // [Music On/Off]\n    if <(_MUSIC ON/OFF) > [0]> then\n        switch costume to (music on v)\n    else\n        switch costume to (music off v)\n    end\n    Position\n    Get Is Clicked\n    if <(is clicked) > [0]> then\n        if <(_MUSIC ON/OFF) > [0]> then\n            set [_music on/off v] to [0]\n        else\n            set [_music on/off v] to [1]\n        end\n        broadcast (__MUSIC UPDATE v)\n    end\n    Button Effects\nelse\n    if <(id) = [7]> then\n        // [Sounds On/Off]\n        if <(_SOUNDS ON/OFF) > [0]> then\n            switch costume to (sounds on v)\n        else\n            switch costume to (sounds off v)\n        end\n        Position\n        Get Is Clicked\n        if <(is clicked) > [0]> then\n            if <(_SOUNDS ON/OFF) > [0]> then\n                set [_sounds on/off v] to [0]\n            else\n                set [_sounds on/off v] to [1]\n            end\n            broadcast (_SET SFX VOLUME v)\n        end\n        Button Effects\n    else\n        if <(id) = [8]> then\n            // [Mobile Left/Right]\n            if <(_JOYSTICK X) > [0]> then\n                switch costume to (mobile right v)\n            else\n                switch costume to (mobile left v)\n            end\n            Position\n            Get Is Clicked\n            if <(is clicked) > [0]> then\n                if <(_JOYSTICK X) > [0]> then\n                    set [_joystick x v] to [-170]\n                else\n                    set [_joystick x v] to [170]\n                end\n            end\n            Button Effects\n        else\n            if <(id) = [9]> then\n                // [Timer On/Off]\n                if <(_TIMER ON/OFF) > [0]> then\n                    switch costume to (timer on v)\n                else\n                    switch costume to (timer off v)\n                end\n                Position\n                Get Is Clicked\n                if <(is clicked) > [0]> then\n                    if <(_TIMER ON/OFF) > [0]> then\n                        set [_timer on/off v] to [0]\n                    else\n                        set [_timer on/off v] to [1]\n                    end\n                end\n                Button Effects\n            end\n        end\n    end\nend\n\nhide variable [__speedrun time display v]\n\nshow variable [__speedrun time display v]\n\nwhen I receive [@menu fade tick v]\nif <(id) > []> then\n    if <(y) > [0]> then\n        change [y v] by (((300) - (y)) / (12))\n    else\n        change [y v] by (((-300) - (y)) / (12))\n    end\n    Position\n    change [ghost v] effect by (7)\nelse\n    hide\nend\n\n@Z\n\nwhen I receive [particle tick v]\nif <(length of [z coords v]) > [0]> then\n    set [x v] to (item (1) of [z coords v])\n    set [y v] to (item (2) of [z coords v])\n    delete all of [z coords v]\n    Position\n    set size to ((100) * (_SIZE)) %\n    change y by (([sin v] of ((timer) * (120)) ) * ((5) * (_SIZE)))\n    point in direction (90)\n    switch costume to (z or tap v)\n    show\nelse\n    hide\nend\n\ndefine Position\ngo to x: (((round (x)) - ((_LEVEL X) * (480))) + (round (_LEVEL SHAKE X))) y: (((round (y)) - ((_LEVEL Y) * (360))) + (round (_LEVEL SHAKE Y)))\n\nwhen flag clicked\ndelete all of [z coords v]\nhide\n\n@Story\n\nwhen flag clicked\nswitch costume to (slide 1 v)\nset size to (202) %\nhide\n\nwhen I receive [_conclusion v]\nif <(_OUTRO FRAME) > [10]> then\n    switch costume to (slide 5 v)\nelse\n    Switch Costume (costume [name v])\nend\ngo to x: (0) y: (0)\nshow\n\ndefine Switch Costume (costume)\nset [costume v] to (join [Slide ] (_OUTRO FRAME))\nswitch costume to (costume)\nif <(costume [name v]) = (costume)> then\n\n@Timer\n\ndefine Create Clones\nset [type v] to [1]\nset [id v] to [10]\nrepeat (10)\n    create clone of (_myself_ v)\n    change [id v] by (-1)\nend\n\nwhen I receive [animate v]\nif <(id) > []> then\n    Draw\nelse\n    hide\nend\n\nwhen I start as a clone\nDraw\nswitch costume to (costume)\nset size to (101) %\nhide\n\ndefine Draw\nif <(_TIMER ON/OFF) > [0]> then\n    go to x: ((((id) - (1)) * (15)) + (85)) y: (155)\n    set [ghost v] effect to ((100) - (((distance to [player v]) / (2)) + (10)))\n    set [num v] to ((id) - ((10) - (length of (__SPEEDRUN TIME DISPLAY))))\n    if <(num) < [0]> then\n        hide\n    else\n        show\n        if <(num) = [0]> then\n            switch costume to (stopwatch v)\n        else\n            set [costume v] to (letter (num) of (__SPEEDRUN TIME DISPLAY))\n            change size by (((101) - (size)) / (4))\n            if <not <(costume [name v]) = (costume)>> then\n                set size to (150) %\n                switch costume to (costume)\n            end\n        end\n        go to [front v] layer\n    end\nelse\n    hide\nend\n\nwhen I receive [@menu buttons tick v]\nif <(id) > []> then\n    Draw\nelse\n    hide\nend\n\nwhen flag clicked\nset [frame v] to [0]\nCreate Clones\n\n