Colorless: A Platformer - Part 2
@Stage\n\nwhen I receive [changesong v]\nstop [other scripts in stage v]\nbroadcast (soundcheck v)\nbroadcast (backdropcheck v)\nstop all sounds\nif <(Song) = [0]> then\n    play sound [Josh Kramer - Call to Destiny.mp3 v] until done\n    broadcast (changesong v)\nelse\n    if <(Song) = [1]> then\n        play sound [Vexento - My Love v] until done\n        play sound [Vexento - Lights v] until done\n        broadcast (changesong v)\n    else\n        if <(Song) = [2]> then\n            broadcast (TrialBackground v)\n            play sound [Heart of Courage -TSFH v] until done\n            set [song v] to [2]\n            broadcast (changesong v)\n        else\n            play sound [Josh Kramer - Call to Destiny.mp3 v] until done\n            set [song v] to [5]\n            broadcast (changesong v)\n        end\n    end\nend\n\nwhen I receive [soundcheck v]\nforever\n    if <key (m v) pressed?> then\n        wait (0.5) seconds\n        if <not <(volume) = [0]>> then\n            repeat (3)\n                set volume to (0) %\n            end\n        else\n            repeat (3)\n                set volume to (100) %\n            end\n        end\n    end\nend\n\nwhen I receive [backdropcheck v]\nif <(Level) = [1]> then\n    switch backdrop to (snow1 v)\nend\nif <(Level) = [5]> then\n    switch backdrop to (snow2 v)\nend\n\nwhen I receive [start v]\nstop [other scripts in stage v]\nset [song v] to [1]\nbroadcast (changesong v)\nbroadcast (backdropcheck v)\n\nwhen I receive [volup v]\nchange volume by (10)\n\nwhen I receive [story time! v]\nswitch backdrop to (snow1 v)\n\nwhen I receive [cutscenep2 v]\nswitch backdrop to (cave1 v)\nstop all sounds\nstop [other scripts in stage v]\nforever\n    play sound [ Victory.mp3 v] until done\nend\n\nwhen I receive [voldown v]\nchange volume by (-10)\n\nwhen flag clicked\nswitch backdrop to (titlescreen v)\nset volume to (100) %\nbroadcast (soundcheck v)\nbroadcast (changesong v)\nset [song v] to [0]\n\nwhen I receive [soundcheck v]\nforever\n    set [volume v] to (volume)\nend\n\nwhen I receive [victory!!!!! wahooo!!! v]\nstop [other scripts in stage v]\nset [song v] to [5]\nswitch backdrop to (victory v)\nbroadcast (changesong v)\nbroadcast (backdropcheck v)\n\nwhen I receive [trialbuttons v]\nif <not <(Checkpoint#) = [6]>> then\n    switch backdrop to (trialbuttons v)\nend\n\nwhen I receive [trialstart v]\nset [song v] to [2]\nbroadcast (changesong v)\n\nwhen I receive [options menu v]\nswitch backdrop to (titlescreen v)\n\nwhen I receive [next stage v]\nbroadcast (backdropcheck v)\n\nwhen I receive [trialbackground v]\nrepeat until <(Checkpoint#) = [6]>\n    if <(TrialGroundName) = [Trial 1-1]> then\n        switch backdrop to (trial v)\n    else\n        switch backdrop to (trial2 v)\n    end\nend\n\nwhen I receive [trialvictory v]\nswitch backdrop to (snow2 v)\n\nwhen I receive [timecalculate v]\nswitch backdrop to (victory2 v)\n\n@Player\n\nwhen I receive [options menu v]\nhide\n\nwhen I receive [story time! v]\nhide\n\nwhen I receive [start v]\nset size to (60) %\nshow\nClear Velocity\ngo to x: (-183) y: (-104)\n\nwhen I receive [map v]\nset [play v] to [0]\nhide\n\nwhen I receive [title screen v]\nswitch costume to (costume1 v)\ngo to x: (37) y: (60)\nhide\n\nwhen I receive [start v]\nset [play v] to [1]\nforever\n    Move [Ground]\nend\n\nwhen flag clicked\nset [death count: v] to [0]\nset [dead v] to [0]\nhide variable [death count: v]\nhide variable [☁ deaths in world record time: v]\nset [time: v] to [0]\nhide variable [time: v]\nhide variable [☁ world record time: v]\nset [level v] to [0]\nhide variable [world record: v]\nhide variable [endgame deaths: v]\nset [victory v] to [0]\nhide variable [average time v]\nset [skips v] to [0]\nhide\n\nwhen I receive [levelspawn v]\ngo to x: (item (Level) of [respawnposx v]) y: (item (Level) of [respawnposy v])\nClear Velocity\n\ndefine DeathCheck\nforever\n    if <(Play) = [1]> then\n        if <(LDM MODE) = [0]> then\n            if <(Dead) = [1]> then\n                set [brightness v] effect to (50)\n                repeat (10)\n                    change [ghost v] effect by (10)\n                    change [brightness v] effect by (1)\n                end\n                wait (0.2) seconds\n                set [dead v] to [0]\n                set [ghost v] effect to (0)\n                set [brightness v] effect to (0)\n                go to x: (item (Level) of [respawnposx v]) y: (item (Level) of [respawnposy v])\n            end\n        else\n            if <(Dead) = [1]> then\n                wait (0.2) seconds\n                set [dead v] to [0]\n                set [ghost v] effect to (0)\n                set [brightness v] effect to (0)\n                go to x: (item (Level) of [respawnposx v]) y: (item (Level) of [respawnposy v])\n            end\n        end\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <key (z v) pressed?> then\n        if <(Level) = [10]> then\n            broadcast (cutscenep1 v)\n            change [death count: v] by (10)\n            change [skips v] by (1)\n            wait until <not <key (z v) pressed?>>\n        else\n            broadcast (next stage v)\n            change [death count: v] by (10)\n            change [skips v] by (1)\n            broadcast (levelspawn v)\n            wait until <not <key (z v) pressed?>>\n        end\n    end\nend\n\nwhen I receive [start v]\nDeathCheck\n\nwhen I receive [start2 v]\nDeathCheck\n\nwhen I receive [cutscenep2 v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [mapback v]\nset [play v] to [1]\nshow\n\nwhen I receive [start v]\nforever\n    if <key (r v) pressed?> then\n        if <(Dead) = [0]> then\n            Clear Velocity\n            change [death count: v] by (1)\n            set [dead v] to [1]\n            wait (0.25) seconds\n        end\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <(Play) = [1]> then\n        if <<(x position) = [250]> or <(x position) > [250]>> then\n            if <(Level) = [10]> then\n                broadcast (cutscenep1 v)\n                hide\n                go to x: (0) y: (0)\n            else\n                broadcast (next stage v)\n                broadcast (levelspawn v)\n            end\n        end\n        if <(Dead) = [0]> then\n            if <<touching (obstacles v)?> or <<touching (changingground v)?> and <(GroundColor) = [2]>>> then\n                if <(Clones?) = [1]> then\n                    set [xv v] to [0]\n                    set [yv v] to [0]\n                    change [death count: v] by (1)\n                    set [dead v] to [1]\n                end\n            end\n        end\n    end\nend\n\ndefine XPosTrialCheck\nif <<(x position) = [250]> or <(x position) > [250]>> then\n    if <not <(letter (9) of (TrialGroundName)) = [5]>> then\n        broadcast (stageright v)\n        wait (0) seconds\n        go to x: (-180) y: (y position)\n    end\nend\nif <<(x position) = [-192]> or <(x position) < [-192]>> then\n    if <not <(letter (9) of (TrialGroundName)) = [1]>> then\n        broadcast (stageleft v)\n        wait (0) seconds\n        go to x: (240) y: (y position)\n    end\nend\n\ndefine YPosTrialCheck\nif <<(y position) = [200]> or <(y position) > [200]>> then\n    if <not <(letter (7) of (TrialGroundName)) = [3]>> then\n        broadcast (stageup v)\n        wait (0) seconds\n        go to x: (x position) y: (-104)\n    end\nend\nif <<(y position) = [-120]> or <(y position) < [-120]>> then\n    if <not <(letter (7) of (TrialGroundName)) = [1]>> then\n        broadcast (stagedown v)\n        wait (0) seconds\n        go to x: (x position) y: (190)\n    end\nend\n\nwhen I receive [trialstart v]\nforever\n    if <(Play) = [1]> then\n        if <(Dead) = [0]> then\n            XPosTrialCheck\n            YPosTrialCheck\n            if <<touching (trialobstacles v)?> or <<touching (changingground v)?> and <(GroundColor) = [2]>>> then\n                change [death count: v] by (1)\n                set [dead v] to [1]\n                Clear Velocity\n                TrialDeath\n            end\n        end\n    end\nend\n\ndefine Move (ground)\nif <(Play) = [1]> then\n    if <(Dead) = [0]> then\n        if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n            change [xv v] by (1.1)\n            switch costume to (costume1 v)\n        end\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            change [xv v] by (-1.1)\n            switch costume to (costume2 v)\n        end\n        set [xv v] to ((xv) * (0.82))\n        change x by (xv)\n        if <<touching ((ground) v)?> or <<touching (changingground v)?> and <(GroundColor) = [1]>>> then\n            change y by (1)\n            if <<touching ((ground) v)?> or <<touching (changingground v)?> and <(GroundColor) = [1]>>> then\n                change y by (1)\n                if <<touching ((ground) v)?> or <<touching (changingground v)?> and <(GroundColor) = [1]>>> then\n                    change y by (1)\n                    if <<touching ((ground) v)?> or <<touching (changingground v)?> and <(GroundColor) = [1]>>> then\n                        change y by (1)\n                        if <<touching ((ground) v)?> or <<touching (changingground v)?> and <(GroundColor) = [1]>>> then\n                            change y by (1)\n                            if <<touching ((ground) v)?> or <<touching (changingground v)?> and <(GroundColor) = [1]>>> then\n                                change x by ((xv) * (-1))\n                                change y by (-5)\n                            end\n                            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                if <(xv) > [0]> then\n                                    set [xv v] to [-5]\n                                else\n                                    set [xv v] to [5]\n                                end\n                                set [yv v] to [9]\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [yv v] by (-1)\n        change y by (yv)\n        if <<touching ((ground) v)?> or <<touching (changingground v)?> and <(GroundColor) = [1]>>> then\n            change y by ((yv) * (-1))\n            set [yv v] to [0]\n        end\n        change y by (-1)\n        if <<touching ((ground) v)?> or <<touching (changingground v)?> and <(GroundColor) = [1]>>> then\n            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                set [yv v] to [14]\n            end\n        end\n        change y by (1)\n    end\nend\n\ndefine TrialSpawn\ngo to x: (item (Checkpoint#) of [trialspawnx v]) y: (item (Checkpoint#) of [trialspawny v])\n\ndefine TrialDeath\nset [brightness v] effect to (50)\nrepeat (10)\n    change [ghost v] effect by (10)\n    change [brightness v] effect by (1)\nend\nwait (0.2) seconds\nbroadcast (trialspawn v)\nwait (0) seconds\nTrialSpawn\nset [ghost v] effect to (0)\nset [brightness v] effect to (0)\nset [dead v] to [0]\n\nwhen I receive [trialstart v]\ngo to x: (-183) y: (-105)\nshow\nforever\n    TrialMove [TrialGround]\nend\n\ndefine Clear Velocity\nset [yv v] to [0]\nset [xv v] to [0]\n\nwhen I receive [trialstart v]\nforever\n    if <key (r v) pressed?> then\n        if <(Dead) = [0]> then\n            Clear Velocity\n            change [death count: v] by (1)\n            set [dead v] to [1]\n            TrialDeath\n            wait (0.25) seconds\n        end\n    end\nend\n\nbroadcast (trialspawn v)\n\ndefine TrialMove (ground)\nif <(Play) = [1]> then\n    if <(Dead) = [0]> then\n        if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n            change [xv v] by (1.1)\n            switch costume to (costume1 v)\n        end\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            change [xv v] by (-1.1)\n            switch costume to (costume2 v)\n        end\n        set [xv v] to ((xv) * (0.82))\n        change x by (xv)\n        if <<touching ((ground) v)?> or <<<touching (changingground v)?> and <(GroundColor) = [1]>> or <<touching (doors v)?> and <(Doors) = [1]>>>> then\n            change y by (1)\n            if <<touching ((ground) v)?> or <<<touching (changingground v)?> and <(GroundColor) = [1]>> or <<touching (doors v)?> and <(Doors) = [1]>>>> then\n                change y by (1)\n                if <<touching ((ground) v)?> or <<<touching (changingground v)?> and <(GroundColor) = [1]>> or <<touching (doors v)?> and <(Doors) = [1]>>>> then\n                    change y by (1)\n                    if <<touching ((ground) v)?> or <<<touching (changingground v)?> and <(GroundColor) = [1]>> or <<touching (doors v)?> and <(Doors) = [1]>>>> then\n                        change y by (1)\n                        if <<touching ((ground) v)?> or <<<touching (changingground v)?> and <(GroundColor) = [1]>> or <<touching (doors v)?> and <(Doors) = [1]>>>> then\n                            change y by (1)\n                            if <<touching ((ground) v)?> or <<<touching (changingground v)?> and <(GroundColor) = [1]>> or <<touching (doors v)?> and <(Doors) = [1]>>>> then\n                                change x by ((xv) * (-1))\n                                change y by (-5)\n                            end\n                            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                if <(xv) > [0]> then\n                                    set [xv v] to [-5]\n                                else\n                                    set [xv v] to [5]\n                                end\n                                set [yv v] to [9]\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [yv v] by (-1)\n        change y by (yv)\n        if <<touching ((ground) v)?> or <<<touching (changingground v)?> and <(GroundColor) = [1]>> or <<touching (doors v)?> and <(Doors) = [1]>>>> then\n            change y by ((yv) * (-1))\n            set [yv v] to [0]\n        end\n        change y by (-1)\n        if <<touching ((ground) v)?> or <<<touching (changingground v)?> and <(GroundColor) = [1]>> or <<touching (doors v)?> and <(Doors) = [1]>>>> then\n            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                set [yv v] to [14]\n            end\n        end\n        change y by (1)\n    end\nend\n\nwhen I receive [trialstart v]\nif <(Difficulty) = [1]> then\n    forever\n        if <key (z v) pressed?> then\n            if <<<(TrialGroundName) = [Trial 1-3]> and <(Checkpoint#) = [1]>> or <<<(TrialGroundName) = [Trial 2-4]> and <(Checkpoint#) = [2]>> or <<<(TrialGroundName) = [Trial 3-3]> and <(Checkpoint#) = [3]>> or <<<(TrialGroundName) = [Trial 2-1]> and <(Checkpoint#) = [4]>> or <<(TrialGroundName) = [Trial 1-5]> and <(Checkpoint#) = [5]>>>>>> then\n                if <<(TrialGroundName) = [Trial 1-5]> and <(Checkpoint#) = [5]>> then\n                    change [death count: v] by (10)\n                    change [skips v] by (1)\n                    change [checkpoint# v] by (1)\n                    Clear Velocity\n                    broadcast (Endcutscene v)\n                    set [play v] to [0]\n                    wait until <not <key (z v) pressed?>>\n                else\n                    change [death count: v] by (10)\n                    change [skips v] by (1)\n                    change [checkpoint# v] by (1)\n                    Clear Velocity\n                    if <(TrialGroundName) = [Trial 2-1]> then\n                        repeat (2)\n                            replace item (3) of [locked? v] with [0]\n                        end\n                        broadcast (TrialSkip2 v)\n                    else\n                        broadcast (TrialSkip v)\n                    end\n                    wait until <not <key (z v) pressed?>>\n                end\n            else\n                if <(TrialGroundName) = [Trial 1-4]> then\n                    repeat (2)\n                        replace item (1) of [locked? v] with [0]\n                    end\n                end\n                if <(TrialGroundName) = [Trial 2-4]> then\n                    repeat (2)\n                        replace item (2) of [locked? v] with [0]\n                    end\n                end\n                if <(TrialGroundName) = [Trial 2-1]> then\n                    repeat (2)\n                        replace item (3) of [locked? v] with [0]\n                    end\n                end\n                if <<(TrialGroundName) = [Trial 1-3]> and <(Checkpoint#) = [5]>> then\n                    set [checkpoint# v] to [5]\n                end\n                change [death count: v] by (10)\n                change [skips v] by (1)\n                Clear Velocity\n                if <(TrialGroundName) = [Trial 2-1]> then\n                    broadcast (TrialSkip2 v)\n                else\n                    broadcast (TrialSkip v)\n                end\n                wait until <not <key (z v) pressed?>>\n            end\n        end\n    end\nend\n\nwhen I receive [trialbuttons v]\nset [play v] to [0]\nhide\n\nwhen I receive [trialskip v]\nhide\nset [play v] to [0]\nClear Velocity\nrepeat (3)\n    if <<[trialpath2 v] contains (TrialGroundName)?> and <(Checkpoint#) = [5]>> then\n        go to x: (item (item # of (TrialGroundName) in [trialpath2 v]) of [trialskipx2 v]) y: (item (item # of (TrialGroundName) in [trialpath2 v]) of [trialskipy2 v])\n    else\n        go to x: (item (item # of (TrialGroundName) in [trialpath v]) of [trialskipx v]) y: (item (item # of (TrialGroundName) in [trialpath v]) of [trialskipy v])\n    end\nend\nshow\nwait (0.1) seconds\nset [play v] to [1]\n\nwhen I receive [trialskip2 v]\ngo to x: (-173) y: (102)\n\nwhen I receive [trialvictory v]\nhide\n\nwhen I receive [endcutscene v]\nstop [other scripts in sprite v]\n\n@Ground\n\nwhen flag clicked\ngo to x: (-2) y: (-38)\nhide variable [skips v]\nset [level v] to [0]\nhide\n\nwhen I receive [story time! v]\nhide\n\nwhen I receive [timecalculate v]\nif <(Difficulty) = [2]> then\n    change [time: v] by (-50)\nelse\n    if <(Difficulty) = [3]> then\n        change [time: v] by (-100)\n    else\n        if <(Difficulty) = [4]> then\n            change [time: v] by (-250)\n        end\n    end\nend\nif <<(Time:) < (☁ World Record Time:)> and <(Skips) = [0]>> then\n    repeat (3)\n        set [☁ world record time: v] to (Time:)\n        set [☁ deaths in world record time: v] to (Death Count:)\n    end\n    repeat (3)\n        set [world record: v] to (join [Time: ] (join (☁ World Record Time:) (join [  Deaths: ] (☁ Deaths in World Record Time:))))\n    end\nend\nset [☁ completions v] to ((☁ Completions) + (1))\nset [☁ total time v] to ((☁ Total Time) + (Time:))\nset [average time v] to ((☁ Total Time) / (☁ Completions))\nshow variable [time: v]\nshow variable [death count: v]\nshow variable [world record: v]\nshow variable [skips v]\nshow variable [average time v]\n\nwhen I receive [next stage v]\nif <(Level) < [11]> then\n    next costume\n    change [level v] by (1)\nend\nif <<(Level) > [10]> and <not <(Level) = [30]>>> then\n    if <(Level) = [16]> then\n        broadcast (victorycutscene v)\n    else\n        next costume\n        change [level v] by (1)\n        go to x: (-2) y: (-38)\n        broadcast (levelspawn v)\n    end\nend\n\nwhen I receive [start v]\nswitch costume to (level 1 v)\nset [level v] to [1]\nshow\n\nwhen I receive [victory!!!!! wahooo!!! v]\nhide\n\nwhen I receive [start v]\nbroadcast (levelspawn v)\n\nwhen flag clicked\ndelete (all) of [respawnposx v]\nadd [-183] to [respawnposx v]\nadd [-149] to [respawnposx v]\nadd [-187] to [respawnposx v]\nadd [-137] to [respawnposx v]\nadd [-169] to [respawnposx v]\nadd [-172] to [respawnposx v]\nadd [-172] to [respawnposx v]\nadd [-135] to [respawnposx v]\nadd [-136] to [respawnposx v]\nadd [-158] to [respawnposx v]\n\nwhen flag clicked\ndelete (all) of [respawnposy v]\nadd [-105] to [respawnposy v]\nadd [-70] to [respawnposy v]\nadd [93] to [respawnposy v]\nadd [120] to [respawnposy v]\nadd [-101] to [respawnposy v]\nadd [-69] to [respawnposy v]\nadd [-101] to [respawnposy v]\nadd [22] to [respawnposy v]\nadd [22] to [respawnposy v]\nadd [-26] to [respawnposy v]\n\nwhen I receive [cutscenep2 v]\nhide\n\nwhen flag clicked\nforever\n    set [groundcostume v] to (costume [number v])\nend\n\n@Background\n\nwhen flag clicked\ngo to x: (-2) y: (-38)\ngo [backward v] (100) layers\nhide\n\nwhen I receive [story time! v]\nhide\n\nwhen I receive [next stage v]\nif <(Level) < [11]> then\n    next costume\nend\nif <<(Level) > [10]> and <not <(Level) = [30]>>> then\n    if <(Level) = [16]> then\n        hide\n    else\n        next costume\n    end\nend\n\nwhen I receive [start v]\nswitch costume to (level 1 v)\nshow\n\nwhen I receive [start v]\nbroadcast (levelspawn v)\n\nwhen I receive [cutscenep2 v]\nhide\n\n@Obstacles\n\nwhen flag clicked\ngo to x: (-2) y: (-38)\nhide\n\nwhen I receive [story time! v]\nhide\n\nwhen I receive [start v]\nswitch costume to (level 1 v)\nshow\n\nwhen I receive [cutscenep2 v]\nhide\n\nwhen I receive [start v]\nbroadcast (levelspawn v)\n\nwhen I receive [next stage v]\nif <(Level) < [11]> then\n    next costume\nend\nif <<(Level) > [10]> and <not <(Level) = [30]>>> then\n    if <(Level) = [16]> then\n        hide\n    else\n        next costume\n    end\nend\n\nwhen I receive [start2 v]\nshow\ngo to x: (-2) y: (-38)\nswitch costume to (level 13 v)\n\nwhen I receive [next stage v]\ngo to [front v] layer\ngo [backward v] (1) layers\n\n@Foreground\n\nwhen flag clicked\ngo to x: (-2) y: (-38)\nswitch costume to (level 7 v)\nhide\n\nwhen I receive [story time! v]\nhide\n\nwhen I receive [next stage v]\nif <(Level) > [5]> then\n    if <(Level) < [11]> then\n        if <(Level) = [6]> then\n            switch costume to (level 7 v)\n            show\n            go to [front v] layer\n        else\n            show\n            go to [front v] layer\n            next costume\n        end\n    end\n    if <<(Level) > [10]> and <not <(Level) = [30]>>> then\n        go to [front v] layer\n        next costume\n        go to x: (-2) y: (-38)\n    end\nelse\n    hide\nend\n\nwhen I receive [start2 v]\nshow\ngo to x: (-2) y: (-38)\nswitch costume to (level 13 v)\n\nwhen I receive [trialbuttons v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [cutscenep2 v]\nhide\n\nwhen I receive [next stage v]\nforever\n    if <<(Level) > [5]> and <not <(Level) = [10]>>> then\n        go to [front v] layer\n    end\nend\n\n@LevelText\n\nwhen I receive [start v]\nTextCheck\n\nwhen flag clicked\nhide\n\nwhen I receive [cheater!!! v]\nhide\n\nwhen I receive [victory!!!!! wahooo!!! v]\nhide\n\nwhen I receive [start2 v]\nTextCheck\n\nwhen I receive [aboveaverage v]\nswitch costume to (above average v)\nshow\n\nwhen I receive [belowaverage v]\nswitch costume to (below average v)\nshow\n\nwhen I receive [cutscenep2 v]\nstop [other scripts in sprite v]\nhide\n\ndefine TextCheck\nif <(LDM MODE) = [0 ]> then\n    show\n    forever\n        if <(Level) = [ 1 ]> then\n            hide\n            go to x: (217) y: (-26)\n            switch costume to (leveltext1 v)\n            show\n        end\n        if <(Level) = [2]> then\n            hide\n            go to x: (81) y: (-23)\n            switch costume to (leveltext2 v)\n            show\n        end\n        if <(Level) = [3]> then\n            hide\n            go to x: (204) y: (-9)\n            switch costume to (leveltext3 v)\n            show\n        end\n        if <(Level) = [4]> then\n            hide\n            go to x: (20) y: (20)\n            switch costume to (leveltext4 v)\n            show\n        end\n        if <(Level) = [5]> then\n            hide\n            switch costume to (leveltext5 v)\n            go to x: (-2) y: (23)\n            show\n        end\n        if <(Level) = [6]> then\n            hide\n            go to x: (0) y: (10)\n            switch costume to (leveltext6 v)\n            show\n        end\n        if <(Level) = [7]> then\n            hide\n            go to x: (0) y: (0)\n            switch costume to (leveltext7 v)\n            show\n        end\n        if <(Level) = [8]> then\n            hide\n            go to x: (0) y: (5)\n            switch costume to (leveltext8 v)\n            show\n        end\n        if <(Level) = [9]> then\n            hide\n            go to x: (20) y: (7)\n            switch costume to (leveltext9 v)\n            show\n        end\n        if <(Level) = [10]> then\n            hide\n            go to x: (20) y: (20)\n            switch costume to (leveltext10 v)\n            show\n        end\n    end\nend\n\nwhen I receive [sign v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [signback v]\nTextCheck\nshow\n\nwhen I receive [trialstart v]\nforever\n    if <<(TrialGroundName) = [Trial 1-4]> and <(Checkpoint#) = [1]>> then\n        switch costume to (trialtext1 v)\n        show\n    else\n        if <(TrialGroundName) = [Trial 2-1]> then\n            switch costume to (trialtext2 v)\n            show\n        else\n            hide\n        end\n    end\nend\n\nwhen I receive [victory!!!!! wahooo!!! v]\nstop [other scripts in sprite v]\nswitch costume to (endtext v)\nset [ghost v] effect to (100)\ngo to x: (-10) y: (100)\nshow\nwait (2) seconds\nrepeat (20)\n    change [ghost v] effect by (-5)\n    wait (0) seconds\nend\nwait (4) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\n    wait (0) seconds\nend\nwait (1.5) seconds\nswitch costume to (endtext2 v)\nrepeat (20)\n    change [ghost v] effect by (-5)\n    wait (0) seconds\nend\nwait (3) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\n    wait (0) seconds\nend\nwait (1) seconds\nbroadcast (TimeCalculate v)\n\n@StoryText\n\nwhen flag clicked\ngo to x: (6) y: (27)\nset [play v] to [0]\nset [start v] to [0]\nhide\n\nwhen I receive [story time! v]\nshow\nset [story v] to [1]\nswitch costume to (story1 v)\nwait until <key (space v) pressed?>\nnext costume\nchange [story v] by (1)\nwait (0.5) seconds\nwait until <key (space v) pressed?>\nbroadcast (Start v)\nhide\n\n@Map\n\nwhen flag clicked\ngo to x: (-15) y: (3)\nhide\n\nwhen I receive [map v]\ngo to [front v] layer\nshow\nset size to (105) %\n\nwhen I receive [mapback v]\nhide\n\n@MapLocation\n\nwhen flag clicked\nset size to (105) %\nhide\n\nwhen flag clicked\nforever\n    if <<(Level) = [1]> or <<(Level) = [2]> or <(Level) = [3]>>> then\n        go to x: (96) y: (-115)\n    end\n    if <(Level) = [4]> then\n        go to x: (100) y: (-109)\n    end\n    if <(Level) = [5]> then\n        go to x: (105) y: (-98)\n    end\n    if <(Level) = [6]> then\n        go to x: (115) y: (-79)\n    end\n    if <(Level) = [7]> then\n        go to x: (137) y: (-50)\n    end\n    if <(Level) = [8]> then\n        go to x: (146) y: (-46)\n    end\n    if <(Level) = [9]> then\n        go to x: (156) y: (-41)\n    end\n    if <(Level) = [10]> then\n        go to x: (173) y: (-34)\n    end\nend\n\nwhen I receive [mapback v]\nhide\n\nwhen I receive [map v]\nif <(LDM MODE) = [0]> then\n    show\n    repeat (10)\n        go to [front v] layer\n    end\nend\n\nwhen I receive [ldm mode on v]\nstop [other scripts in sprite v]\n\nwhen I receive [trialbuttons v]\nstop [other scripts in sprite v]\n\n@MapButtons\n\nwhen flag clicked\nswitch costume to (mapbutton v)\ngo to x: (195) y: (149)\nset [map v] to [0]\nhide\n\nwhen this sprite clicked\nif <<(Map) = [0]> and <(Sign) = [0]>> then\n    broadcast (Map v)\n    set [map v] to [1]\nelse\n    broadcast (MapBack v)\n    set [map v] to [0]\nend\n\nwhen I receive [cutscenep2 v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [mapback v]\ngo to x: (204) y: (147)\nswitch costume to (mapbutton v)\ngo to [front v] layer\nshow\n\nwhen I receive [map v]\nswitch costume to (back v)\nrepeat (2)\n    go to [front v] layer\nend\n\nwhen I receive [start v]\nshow\nwait (1) seconds\ngo to [front v] layer\n\nwhen I receive [start v]\nforever\n    if <(Map) = [1]> then\n        if <touching (mouse-pointer v)?> then\n            set size to (125) %\n            go to x: (-187) y: (129)\n            wait until <not <touching (mouse-pointer v)?>>\n        else\n            set size to (100) %\n            go to x: (-192) y: (133)\n        end\n    end\nend\n\nwhen I receive [victory!!!!! wahooo!!! v]\nhide\n\n@Menu\n\nwhen flag clicked\nhide\n\nwhen I receive [story time! v]\nstop [other scripts in sprite v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [options menu v]\nstop [other scripts in sprite v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [start2 v]\nwait (1) seconds\nrepeat until <(Level) = [30]>\n    change [time: v] by (1)\n    wait (1) seconds\nend\n\nwhen I receive [title screen v]\nset [menuclone v] to [1]\nwait (1) seconds\nswitch costume to (costume1 v)\ncreate clone of (_myself_ v)\nchange [menuclone v] by (1)\nswitch costume to (costume2 v)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nrepeat until <(Play) = [1]>\n    if <([abs v] of ((mouse y) - ((y position) + (10))) ) < [10]> then\n        set volume to ((Volume) * (0.5)) %\n        start sound [131658__bertrof__game-sound-selection v]\n        wait until <not <([abs v] of ((mouse y) - ((y position) + (10))) ) < [10]>>\n    end\nend\ndelete this clone\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (0)\ngo to x: (-215) y: (-180)\nrepeat until <(Play) = [1]>\n    change y by ((((-85) - ((costume [number v]) * (25))) - (y position)) / (3))\n    if <([abs v] of ((mouse y) - ((y position) + (10))) ) < [10]> then\n        if <mouse down?> then\n            change x by (((-180) - (x position)) / (3))\n            if <(MenuClone) = [1]> then\n                broadcast (Story Time! v)\n            end\n            if <(MenuClone) = [2]> then\n                broadcast (Options Menu v)\n            end\n        else\n            change x by (((-200) - (x position)) / (3))\n        end\n    else\n        change x by (((-220) - (x position)) / (3))\n    end\nend\ndelete this clone\n\nwhen I receive [start v]\nwait (1) seconds\nstop [other scripts in sprite v]\nforever\n    if <(Play) = [1]> then\n        change [time: v] by (1)\n        wait (1) seconds\n    end\nend\n\nwhen I receive [cutscenep1 v]\nset [play v] to [0]\n\nwhen I receive [trialstart v]\nset [play v] to [1]\n\n@UpArrow\n\nwhen I receive [options menu v]\nset [ghost v] effect to (0)\nshow\n\nwhen flag clicked\nset [volume v] to [0]\n\nwhen this sprite clicked\nif <not <(Volume) = [100]>> then\n    broadcast (VolUp v)\nend\n\nwhen flag clicked\ngo to x: (80) y: (-72)\nset size to (80) %\nhide\n\nwhen flag clicked\nset [option menu v] to [0]\n\nwhen I receive [title screen v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen I receive [part1story v]\nhide\n\n@DownArrow\n\nwhen I receive [options menu v]\nset [ghost v] effect to (0)\nshow\n\nwhen flag clicked\ngo to x: (87) y: (-60)\nset size to (79) %\nhide\n\nwhen I receive [title screen v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen this sprite clicked\nif <not <(Volume) = [0]>> then\n    broadcast (VolDown v)\nend\n\nwhen I receive [part1story v]\nhide\n\n@Back\n\nwhen flag clicked\ngo to x: (0) y: (-172)\nset size to (90) %\nhide\n\nwhen I receive [title screen v]\nset [title screen v] to [1]\nset [option menu v] to [0]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen I receive [options menu v]\nset [option menu v] to [1]\nset [ghost v] effect to (0)\nshow\nforever\n    if <<([abs v] of ((mouse y) - ((y position) + (70))) ) < [20]> and <([abs v] of ((mouse x) - (x position)) ) < [40]>> then\n        if <mouse down?> then\n            change size by (((80) - (size)) / (2))\n            broadcast (title screen v)\n        else\n            change size by (((120) - (size)) / (2))\n        end\n    else\n        change size by (((100) - (size)) / (2))\n    end\nend\n\nwhen I receive [part1story v]\nstop [other scripts in sprite v]\nhide\n\n@Volume\n\nwhen flag clicked\nhide\n\nwhen I receive [options menu v]\nset [ghost v] effect to (0)\nshow\ngo to x: (-60) y: (-14)\nrepeat until <(Title Screen) = [1]>\n    if <(Volume) = [100]> then\n        switch costume to (vol100 v)\n    end\n    if <(Volume) = [90]> then\n        switch costume to (vol90 v)\n    end\n    if <(Volume) = [80]> then\n        switch costume to (vol80 v)\n    end\n    if <(Volume) = [70]> then\n        switch costume to (vol70 v)\n    end\n    if <(Volume) = [60]> then\n        switch costume to (vol60 v)\n    end\n    if <(Volume) = [50]> then\n        switch costume to (vol50 v)\n    end\n    if <(Volume) = [40]> then\n        switch costume to (vol40 v)\n    end\n    if <(Volume) = [30]> then\n        switch costume to (vol30 v)\n    end\n    if <(Volume) = [20]> then\n        switch costume to (vol20 v)\n    end\n    if <(Volume) = [10]> then\n        switch costume to (vol10 v)\n    end\n    if <(Volume) = [0]> then\n        switch costume to (vol0 v)\n    end\nend\n\nwhen I receive [title screen v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen I receive [part1story v]\nhide\n\n@LDM Mode\n\nwhen I receive [start v]\nif <(LDM MODE) = [1]> then\n    broadcast (LDM Mode On v)\nend\n\nwhen I receive [part1story v]\nhide\n\nwhen this sprite clicked\nif <(LDM MODE) = [0]> then\n    set [ldm mode v] to [1]\n    switch costume to (ldm on v)\nelse\n    switch costume to (ldm off v)\n    set [ldm mode v] to [0]\nend\n\nwhen I receive [options menu v]\ngo to x: (-35) y: (40)\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\nwhen I receive [title screen v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen flag clicked\nhide\nswitch costume to (ldm off v)\nhide variable [ldm mode v]\nset [ldm mode v] to [0]\n\n@Part1Story\n\nwhen I receive [part1story v]\ngo to x: (-30) y: (0)\nswitch costume to (story1 v)\nswitch backdrop to (snow1 v)\nrepeat until <(costume [number v]) = [11]>\n    wait until <key (space v) pressed?>\n    next costume\n    wait (0.3) seconds\nend\nwait until <key (space v) pressed?>\nbroadcast (options menu v)\nswitch backdrop to (titlescreen v)\n\nwhen this sprite clicked\nbroadcast (Part1Story v)\n\nwhen I receive [options menu v]\ngo to x: (-15) y: (110)\nswitch costume to (part1story v)\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\nwhen I receive [title screen v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen flag clicked\nhide\nswitch costume to (part1story v)\n\n@Cutscene\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset [cutscene2 v] to [0]\ngo to x: (2) y: (-68)\nhide\n\nwhen I receive [trialbuttons v]\nhide\n\nwhen I receive [cutscenep2 v]\nshow\n\nwhen I receive [cutscenep4 v]\nwait (1) seconds\nswitch costume to (costume2 v)\n\nwhen I receive [trialvictory v]\nswitch costume to (costume1 v)\nshow\n\nwhen I receive [victory!!!!! wahooo!!! v]\nhide\n\n@TextCutscene\n\nwhen flag clicked\nswitch costume to (scenetext1 v)\ngo to x: (-76) y: (3)\nhide\nset [cutscene v] to [0]\nset [cutscenetext v] to [0]\n\nwhen I receive [cutscenep2 v]\nset [cutscenetext v] to [1]\nswitch costume to (scenetext1 v)\nshow\n\nwhen I receive [cutscenetext v]\nswitch costume to (scenetext3 v)\nchange [cutscenetext v] by (1)\n\nwhen I receive [trialbuttons v]\nhide\n\nwhen [space v] key pressed\nif <(CutsceneText) = [11]> then\n    broadcast (victorycutscene v)\nelse\n    if <(Cutscene) = [1]> then\n        Text\n    end\nend\nwait until <not <key (space v) pressed?>>\n\ndefine Fade\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\ndefine Reappear\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\ndefine Text\nif <(CutsceneText) = [1]> then\n    Fade\n    change [cutscenetext v] by (1)\n    next costume\n    wait (0.1) seconds\n    Reappear\nelse\n    if <(CutsceneText) = [2]> then\n        broadcast (cutscenep3 v)\n        set [cutscene v] to [0]\n    end\n    if <(CutsceneText) = [3]> then\n        broadcast (cutscenep4 v)\n        set [cutscene v] to [0]\n    end\n    if <<(CutsceneText) > [3]> and <(CutsceneText) < [7]>> then\n        Fade\n        change [cutscenetext v] by (1)\n        next costume\n        wait (0.1) seconds\n        Reappear\n    else\n        if <(CutsceneText) = [7]> then\n            broadcast (cutscenep5 v)\n            set [cutscene v] to [0]\n        end\n        if <<(CutsceneText) = [8]> or <(CutsceneText) = [9]>> then\n            Fade\n            change [cutscenetext v] by (1)\n            next costume\n            wait (0.1) seconds\n            Reappear\n        else\n            if <(CutsceneText) = [10]> then\n                broadcast (cutscenep6 v)\n                set [cutscene v] to [0]\n            end\n        end\n    end\nend\n\nwhen I receive [cutscenetext2 v]\nshow\nswitch costume to (scenetext4 v)\nchange [cutscenetext v] by (1)\n\nwhen I receive [cutscenetext3 v]\nshow\nswitch costume to (scenetext8 v)\nchange [cutscenetext v] by (1)\n\nwhen I receive [trialvictory v]\nset [cutscenetext v] to [11]\nswitch costume to (scenetext11 v)\nshow\n\nwhen I receive [victory!!!!! wahooo!!! v]\nhide\n\n@Fade In/Out\n\nwhen I receive [cutscenep1 v]\nif <(LDM MODE) = [0]> then\n    show\n    Fade\n    wait (2) seconds\n    broadcast (cutscenep2 v)\n    Reappear\n    set [cutscene v] to [1]\nelse\n    set [ghost v] effect to (0)\n    wait (2) seconds\n    broadcast (cutscenep2 v)\n    set [ghost v] effect to (100)\n    set [cutscene v] to [1]\nend\n\nwhen I receive [cutscenep3 v]\nif <(LDM MODE) = [0]> then\n    Fade\n    wait (2) seconds\n    broadcast (cutscenetext v)\n    Reappear\n    set [cutscene v] to [1]\nelse\n    set [ghost v] effect to (0)\n    wait (2) seconds\n    broadcast (cutscenetext v)\n    set [ghost v] effect to (100)\n    set [cutscene v] to [1]\nend\n\nwhen flag clicked\ngo to [front v] layer\ngo to x: (0) y: (0)\nhide\nset [ghost v] effect to (100)\n\ndefine Fade\ngo to [front v] layer\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\ndefine Reappear\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [intro v]\nshow\nFade\nwait (1) seconds\nReappear\nbroadcast (title screen v)\nset [title screen v] to [1]\nhide\n\nwhen I receive [victorycutscene v]\nif <(LDM MODE) = [0]> then\n    go to [front v] layer\n    Fade\n    wait (2) seconds\n    broadcast (victory!!!!! wahooo!!! v)\n    Reappear\nelse\n    set [ghost v] effect to (0)\n    wait (2) seconds\n    broadcast (victory!!!!! wahooo!!! v)\n    set [ghost v] effect to (100)\nend\nforever\n    set [play v] to [0]\nend\n\nwhen I receive [cutscenep4 v]\nif <(LDM MODE) = [0]> then\n    Fade\n    wait (2) seconds\n    broadcast (cutscenetext2 v)\n    go to [front v] layer\n    Reappear\n    set [cutscene v] to [1]\nelse\n    set [ghost v] effect to (0)\n    wait (2) seconds\n    broadcast (cutscenetext2 v)\n    set [ghost v] effect to (100)\n    set [cutscene v] to [1]\nend\n\nwhen I receive [cutscenep6 v]\nif <(LDM MODE) = [0]> then\n    Fade\n    wait (2) seconds\n    broadcast (TrialButtons v)\n    go to [front v] layer\n    Reappear\n    set [cutscene v] to [0]\nelse\n    set [ghost v] effect to (0)\n    wait (2) seconds\n    broadcast (TrialButtons v)\n    set [ghost v] effect to (100)\n    set [cutscene v] to [0]\nend\n\nwhen I receive [cutscenep5 v]\nif <(LDM MODE) = [0]> then\n    Fade\n    wait (2) seconds\n    broadcast (cutscenetext3 v)\n    go to [front v] layer\n    Reappear\n    set [cutscene v] to [1]\nelse\n    set [ghost v] effect to (0)\n    wait (2) seconds\n    broadcast (cutscenetext3 v)\n    set [ghost v] effect to (100)\n    set [cutscene v] to [1]\nend\n\nwhen I receive [endcutscene v]\nif <(LDM MODE) = [0]> then\n    Fade\n    wait (2) seconds\n    broadcast (TrialVictory v)\n    go to [front v] layer\n    Reappear\n    set [cutscene v] to [1]\nelse\n    set [ghost v] effect to (0)\n    wait (2) seconds\n    broadcast (TrialVictory v)\n    set [ghost v] effect to (100)\n    set [cutscene v] to [1]\nend\n\n@Intro\n\nwhen flag clicked\ngo to [front v] layer\ngo to x: (0) y: (0)\nswitch costume to (intro v)\nclear graphic effects\nshow\nwait (2) seconds\nrepeat (10)\n    change [brightness v] effect by (-10)\n    wait (0.01) seconds\nend\nbroadcast (intro v)\nwait (1) seconds\nhide\n\n@Snow\n\nwhen I start as a clone\ngo to x: (pick random (-230) to (182)) y: (180)\nset size to (pick random (40) to (15)) %\nset [y-var v] to (pick random (-3) to (-5))\nif <(LDM) = [0]> then\n    show\n    repeat until <(y position) < [-175]>\n        change y by (y-var)\n    end\nend\ndelete this clone\n\nwhen I receive [cheater!!! v]\nstop [other scripts in sprite v]\n\nwhen I receive [start v]\nforever\n    if <<(Level) = [4]> or <(Level) < [4]>> then\n        if <<(LDM) = [0]> and <(LDM MODE) = [0]>> then\n            create clone of (_myself_ v)\n            wait (0.3) seconds\n        end\n    end\nend\n\nwhen flag clicked\ngo [backward v] (10) layers\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [cutscenep5 v]\nset [ldm v] to [1]\nset [y-var v] to [-40]\nwait (3) seconds\nstop [other scripts in sprite v]\n\nwhen I receive [ldm mode on v]\nforever\n    stop [other scripts in sprite v]\nend\n\n@Ending\n\nwhen I receive [timecalculate v]\nwait (4) seconds\nset [ldm v] to [0]\nforever\n    if <<(LDM) = [0]> and <(LDM MODE) = [0]>> then\n        create clone of (_myself_ v)\n        wait (1) seconds\n    end\nend\n\nwhen I receive [ldm mode on v]\nforever\n    stop [other scripts in sprite v]\nend\n\nwhen I start as a clone\ngo to x: (pick random (-230) to (182)) y: (180)\nset size to (pick random (45) to (20)) %\nswitch costume to (pick random (1) to (2))\nset [y-var v] to (pick random (-3) to (-5))\nif <(LDM) = [0]> then\n    show\n    repeat until <(y position) < [-175]>\n        change y by (y-var)\n    end\nend\ndelete this clone\n\nwhen flag clicked\nset [ldm v] to [0]\nforever\n    if <key (l v) pressed?> then\n        wait (0.1) seconds\n        if <not <(LDM) = [0]>> then\n            repeat (3)\n                set [ldm v] to [0]\n                broadcast (ldmoff v)\n            end\n        else\n            repeat (3)\n                set [ldm v] to [1]\n            end\n        end\n    end\nend\n\nwhen flag clicked\ngo [backward v] (10) layers\ngo to x: (0) y: (0)\nhide\n\n@Stopnail\n\nwhen flag clicked\nset [titlescreen v] to [0]\ngo to x: (0) y: (0)\nforever\n    hide\n    reset timer\nend\n\nwhen [timer v] > (0.1)\nif <(TitleScreen) = [1]> then\n    hide variable [level v]\n    hide variable [trialgroundname v]\n    go to [front v] layer\n    show\nend\n\nwhen I receive [title screen v]\nset [titlescreen v] to [1]\n\n@Signs\n\nwhen flag clicked\nswitch costume to (sign v)\ngo to x: (-113) y: (-130)\nset size to (80) %\nhide\n\nwhen I receive [cutscenep2 v]\nstop [other scripts in sprite v]\n\nwhen I receive [start v]\nforever\n    if <(Level) = [7]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <(Level) = [7]> then\n        if <touching (player v)?> then\n            switch costume to (signtext v)\n            if <key (e v) pressed?> then\n                broadcast (sign v)\n                set [play v] to [0]\n                set [sign v] to [1]\n                wait (0.5) seconds\n                wait until <key (e v) pressed?>\n                broadcast (signback v)\n                set [play v] to [1]\n                set [sign v] to [0]\n                wait until <not <key (e v) pressed?>>\n            end\n        else\n            switch costume to (sign v)\n        end\n    end\nend\n\nwhen I receive [sign v]\ngo to x: (0) y: (15)\nswitch costume to (signpopup v)\ngo to [front v] layer\n\nwhen I receive [signback v]\nswitch costume to (signtext v)\ngo to x: (-112) y: (-130)\n\n@TrialButtons\n\ndefine buttonsound\nif <(Sign) = [0]> then\n    start sound [Suction Cup v]\n    wait (0.1) seconds\nend\n\nwhen I start as a clone\nforever\n    if <(Play) = [1]> then\n        stop [other scripts in sprite v]\n        delete this clone\n    end\nend\n\nwhen I start as a clone\nshow\nif <(costume [number v]) = [1]> then\n    forever\n        if <touching (mouse-pointer v)?> then\n            switch costume to (easy2 v)\n            buttonsound\n            repeat until <not <touching (mouse-pointer v)?>>\n                if <mouse down?> then\n                    set [difficulty v] to [1]\n                    set [dead v] to [0]\n                    broadcast (trialstart v)\n                end\n            end\n        else\n            switch costume to (easy v)\n        end\n    end\nelse\n    if <(costume [number v]) = [3]> then\n        forever\n            if <touching (mouse-pointer v)?> then\n                switch costume to (medium2 v)\n                buttonsound\n                repeat until <not <touching (mouse-pointer v)?>>\n                    if <mouse down?> then\n                        set [difficulty v] to [2]\n                        set [dead v] to [0]\n                        broadcast (trialstart v)\n                    end\n                end\n            else\n                switch costume to (medium v)\n            end\n        end\n    else\n        if <(costume [number v]) = [5]> then\n            forever\n                if <touching (mouse-pointer v)?> then\n                    switch costume to (hard2 v)\n                    buttonsound\n                    repeat until <not <touching (mouse-pointer v)?>>\n                        if <mouse down?> then\n                            set [difficulty v] to [3]\n                            set [dead v] to [0]\n                            broadcast (trialstart v)\n                        end\n                    end\n                else\n                    switch costume to (hard v)\n                end\n            end\n        else\n            forever\n                if <touching (mouse-pointer v)?> then\n                    switch costume to (extreme2 v)\n                    buttonsound\n                    repeat until <not <touching (mouse-pointer v)?>>\n                        if <mouse down?> then\n                            set [dead v] to [0]\n                            set [difficulty v] to [4]\n                            broadcast (trialstart v)\n                        end\n                    end\n                else\n                    switch costume to (extreme v)\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [victory!!!!! wahooo!!! v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [trialstart v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [trialbuttons v]\nif <not <(Checkpoint#) = [6]>> then\n    go to [front v] layer\n    hide\n    go to x: (230) y: (-10)\n    switch costume to (easy v)\n    create clone of (_myself_ v)\n    go to x: (450) y: (-10)\n    switch costume to (medium v)\n    create clone of (_myself_ v)\n    go to x: (230) y: (-100)\n    switch costume to (hard v)\n    create clone of (_myself_ v)\n    go to x: (450) y: (-100)\n    switch costume to (extreme v)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\ngo to x: (-2) y: (-38)\nset volume to (100) %\nset [difficulty v] to [0]\nswitch costume to (easy v)\nclear graphic effects\nset size to (250) %\nhide\n\n@TrialButtons2\n\nwhen I receive [trialstart v]\nhide\n\nwhen I receive [trialstart v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [trialbuttons v]\nif <not <(Checkpoint#) = [6]>> then\n    go to [front v] layer\n    show\n    go to x: (-3) y: (-46)\n    forever\n        if <touching (mouse-pointer v)?> then\n            switch costume to (signpopup v)\n            set [sign v] to [1]\n            go to [front v] layer\n            wait until <not <touching (mouse-pointer v)?>>\n            switch costume to (questions v)\n            set [sign v] to [0]\n        end\n    end\nelse\n    hide\n    stop [this script v]\nend\n\nwhen flag clicked\ngo to x: (-2) y: (-38)\nset volume to (70) %\nset [sign v] to [0]\nswitch costume to (questions v)\nclear graphic effects\nset size to (70) %\nhide\n\n@TrialGround\n\nwhen flag clicked\ndelete (all) of [trialspawny v]\nadd [-106] to [trialspawny v]\nadd [69] to [trialspawny v]\nadd [-105] to [trialspawny v]\nadd [71] to [trialspawny v]\nadd [-2] to [trialspawny v]\n\nwhen flag clicked\nset [checkpoint# v] to [0]\ndelete (all) of [trialspawnx v]\nadd [-183] to [trialspawnx v]\nadd [30] to [trialspawnx v]\nadd [-155] to [trialspawnx v]\nadd [-12] to [trialspawnx v]\nadd [-170] to [trialspawnx v]\n\nwhen I receive [trialstart v]\nforever\n    set [trial l-r # v] to (letter (9) of (costume [name v]))\nend\n\nwhen I receive [trialstart v]\nforever\n    set [trial u-d # v] to (letter (7) of (costume [name v]))\nend\n\nwhen I receive [story time! v]\nhide\n\nwhen I receive [victory!!!!! wahooo!!! v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [cutscenep2 v]\nstop [other scripts in sprite v]\nhide variable [level v]\nhide\n\nwhen I receive [trialspawn v]\nif <(Checkpoint#) = [2]> then\n    switch costume to (trial 1-3 v)\nelse\n    if <(Checkpoint#) = [3]> then\n        switch costume to (trial 2-4 v)\n    else\n        if <(Checkpoint#) = [4]> then\n            switch costume to (trial 3-3 v)\n        else\n            if <(Checkpoint#) = [5]> then\n                switch costume to (trial 2-1 v)\n            else\n                switch costume to (trial 1-1 v)\n            end\n        end\n    end\nend\n\nwhen I receive [trialstart v]\nif <(ShowLevel?) = [1]> then\n    show variable [trialgroundname v]\nend\nforever\n    if <key (t v) pressed?> then\n        if <(ShowLevel?) = [0]> then\n            set [showlevel? v] to [1]\n            show variable [trialgroundname v]\n            wait until <not <key (t v) pressed?>>\n        else\n            set [showlevel? v] to [0]\n            hide variable [trialgroundname v]\n            wait until <not <key (t v) pressed?>>\n        end\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <key (t v) pressed?> then\n        if <(ShowLevel?) = [0]> then\n            set [showlevel? v] to [1]\n            show variable [level v]\n            wait until <not <key (t v) pressed?>>\n        else\n            set [showlevel? v] to [0]\n            hide variable [level v]\n            wait until <not <key (t v) pressed?>>\n        end\n    end\nend\n\nwhen flag clicked\ndelete (all) of [trialpath v]\nadd [Trial 1-2] to [trialpath v]\nadd [Trial 2-2] to [trialpath v]\nadd [Trial 2-3] to [trialpath v]\nadd [Trial 1-3] to [trialpath v]\nadd [Trial 1-4] to [trialpath v]\nadd [Trial 1-5] to [trialpath v]\nadd [Trial 2-5] to [trialpath v]\nadd [Trial 2-4] to [trialpath v]\nadd [Trial 3-5] to [trialpath v]\nadd [Trial 3-4] to [trialpath v]\nadd [Trial 3-3] to [trialpath v]\nadd [Trial 3-2] to [trialpath v]\nadd [Trial 3-1] to [trialpath v]\nadd [Trial 2-1] to [trialpath v]\ndelete all of [trialpath2 v]\nadd [Trial 2-3] to [trialpath2 v]\nadd [Trial 1-3] to [trialpath2 v]\nadd [Trial 1-4] to [trialpath2 v]\nadd [Trial 1-5] to [trialpath2 v]\n\nwhen I receive [trialbuttons v]\nhide\n\nwhen flag clicked\ndelete all of [trialskipx v]\nadd [-147] to [trialskipx v]\nadd [95] to [trialskipx v]\nadd [-169] to [trialskipx v]\nadd [30] to [trialskipx v]\nadd [-158] to [trialskipx v]\nadd [-181] to [trialskipx v]\nadd [-127] to [trialskipx v]\nadd [-155] to [trialskipx v]\nadd [155] to [trialskipx v]\nadd [217] to [trialskipx v]\nadd [225] to [trialskipx v]\nadd [238] to [trialskipx v]\nadd [238] to [trialskipx v]\nadd [233] to [trialskipx v]\ndelete all of [trialskipx2 v]\nadd [-49] to [trialskipx2 v]\nadd [30] to [trialskipx2 v]\nadd [-158] to [trialskipx2 v]\nadd [-181] to [trialskipx2 v]\n\nwhen flag clicked\ndelete all of [trialskipy v]\nadd [-105] to [trialskipy v]\nadd [-104] to [trialskipy v]\nadd [145] to [trialskipy v]\nadd [69] to [trialskipy v]\nadd [-105] to [trialskipy v]\nadd [-85] to [trialskipy v]\nadd [-46] to [trialskipy v]\nadd [-105] to [trialskipy v]\nadd [-93] to [trialskipy v]\nadd [63] to [trialskipy v]\nadd [-41] to [trialskipy v]\nadd [-3] to [trialskipy v]\nadd [23] to [trialskipy v]\nadd [179] to [trialskipy v]\ndelete all of [trialskipy2 v]\nadd [128] to [trialskipy2 v]\nadd [69] to [trialskipy2 v]\nadd [-105] to [trialskipy2 v]\nadd [-85] to [trialskipy2 v]\n\nwhen I receive [trialskip v]\nif <<[trialpath2 v] contains (TrialGroundName)?> and <(Checkpoint#) = [5]>> then\n    switch costume to (item (TrialSkip#2) of [trialpath2 v])\nelse\n    switch costume to (item (TrialSkip#) of [trialpath v])\nend\ngo to x: (-2) y: (-38)\n\nwhen I receive [trialstart v]\nforever\n    if <<[trialpath2 v] contains (TrialGroundName)?> and <(Checkpoint#) = [5]>> then\n        set [trialskip#2 v] to ((item # of (TrialGroundName) in [trialpath2 v]) + (1))\n    else\n        set [trialskip# v] to ((item # of (TrialGroundName) in [trialpath v]) + (1))\n        set [trialskip#2 v] to [0]\n    end\nend\n\nwhen I receive [trialskip2 v]\nswitch costume to (trial 2-2 v)\n\nwhen I receive [trialvictory v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [stageright v]\nswitch costume to (join [Trial ] (join (Trial U-D #) (join [-] ((Trial L-R #) + (1)))))\ngo to x: (-2) y: (-38)\n\nwhen I receive [stageleft v]\nswitch costume to (join [Trial ] (join (Trial U-D #) (join [-] ((Trial L-R #) - (1)))))\ngo to x: (-2) y: (-38)\n\nwhen I receive [stageup v]\nswitch costume to (join [Trial ] (join ((Trial U-D #) + (1)) (join [-] (Trial L-R #))))\ngo to x: (-2) y: (-38)\n\nwhen I receive [stagedown v]\nswitch costume to (join [Trial ] (join ((Trial U-D #) - (1)) (join [-] (Trial L-R #))))\ngo to x: (-2) y: (-38)\n\nwhen I receive [trialstart v]\nbroadcast (trialspawn v)\nforever\n    set [trialgroundname v] to (costume [name v])\nend\n\nwhen I receive [trialstart v]\nset [checkpoint# v] to [1]\nset size to (100) %\nshow\ngo to [front v] layer\nswitch costume to (trial 1-1 v)\nrepeat (3)\n    go to x: (-2) y: (-38)\nend\n\nwhen flag clicked\nhide variable [trialgroundname v]\nset [showlevel? v] to [0]\ngo to x: (-2) y: (-38)\nhide\n\n@TrialObstacles\n\nwhen I receive [trialspawn v]\ngo to x: (-2) y: (-38)\nif <(Checkpoint#) = [2]> then\n    switch costume to (trial 1-3 v)\nelse\n    if <(Checkpoint#) = [3]> then\n        switch costume to (trial 2-4 v)\n    else\n        if <(Checkpoint#) = [4]> then\n            switch costume to (trial 3-3 v)\n        else\n            if <(Checkpoint#) = [5]> then\n                switch costume to (trial 2-1 v)\n            else\n                switch costume to (trial 1-1 v)\n            end\n        end\n    end\nend\n\nwhen I receive [trialstart v]\nforever\n    if <(TrialGroundName) = [Trial 2-3]> then\n        go to [front v] layer\n        go [backward v] (5) layers\n        go to x: (-2) y: (-12)\n    else\n        go to x: (-2) y: (-38)\n    end\nend\n\nwhen I receive [trialstart v]\nif <(length of [deathlist v]) = [0]> then\n    add (Death Count:) to [deathlist v]\nelse\n    replace item (1) of [deathlist v] with (Death Count:)\nend\nif <(length of [deathlist v]) < [2]> then\n    add ((Death Count:) - (item (1) of [deathlist v])) to [deathlist v]\nelse\n    replace item (2) of [deathlist v] with ((Death Count:) - (item (1) of [deathlist v]))\nend\nif <(Difficulty) = [2]> then\n    set [trialdeathmax v] to [50]\nelse\n    if <(Difficulty) = [3]> then\n        set [trialdeathmax v] to [25]\n    else\n        if <(Difficulty) = [4]> then\n            set [trialdeathmax v] to [10]\n        else\n            set [trialdeathmax v] to [0]\n        end\n    end\nend\nwait (1) seconds\nwait until <not <(item (2) of [deathlist v]) = ((Death Count:) - (item (1) of [deathlist v]))>>\nforever\n    if <not <(TrialDeathMax) = [0]>> then\n        if <not <(item (2) of [deathlist v]) < (TrialDeathMax)>> then\n            broadcast (TrialButtons v)\n            if <(length of [deathlist v]) = [3]> then\n                replace item (3) of [deathlist v] with ((item (2) of [deathlist v]) + (item (3) of [deathlist v]))\n            else\n                add (item (2) of [deathlist v]) to [deathlist v]\n            end\n            stop [this script v]\n        end\n    end\nend\n\nwhen I receive [trialstart v]\nforever\n    if <not <(item (2) of [deathlist v]) = ((Death Count:) - (item (1) of [deathlist v]))>> then\n        replace item (2) of [deathlist v] with ((Death Count:) - (item (1) of [deathlist v]))\n    end\nend\n\nwhen I receive [trialbuttons v]\nstop [other scripts in sprite v]\nhide\n\nwhen flag clicked\ndelete all of [deathlist v]\n\nwhen I receive [trialskip v]\nif <<[trialpath2 v] contains (TrialGroundName)?> and <(Checkpoint#) = [5]>> then\n    switch costume to (item (TrialSkip#2) of [trialpath2 v])\nelse\n    switch costume to (item (TrialSkip#) of [trialpath v])\nend\ngo to x: (-2) y: (-38)\n\nwhen I receive [trialskip2 v]\nswitch costume to (trial 2-2 v)\ngo to x: (-2) y: (-38)\n\nwhen I receive [trialvictory v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [stageright v]\nswitch costume to (join [Trial ] (join (Trial U-D #) (join [-] ((Trial L-R #) + (1)))))\ngo to x: (-2) y: (-38)\n\nwhen I receive [stageleft v]\nswitch costume to (join [Trial ] (join (Trial U-D #) (join [-] ((Trial L-R #) - (1)))))\ngo to x: (-2) y: (-38)\n\nwhen I receive [stageup v]\nswitch costume to (join [Trial ] (join ((Trial U-D #) + (1)) (join [-] (Trial L-R #))))\ngo to x: (-2) y: (-38)\n\nwhen I receive [stagedown v]\nswitch costume to (join [Trial ] (join ((Trial U-D #) - (1)) (join [-] (Trial L-R #))))\ngo to x: (-2) y: (-38)\n\nwhen I receive [trialstart v]\nset size to (100) %\nshow\ngo to [front v] layer\nswitch costume to (trial 1-1 v)\nrepeat (3)\n    go to x: (-2) y: (-38)\nend\n\nwhen flag clicked\nset [trialskip# v] to [0]\nset [trialskip#2 v] to [0]\ngo to x: (-2) y: (-38)\nhide\n\n@ChangingGround\n\nwhen I start as a clone\nshow\nforever\n    if <(LDM MODE) = [0]> then\n        if <(size) = [90]> then\n            turn right (4) degrees\n        end\n        if <(size) = [130]> then\n            turn right (3) degrees\n        end\n        if <(size) = [190]> then\n            turn right (2) degrees\n        end\n    end\n    if <(size) = [100]> then\n        if <(CloneID) = [Vertical]> then\n            if <(TrialGroundName) = [Trial 1-2]> then\n                glide (1) secs to x: (-100) y: (-20)\n                wait (0.5) seconds\n                glide (1) secs to x: (-100) y: (-100)\n                wait (0.5) seconds\n            else\n                glide (4) secs to x: (x position) y: (-200)\n                delete this clone\n            end\n        end\n        if <(CloneID) = [Horizontal]> then\n            if <(TrialGroundName) = [Trial 2-2]> then\n                glide (1) secs to x: (-115) y: (50)\n                wait (0.5) seconds\n                glide (1) secs to x: (20) y: (50)\n                wait (0.5) seconds\n            else\n                if <(TrialGroundName) = [Trial 2-3]> then\n                    glide (5) secs to x: (-260) y: (y position)\n                    delete this clone\n                end\n            end\n        end\n        if <(CloneID) = [Disappearing]> then\n            if <(TrialGroundName) = [Trial 2-4]> then\n                if <(costume [number v]) = [1]> then\n                    repeat until <not <(TrialGroundName) = [Trial 2-4]>>\n                        switch costume to (clone1 v)\n                        wait (1.5) seconds\n                        switch costume to (clone3 v)\n                        wait (1.5) seconds\n                    end\n                    delete this clone\n                end\n                if <(costume [number v]) = [5]> then\n                    repeat until <not <(TrialGroundName) = [Trial 2-4]>>\n                        switch costume to (clone5 v)\n                        wait (3) seconds\n                        switch costume to (clone3 v)\n                        wait (3) seconds\n                    end\n                    delete this clone\n                end\n            else\n                if <(TrialGroundName) = [Trial 3-5]> then\n                    if <(costume [number v]) = [5]> then\n                        repeat until <not <(TrialGroundName) = [Trial 3-5]>>\n                            switch costume to (clone5 v)\n                            wait (2) seconds\n                            switch costume to (clone3 v)\n                            wait (2) seconds\n                        end\n                        delete this clone\n                    end\n                    if <(costume [number v]) = [1]> then\n                        repeat until <not <(TrialGroundName) = [Trial 3-5]>>\n                            switch costume to (clone1 v)\n                            wait (2) seconds\n                            switch costume to (clone3 v)\n                            wait (2) seconds\n                        end\n                        delete this clone\n                    end\n                else\n                    if <(TrialGroundName) = [Trial 3-1]> then\n                        if <(costume [number v]) = [4]> then\n                            repeat until <not <(TrialGroundName) = [Trial 3-1]>>\n                                switch costume to (clone4 v)\n                                wait (1.5) seconds\n                                switch costume to (clone3 v)\n                                wait (1.5) seconds\n                            end\n                            delete this clone\n                        else\n                            if <(costume [number v]) = [6]> then\n                                repeat until <not <(TrialGroundName) = [Trial 3-1]>>\n                                    switch costume to (clone6 v)\n                                    wait (1.5) seconds\n                                    switch costume to (clone3 v)\n                                    wait (1.5) seconds\n                                end\n                                delete this clone\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    else\n        if <(CloneID) = [Disappearing]> then\n            if <(TrialGroundName) = [Trial 3-1]> then\n                if <(costume [name v]) = [Blade]> then\n                    repeat until <not <(TrialGroundName) = [Trial 3-1]>>\n                        switch costume to (blade v)\n                        repeat (60)\n                            wait (0.01) seconds\n                            turn right (3) degrees\n                        end\n                        switch costume to (clone3 v)\n                        wait (3) seconds\n                    end\n                    delete this clone\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [story time! v]\nhide\n\nwhen I receive [next stage v]\nhide\nwait (0.1) seconds\nif <(Level) = [2]> then\n    set [clones? v] to [1]\n    switch costume to (clone1 v)\n    go to x: (-57) y: (-10)\n    create clone of (_myself_ v)\n    go to x: (-175) y: (47)\n    create clone of (_myself_ v)\n    go to x: (-40) y: (87)\n    create clone of (_myself_ v)\n    go to x: (183) y: (-24)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [victory!!!!! wahooo!!! v]\nhide\n\nwhen I start as a clone\nif <(Level) = [2]> then\n    wait (0.2) seconds\n    show\n    repeat until <not <(Level) = [2]>>\n        switch costume to (clone1 v)\n        set [groundcolor v] to [1]\n        wait (6) seconds\n        switch costume to (clone2 v)\n        set [groundcolor v] to [2]\n        wait (3) seconds\n    end\nend\n\nwhen flag clicked\nset [clones? v] to [1]\nset [cloneid v] to [0]\nset [groundcolor v] to [1]\nswitch costume to (clone1 v)\nset size to (100) %\nhide\n\nwhen I start as a clone\nif <(Level) = [2]> then\n    wait until <(Level) = [3]>\n    repeat (3)\n        delete this clone\n    end\nend\n\ndefine Set (X,Y)\nhide\ngo to [front v] layer\nset [cloneid v] to [0]\nif <(TrialGroundName) = [Trial 1-1]> then\n    set [groundcolor v] to [2]\n    switch costume to (blade v)\n    point in direction (90)\n    set size to (190) %\n    go to x: (-3) y: (-100)\n    create clone of (_myself_ v)\n    go to x: (195) y: (-80)\n    create clone of (_myself_ v)\nend\nif <(TrialGroundName) = [Trial 1-2]> then\n    set [groundcolor v] to [2]\n    set [cloneid v] to [Vertical]\n    go to x: (-100) y: (-100)\n    switch costume to (clone4 v)\n    point in direction (90)\n    set size to (100) %\n    create clone of (_myself_ v)\nend\nif <(TrialGroundName) = [Trial 1-3]> then\n    set [groundcolor v] to [2]\n    switch costume to (blade v)\n    set size to (130) %\n    point in direction (90)\n    go to x: (-120) y: (100)\n    create clone of (_myself_ v)\n    go to x: (120) y: (100)\n    create clone of (_myself_ v)\nend\nif <(TrialGroundName) = [Trial 1-4]> then\n    set [groundcolor v] to [2]\n    switch costume to (blade v)\n    set size to (190) %\n    point in direction (90)\n    go to x: (9) y: (27)\n    create clone of (_myself_ v)\n    go to x: (21) y: (27)\n    create clone of (_myself_ v)\n    set size to (130) %\n    go to x: (10) y: (-170)\n    create clone of (_myself_ v)\n    go to x: (60) y: (-170)\n    create clone of (_myself_ v)\n    set size to (90) %\n    point in direction (90)\n    go to x: (100) y: (160)\n    create clone of (_myself_ v)\n    go to x: (130) y: (160)\n    create clone of (_myself_ v)\n    go to x: (160) y: (160)\n    create clone of (_myself_ v)\n    go to x: (190) y: (160)\n    create clone of (_myself_ v)\n    go to x: (220) y: (160)\n    create clone of (_myself_ v)\nend\nif <(TrialGroundName) = [Trial 1-5]> then\n    set [groundcolor v] to [2]\n    switch costume to (blade v)\n    set size to (190) %\n    point in direction (90)\n    go to x: (16) y: (-131)\n    create clone of (_myself_ v)\n    go to x: (220) y: (0)\n    create clone of (_myself_ v)\n    set size to (130) %\n    go to x: (230) y: (60)\n    create clone of (_myself_ v)\n    go to x: (230) y: (-60)\n    create clone of (_myself_ v)\n    set size to (90) %\n    go to x: (-5) y: (25)\n    create clone of (_myself_ v)\nend\nif <(TrialGroundName) = [Trial 2-2]> then\n    set [groundcolor v] to [2]\n    set [cloneid v] to [Horizontal]\n    switch costume to (clone2 v)\n    set size to (100) %\n    point in direction (90)\n    go to x: (-115) y: (50)\n    create clone of (_myself_ v)\nend\nif <(TrialGroundName) = [Trial 2-3]> then\n    set [groundcolor v] to [2]\n    switch costume to (blade v)\n    set size to (130) %\n    point in direction (90)\n    go to x: (-200) y: (-105)\n    create clone of (_myself_ v)\n    go to x: (-200) y: (-12)\n    create clone of (_myself_ v)\n    go to x: (200) y: (-105)\n    create clone of (_myself_ v)\n    go to x: (200) y: (-12)\n    create clone of (_myself_ v)\n    set [cloneid v] to [Horizontal]\n    set size to (100) %\n    switch costume to (clone2 v)\n    go to [back v] layer\n    repeat until <not <(TrialGroundName) = [Trial 2-3]>>\n        go to x: (282) y: (46)\n        create clone of (_myself_ v)\n        go to x: (282) y: (-45)\n        create clone of (_myself_ v)\n        go to x: (282) y: (-138)\n        create clone of (_myself_ v)\n        wait (1.5) seconds\n    end\nend\nif <(TrialGroundName) = [Trial 2-4]> then\n    set [cloneid v] to [Disappearing]\n    set [groundcolor v] to [1]\n    set size to (100) %\n    switch costume to (clone1 v)\n    go to x: (-170) y: (-93)\n    create clone of (_myself_ v)\n    switch costume to (clone5 v)\n    go to x: (100) y: (30)\n    create clone of (_myself_ v)\nend\nif <(TrialGroundName) = [Trial 3-1]> then\n    set [cloneid v] to [Disappearing]\n    set [groundcolor v] to [2]\n    set size to (100) %\n    switch costume to (clone4 v)\n    go to x: (60) y: (130)\n    create clone of (_myself_ v)\n    switch costume to (clone6 v)\n    go to x: (-121) y: (100)\n    create clone of (_myself_ v)\n    set size to (190) %\n    switch costume to (blade v)\n    go to x: (130) y: (15)\n    create clone of (_myself_ v)\n    go to x: (-19) y: (-120)\n    create clone of (_myself_ v)\nend\nif <(TrialGroundName) = [Trial 3-2]> then\n    set [cloneid v] to [Vertical]\n    set [groundcolor v] to [2]\n    set size to (100) %\n    switch costume to (clone4 v)\n    go to [back v] layer\n    repeat until <not <(TrialGroundName) = [Trial 3-2]>>\n        go to x: (4) y: (210)\n        create clone of (_myself_ v)\n        go to x: (121) y: (210)\n        create clone of (_myself_ v)\n        go to x: (-110) y: (210)\n        create clone of (_myself_ v)\n        wait (1.6) seconds\n    end\nend\nif <(TrialGroundName) = [Trial 3-4]> then\n    set [groundcolor v] to [2]\n    switch costume to (blade v)\n    set size to (130) %\n    go to x: (76.5) y: (75)\n    create clone of (_myself_ v)\n    go to x: (8) y: (150)\n    create clone of (_myself_ v)\n    go to x: (104) y: (-135)\n    create clone of (_myself_ v)\n    go to x: (165) y: (-125)\n    create clone of (_myself_ v)\nend\nif <(TrialGroundName) = [Trial 3-5]> then\n    set [cloneid v] to [Disappearing]\n    set [groundcolor v] to [1]\n    set size to (100) %\n    switch costume to (clone1 v)\n    go to x: (99) y: (-22)\n    create clone of (_myself_ v)\n    wait (2) seconds\n    if <(TrialGroundName) = [Trial 3-5]> then\n        switch costume to (clone5 v)\n        go to x: (-80) y: (-120)\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I receive [stageleft v]\nClones\n\nwhen I receive [stageright v]\nClones\n\nwhen I receive [stageup v]\nClones\n\nwhen I receive [stagedown v]\nClones\n\nwhen I receive [trialstart v]\nrepeat (3)\n    Clones\nend\n\nwhen I receive [trialspawn v]\nClones\n\ndefine Clones\nset [clones? v] to [0]\nset [cloneid v] to [0]\nwait (0) seconds\nset [clones? v] to [1]\nSet (X,Y)\n\nwhen I start as a clone\nforever\n    if <<(Clones?) = [0]> or <(Play) = [0]>> then\n        delete this clone\n    end\nend\n\nif <(Level) = [9]> then\n    set size to (140) %\n    set [cloneid v] to [1]\n    go to x: (70) y: (0)\n    create clone of (_myself_ v)\n    set [cloneid v] to [2]\n    go to x: (0) y: (0)\n    create clone of (_myself_ v)\n    set [cloneid v] to [3]\n    go to x: (-70) y: (0)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [trialbuttons v]\nset [clones? v] to [0]\nset [cloneid v] to [0]\nhide\n\nwhen I receive [trialskip v]\nset [clones? v] to [0]\nset [cloneid v] to [0]\nwait (0.2) seconds\nset [play v] to [1]\nset [clones? v] to [1]\nSet (X,Y)\n\nwhen I receive [trialskip2 v]\nset [clones? v] to [0]\nset [cloneid v] to [0]\nwait (0.2) seconds\nset [play v] to [1]\nset [clones? v] to [1]\nSet (X,Y)\n\nwhen I receive [trialvictory v]\nset [clones? v] to [0]\nset [cloneid v] to [0]\nhide\n\nwhen I receive [mapback v]\nhide\nwait (0.1) seconds\nif <(Level) = [2]> then\n    set [clones? v] to [1]\n    switch costume to (clone1 v)\n    go to x: (-57) y: (-10)\n    create clone of (_myself_ v)\n    go to x: (-175) y: (47)\n    create clone of (_myself_ v)\n    go to x: (-40) y: (87)\n    create clone of (_myself_ v)\n    go to x: (183) y: (-24)\n    create clone of (_myself_ v)\nend\n\n@TrialBackground\n\nwhen I receive [victory!!!!! wahooo!!! v]\nhide\n\nwhen flag clicked\ngo to x: (-2) y: (-38)\nhide\n\nwhen I receive [trialstart v]\nforever\n    if <(TrialGroundName) = [Trial 2-3]> then\n        switch costume to (trial 2-3 v)\n        go to x: (-2) y: (-38)\n        go to [front v] layer\n        go [backward v] (4) layers\n        show\n    else\n        if <(TrialGroundName) = [Trial 3-2]> then\n            switch costume to (trial 3-2 v)\n            go to x: (-2) y: (0)\n            go to [front v] layer\n            go [backward v] (4) layers\n            show\n        else\n            hide\n        end\n    end\nend\n\nwhen I receive [trialbuttons v]\nstop [other scripts in sprite v]\nhide\n\n@Gems\n\nwhen I receive [trialstart v]\nforever\n    if <(TrialGroundName) = [Trial 1-3]> then\n        if <(Checkpoint#) = [1]> then\n            switch costume to (gem1 v)\n            go to x: (-5) y: (30)\n            show\n        else\n            hide\n        end\n    else\n        if <(TrialGroundName) = [Trial 1-5]> then\n            switch costume to (gem5 v)\n            go to x: (-146) y: (-135)\n            if <(Checkpoint#) = [6]> then\n                hide\n            else\n                show\n            end\n        else\n            if <(TrialGroundName) = [Trial 2-4]> then\n                if <(Checkpoint#) = [2]> then\n                    switch costume to (gem2 v)\n                    go to x: (-190) y: (-80)\n                    show\n                else\n                    hide\n                end\n            else\n                if <(TrialGroundName) = [Trial 3-3]> then\n                    if <(Checkpoint#) = [3]> then\n                        switch costume to (gem3 v)\n                        go to x: (-46) y: (37)\n                        show\n                    else\n                        hide\n                    end\n                else\n                    if <(TrialGroundName) = [Trial 2-1]> then\n                        if <(Checkpoint#) = [4]> then\n                            switch costume to (gem4 v)\n                            go to x: (-205) y: (-40)\n                            show\n                        else\n                            hide\n                        end\n                    else\n                        hide\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Collect\nset [ghost v] effect to (0)\nrepeat (10)\n    change [ghost v] effect by (10)\n    turn right (2) degrees\n    change y by (2)\nend\nturn left (20) degrees\nset [ghost v] effect to (0)\nhide\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset size to (45) %\npoint in direction (90)\nhide\n\nwhen I receive [trialstart v]\nforever\n    if <touching (player v)?> then\n        start sound [Connect v]\n        Collect\n        change [checkpoint# v] by (1)\n        if <(Checkpoint#) = [6]> then\n            broadcast (Endcutscene v)\n            stop [this script v]\n        end\n        wait until <not <touching (player v)?>>\n    end\nend\n\nwhen I receive [trialbuttons v]\nhide\n\nwhen I receive [trialvictory v]\nstop [other scripts in sprite v]\nhide\n\n@Doors\n\ndefine Fade\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\ndefine Appear\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\ndefine Animate\nforever\n    if <(TrialGroundName) = [Trial 1-4]> then\n        set [doors v] to (item (1) of [locked? v])\n        if <(item (1) of [locked? v]) = [1]> then\n            wait until <(item (1) of [locked? v]) = [0]>\n            set [doors v] to (item (1) of [locked? v])\n            Fade\n        end\n        if <(item (1) of [locked? v]) = [0]> then\n            wait until <(item (1) of [locked? v]) = [1]>\n            Appear\n            set [doors v] to (item (1) of [locked? v])\n        end\n    end\nend\n\nwhen I receive [trialbuttons v]\nhide\n\ndefine Set X,Y\nstop [other scripts in sprite v]\nclear graphic effects\nwait (0) seconds\nhide\nif <(TrialGroundName) = [Trial 1-4]> then\n    switch costume to (locked v)\n    go to x: (209) y: (-124)\n    show\n    if <(item (1) of [locked? v]) = [1]> then\n        go to [back v] layer\n    else\n        set [ghost v] effect to (100)\n    end\nelse\n    if <(TrialGroundName) = [Trial 1-5]> then\n        switch costume to (locked2 v)\n        go to x: (-140) y: (-129)\n        show\n        set [doors v] to (item (3) of [locked? v])\n        if <(item (3) of [locked? v]) = [1]> then\n            go to [front v] layer\n        else\n            set [ghost v] effect to (100)\n        end\n    else\n        if <(TrialGroundName) = [Trial 2-5]> then\n            switch costume to (locked3 v)\n            go to x: (0) y: (170)\n            show\n            set [doors v] to (item (2) of [locked? v])\n            if <(item (2) of [locked? v]) = [1]> then\n                go to [front v] layer\n            else\n                set [ghost v] effect to (100)\n            end\n        end\n    end\nend\nAnimate\n\nwhen I receive [stagedown v]\nSet X,Y\nAnimate\n\nwhen I receive [trialspawn v]\nSet X,Y\nAnimate\n\nwhen I receive [stageleft v]\nSet X,Y\nAnimate\n\nwhen I receive [stageright v]\nSet X,Y\nAnimate\n\nwhen I receive [stageup v]\nSet X,Y\nAnimate\n\nwhen I receive [trialskip2 v]\nSet X,Y\nAnimate\n\nwhen I receive [endcutscene v]\nstop [other scripts in sprite v]\nhide\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset size to (100) %\ngo to [back v] layer\nswitch costume to (locked v)\nhide\n\nwhen I receive [trialskip v]\nSet X,Y\nAnimate\n\n@Levers\n\nwhen flag clicked\ndelete all of [locked? v]\nrepeat (3)\n    add [1] to [locked? v]\nend\n\ndefine Animate\nif <(costume [number v]) = [3]> then\n    repeat (5)\n        next costume\n        wait (0.05) seconds\n    end\n    replace item (Lever#) of [locked? v] with [0]\nelse\n    switch costume to (levertext6 v)\n    switch costume to (levertext5 v)\n    wait (0.05) seconds\n    switch costume to (levertext4 v)\n    wait (0.05) seconds\n    switch costume to (levertext3 v)\n    wait (0.05) seconds\n    switch costume to (levertext2 v)\n    wait (0.05) seconds\n    switch costume to (levertext v)\n    replace item (Lever#) of [locked? v] with [1]\nend\n\nwhen I receive [trialstart v]\nforever\n    go to [front v] layer\nend\n\ndefine Epress\nif <key (e v) pressed?> then\n    Animate\nend\n\ndefine Costume\nif <(item (Lever#) of [locked? v]) = [1]> then\n    switch costume to (lever v)\nelse\n    switch costume to (lever2 v)\nend\n\ndefine CostumeTouching\nif <(item (Lever#) of [locked? v]) = [1]> then\n    switch costume to (levertext v)\nelse\n    switch costume to (levertext6 v)\nend\n\nwhen I receive [trialbuttons v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [trialskip v]\nif <(TrialGroundName) = [Trial 1-5]> then\n    replace item (1) of [locked? v] with [0]\nend\nif <(TrialGroundName) = [Trial 3-1]> then\n    replace item (2) of [locked? v] with [0]\nend\nif <(TrialGroundName) = [Trial 2-1]> then\n    replace item (3) of [locked? v] with [0]\nend\n\nwhen I receive [trialskip v]\nSet X,Y\n\nwhen I receive [trialskip2 v]\nSet X,Y\n\ndefine Set X,Y\nwait (0) seconds\nhide\nif <(TrialGroundName) = [Trial 1-4]> then\n    set [lever# v] to [1]\n    switch costume to (lever v)\n    go to [front v] layer\n    go to x: (172) y: (95)\n    show\nelse\n    if <(TrialGroundName) = [Trial 2-4]> then\n        set [lever# v] to [2]\n        switch costume to (lever v)\n        go to [front v] layer\n        go to x: (-44) y: (-15)\n        show\n    else\n        if <(TrialGroundName) = [Trial 2-1]> then\n            set [lever# v] to [3]\n            switch costume to (lever v)\n            go to [front v] layer\n            go to x: (102) y: (-83)\n            show\n        else\n            hide\n        end\n    end\nend\n\nwhen I receive [stagedown v]\nSet X,Y\n\nwhen I receive [trialspawn v]\nSet X,Y\n\nwhen I receive [stageleft v]\nSet X,Y\n\nwhen I receive [stageright v]\nSet X,Y\n\nwhen I receive [stageup v]\nSet X,Y\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset size to (100) %\ngo to [front v] layer\nhide\n\nwhen I receive [trialstart v]\nforever\n    if <touching (player v)?> then\n        if <<(TrialGroundName) = [Trial 1-4]> and <(Checkpoint#) > [1]>> then\n            CostumeTouching\n            Epress\n        end\n        if <<(TrialGroundName) = [Trial 2-4]> and <(Checkpoint#) > [2]>> then\n            CostumeTouching\n            Epress\n        end\n        if <<(TrialGroundName) = [Trial 2-1]> and <(Checkpoint#) > [4]>> then\n            CostumeTouching\n            Epress\n        end\n    else\n        Costume\n    end\nend\n\n@Easter Egg\n\nwhen I receive [trialbuttons v]\nstop [other scripts in sprite v]\nhide\n\nwhen flag clicked\ngo to x: (-184) y: (151)\nset size to (65) %\nhide\n\nwhen I receive [trialstart v]\nforever\n    if <(TrialGroundName) = [Trial 2-2]> then\n        show\n        if <touching (player v)?> then\n            start sound [Crash Cymbal v]\n            wait until <not <touching (player v)?>>\n        end\n    else\n        hide\n    end\nend\n\nwhen I receive [endcutscene v]\nstop [other scripts in sprite v]\nhide\n\n