Dark - A Scrolling Platformer

Instructions: Hey there!\nWelcome to Dark - A Scrolling Platformer. This is my first (real, actually good) platformer so I'm sorry if its a little short.\n-------------------------Controls--------------------------\nUse the arrow keys to move. \nUp arrow to jump. \nDown arrow to crouch.\n\n--------------------------Instructions----------------------\nClues are in the game…\n\n\n\nIf you guys find any glitches or anything please feel free to tell me (:\n\n

@Stage\n\nwhen [m v] key pressed\nset [mouse v] to (join ((mouse x) + (SCROLL X)) (join [, ] ((mouse y) + (SCROLL Y))))\nshow variable [mouse v]\n\nwhen flag clicked\nwait (4) seconds\nforever\n    play sound [Amiga music Turrican II \('The Hero'\) v] until done\nend\n\n@Blank\n\n@Player\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nhide\nwait (4) seconds\nbroadcast (Green flag v) and wait\nbroadcast (Play Game v) and wait\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    Game on\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v) and wait\n    end\n    if <(EXIT) = [win]> then\n        Game - Win\n    else\n        Game - die\n    end\nend\n\ndefine Game on\nswitch costume to (player v)\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [sx v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\ndefine Tick\nif <key (left arrow v) pressed?> then\n    change [sx v] by (-2)\n    broadcast (right v)\nend\nif <key (right arrow v) pressed?> then\n    change [sx v] by (2)\n    broadcast (left v)\nend\nset [sx v] to ((sx) * (0.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    Change Player x by (round (sx))\nend\nif <key (up arrow v) pressed?> then\n    if <(in air) < [4]> then\n        set [sy v] to [16]\n    end\nend\nif <key (down arrow v) pressed?> then\n    if <(in air) > [4]> then\n        set [sy v] to [-16]\n    end\n    switch costume to (duck v)\nend\nif <<key (down arrow v) pressed?> and <key (right arrow v) pressed?>> then\n    switch costume to (duck right v)\n    broadcast (right duck v)\nend\nif <<key (down arrow v) pressed?> and <key (left arrow v) pressed?>> then\n    switch costume to (duck left v)\n    broadcast (left duck v)\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nChange Player y by (sy)\ntest - die\nset [scroll x v] to (x)\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (10)))\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nif <(y) < [-180]> then\n    set [exit v] to [die]\nend\nPosition\n\ndefine Change Player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (platforms v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n        if <(sx) > [0]> then\n        Position\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\ndefine Change Player x by (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platforms v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    if <key (up arrow v) pressed?> then\n        if <(sx) > [0]> then\n            set [sx v] to [-16]\n        else\n            set [sx v] to [16]\n        end\n        set [in air v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <touching (platforms v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\nchange [x v] by (-1)\nchange [x v] by (1)\n\ndefine Game - die\nset [exit v] to []\nplay sound [Crunch v] until done\nrepeat (5)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\nhide\nwait (0.5) seconds\n\ndefine test - die\nif <touching (danger v)?> then\n    set [exit v] to [die]\nend\n\ndefine Game - Win\nrepeat (50)\n    point towards (exit v)\n    turn right (65) degrees\n    move ((distance to [exit v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nhide\nchange [level v] by (1)\nwait (1) seconds\n\nwhen flag clicked\nhide\nwait (4) seconds\nshow\n\nwhen flag clicked\nhide variable [collected v]\n\nwhen I receive [right duck v]\nswitch costume to (duck right v)\n\nwhen I receive [left duck v]\nswitch costume to (duck left v)\n\nchange [sx v] by (-2)\n\nchange [sx v] by (2)\n\nwhen I receive [left v]\nswitch costume to (player right v)\n\nwhen I receive [right v]\nswitch costume to (player left v)\n\nswitch costume to (player left v)\n\nswitch costume to (player left v)\n\n@Platforms\n\nwhen I receive [green flag v]\nshow\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\nelse\n    hide\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at x: [0] y: [330]\n        Clone at x: [400] y: [30]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [0] y: [347]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at x: [340] y: [-80]\n                Clone at x: [275] y: [100]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (level 5 1 v)\n                    Clone at x: [30] y: [370]\n                    Clone at x: [185] y: [300]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (level 6 1 v)\n                        Clone at x: [460] y: [-30]\n                        Clone at x: [580] y: [-20]\n                        Clone at x: [670] y: [-10]\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch costume to (level 7 1 v)\n                            Clone at x: [515] y: [30]\n                            Clone at x: [300] y: [50]\n                        else\n                            if <(LEVEL) = [8]> then\n                                switch costume to (level 8 1 v)\n                                Clone at x: [460] y: [100]\n                                Clone at x: [550] y: [100]\n                                Clone at x: [-350] y: [300]\n                                Clone at x: [-470] y: [460]\n                                Clone at x: [-490] y: [100]\n                            else\n                                if <(LEVEL) = [9]> then\n                                    switch costume to (level 9 1 v)\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen flag clicked\nhide\n\n@Danger\n\nwhen I receive [green flag v]\nshow\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at x: [0] y: [330]\n        Clone at x: [400] y: [30]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [0] y: [330]\n            Clone at x: [0] y: [330]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at x: [0] y: [0]\n                Clone at x: [460] y: [0]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (level 5 1 v)\n                    Clone at x: [30] y: [370]\n                    Clone at x: [280] y: [178]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (level 6 1 v)\n                        Clone at x: [980] y: [-30]\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch costume to (level 7 1 v)\n                            Clone at x: [415] y: [30]\n                            Clone at x: [500] y: [100]\n                        else\n                            if <(LEVEL) = [8]> then\n                                switch costume to (level 8 1 v)\n                                Clone at x: [-] y: [-]\n                                Clone at x: [1100] y: [300]\n                                Clone at x: [-900] y: [600]\n                            else\n                                if <(LEVEL) = [9]> then\n                                    switch costume to (level 9 1 v)\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen flag clicked\nhide\n\n@Effect\n\nwhen flag clicked\nhide\nrepeat (7)\n    wait (0.2) seconds\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nif <(pick random (1) to (2)) = [1]> then\n    forever\n        turn right (1) degrees\n    end\nelse\n    forever\n        turn left (1) degrees\n    end\nend\n\nwhen I start as a clone\nshow\ngo [backward v] (100) layers\nswitch costume to (pick random (1) to (6))\ngo to x: (pick random (-240) to (240)) y: (180)\npoint in direction (pick random (1) to (360))\nrepeat (72)\n    change y by (-5)\nend\ndelete this clone\n\n@Detector\n\nwhen flag clicked\nhide\nset [faved___ v] to [0]\nset [loved__ v] to [0]\nset [clone id v] to [0]\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\nwait until <<(LOVED__) = [1]> and <(FAVED___) = [1]>>\nwait (1) seconds\nshow\ngo to x: (0) y: (50)\nreset timer\nswitch costume to (pick random (1) to (4))\nset [ghost v] effect to (100)\nrepeat until <(timer) > [3.5]>\n    change y by ((y position) / (-15))\n    change [ghost v] effect by (-3)\nend\nreset timer\nrepeat until <(timer) > [3.5]>\n    change y by (((y position) - (-100)) / (-15))\n    change [ghost v] effect by (10)\nend\n\nwhen I start as a clone\nif <(clone id) = [0]> then\n    go to x: (-15) y: (0)\n    set [loved__ v] to [0]\n    switch costume to (love v)\n    forever\n        set [love? v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [loved__ v] to [1]\n        end\n    end\nend\nif <(clone id) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (fave v)\n    set [faved___ v] to [0]\n    forever\n        set [fav v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [faved___ v] to [1]\n        end\n    end\nend\n\n@Collectables\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    change [collected v] by (1)\n    if <(COLLECTED) = (COLLECTED MAX)> then\n        broadcast (Open Portal v)\n    end\n    delete this clone\nend\n\nwhen I receive [setup v]\nhide\nset [collected v] to [0]\nset [collected max v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (dot v)\n    Clone at x: [123] y: [-96]\n    Clone at x: [174] y: [3]\n    Clone at x: [354] y: [-18]\n    Clone at x: [705] y: [-31]\n    Clone at x: [705] y: [36]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (dot v)\n        Clone at x: [-125] y: [-86]\n        Clone at x: [119] y: [14]\n        Clone at x: [-71] y: [93]\n        Clone at x: [-154] y: [283]\n        Clone at x: [24] y: [298]\n        Clone at x: [360] y: [417]\n        Clone at x: [444] y: [539]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (dot v)\n            Clone at x: [187] y: [441]\n            Clone at x: [216] y: [636]\n            Clone at x: [-197] y: [513]\n            Clone at x: [-188] y: [346]\n            Clone at x: [32] y: [520]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (dot v)\n                Clone at x: [-99] y: [37]\n                Clone at x: [60] y: [-83]\n                Clone at x: [303] y: [-147]\n                Clone at x: [709] y: [-66]\n                Clone at x: [442] y: [17]\n                Clone at x: [722] y: [87]\n                Clone at x: [805] y: [177]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (dot v)\n                    Clone at x: [-50] y: [-62]\n                    Clone at x: [115] y: [42]\n                    Clone at x: [49] y: [215]\n                    Clone at x: [182] y: [571]\n                    Clone at x: [117] y: [335]\n                    Clone at x: [53] y: [668]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (dot v)\n                        Clone at x: [-194] y: [-72]\n                        Clone at x: [-2] y: [119]\n                        Clone at x: [538] y: [-90]\n                        Clone at x: [1331] y: [166]\n                        Clone at x: [1000] y: [157]\n                        Clone at x: [1550] y: [55]\n                        Clone at x: [1899] y: [-12]\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch costume to (dot v)\n                            Clone at x: [-82] y: [41]\n                            Clone at x: [590] y: [185]\n                            Clone at x: [748] y: [15]\n                            Clone at x: [939] y: [55]\n                            Clone at x: [1028] y: [266]\n                        else\n                            if <(LEVEL) = [8]> then\n                                switch costume to (dot v)\n                                Clone at x: [-137] y: [143]\n                                Clone at x: [-67] y: [281]\n                                Clone at x: [330] y: [2]\n                                Clone at x: [492] y: [111]\n                                Clone at x: [980] y: [209]\n                                Clone at x: [1158] y: [497]\n                                Clone at x: [1069] y: [622]\n                                Clone at x: [703] y: [496]\n                                Clone at x: [331] y: [1080]\n                                Clone at x: [-73] y: [1315]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nset [x v] to [-99999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nchange [collected max v] by (1)\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nhide\n\n@Exit\n\nwhen I receive [green flag v]\nshow\n\nwhen I receive [setup v]\nhide\nset [collected v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (closed v)\n    Clone at x: [944] y: [-47]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (closed v)\n        Clone at x: [701] y: [535]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (closed v)\n            Clone at x: [304] y: [572]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (closed v)\n                Clone at x: [959] y: [225]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (closed v)\n                    Clone at x: [532] y: [694]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (closed v)\n                        Clone at x: [1983] y: [-74]\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch costume to (closed v)\n                            Clone at x: [432] y: [143]\n                        else\n                            if <(LEVEL) = [8]> then\n                                switch costume to (closed v)\n                                Clone at x: [109] y: [1088]\n                            else\n                                set [x v] to [-99999]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\n\nwhen I receive [open portal v]\nswitch costume to (open v)\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <<(costume [name v]) = [Open]> and <touching (player v)?>> then\n    set [exit v] to [win]\nend\n\nwhen flag clicked\nhide\n\n@Thumbnail \n\nwhen flag clicked\ngo to [front v] layer\nshow\nplay sound [Wand v] until done\n\nwhen flag clicked\nset [ghost v] effect to (0)\nshow\nwait (3) seconds\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nhide\n\n@Sprite1\n\nwhen flag clicked\nset [ghost v] effect to (0)\nshow\nwait (3) seconds\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nhide\n\nwhen flag clicked\ngo to x: (0) y: (140)\n\n@Sprite2\n\nwhen flag clicked\ngo to x: (0) y: (10)\n\nwhen flag clicked\nset [ghost v] effect to (0)\nshow\nwait (3) seconds\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nhide\n\n