Light - Scrolling Platformer

Instructions: Use WAD or the arrow keys to move. Avoid red and collect the orbs to open the portal. Yellow is bouncy. Don't jump from too high up! At the end you have to move the player in the middle of the green area to show your needed time for each levels.\n\n-------You can play in full screen-------

@Stage\n\nwhen flag clicked\nforever\n    play sound [music v] until done\nend\n\nwhen [m v] key pressed\nset [mouse v] to (join ((mouse x) + (ScrollX)) (join [,] ((mouse y) + (ScrollY))))\nshow variable [mouse v]\n\n@Player\n\nwhen flag clicked\nhide\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    Game On\n    broadcast (timer v)\n    repeat until <(Exit) > []>\n        Repeat\n        broadcast (Repeat 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\nset [colletctable? v] to [no]\nset [scrolling done? v] to [no]\nif <(Level) = [2]> then\n    set [x v] to [-50]\nelse\n    if <(Level) = [5]> then\n        set [x v] to [48]\n    else\n        set [x v] to [0]\n    end\nend\nset [y v] to [80]\nset [v y v] to [0]\nset [in air v] to [0]\nset [exit v] to []\npoint in direction (90)\nset size to (90) %\nset [ghost v] effect to (0)\nshow\n\ndefine Repeat\nbroadcast (Go To Palyer v)\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    Change x [8]\nend\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    Change x [-8]\nend\nif <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n    if <(In Air) < [4]> then\n        if <not <touching (bouncy stuff v)?>> then\n            set [v y v] to [16]\n        end\n    end\nend\nif <touching (bouncy stuff v)?> then\n    set [v y v] to [30]\nend\nchange [v y v] by (-2)\nGravity (V y)\nTouching - Die\nchange [scrollx v] by (round (((x) - (ScrollX)) / (3)))\nif <(ScrollX) < [-90]> then\n    set [scrollx v] to [-90]\nend\nCheck - Scrolling\nif <(Scrolling done?) = [yes]> then\n    change [scrolly v] by (round (((y) - (ScrollY)) / (10)))\nelse\n    set [scrolly v] to (y)\nend\nif <(ScrollY) < [0]> then\n    set [scrolly v] to [0]\nend\nPosition\nif <(y) < [-180]> then\n    set [exit v] to [die]\nend\nif <(Level) = [5]> then\n    if <<(ScrollY) < [10]> and <<(ScrollX) > [38]> and <(ScrollX) < [52]>>> then\n        show variable [l1 time v]\n        show variable [l2 time v]\n        show variable [l3 time v]\n        show variable [l4 time v]\n    else\n        hide variable [l1 time v]\n        hide variable [l2 time v]\n        hide variable [l3 time v]\n        hide variable [l4 time v]\n    end\nelse\n    hide variable [l1 time v]\n    hide variable [l2 time v]\n    hide variable [l3 time v]\n    hide variable [l4 time v]\nend\n\ndefine Gravity (y speed)\nchange [y v] by (y speed)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (platforms v)?>>\n    if <(y speed) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    Position\n    set [v y v] to [0]\nend\n\ndefine Position\ngo to x: ((x) - (ScrollX)) y: ((y) - (ScrollY))\n\ndefine Change x (x speed)\nchange [x v] by (x speed)\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    repeat until <not <touching (platforms v)?>>\n        if <(x speed) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\ndefine Game - Die\nset [exit v] to []\nstart sound [Crunch v]\nrepeat (3)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\nhide\nwait (0.3) seconds\n\ndefine Touching - Die\nif <touching (red v)?> then\n    set [exit v] to [die]\nend\n\ndefine Game - Win\nbroadcast (Win v)\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 (0.5) seconds\n\ndefine Check - Scrolling\nif <(ScrollY) = [0]> then\n    set [scrolling done? v] to [yes]\n    set [colletctable? v] to [yes]\nend\n\nwhen I receive [timer v]\nwait until <<key (right arrow v) pressed?> or <<key (left arrow v) pressed?> or <<key (up arrow v) pressed?> or <<<key (a v) pressed?> or <key (d v) pressed?>> or <key (w v) pressed?>>>>>\nreset timer\n\nwhen I receive [win v]\nif <(Level) = [1]> then\n    set [l1 time v] to (timer)\nelse\n    if <(Level) = [2]> then\n        set [l2 time v] to (timer)\n    else\n        if <(Level) = [3]> then\n            set [l3 time v] to (timer)\n        else\n            if <(Level) = [4]> then\n                set [l4 time v] to (timer)\n            end\n        end\n    end\nend\n\n@Platforms\n\nwhen flag clicked\nhide\ngo to [front v] layer\n\nwhen I receive [repeat v]\nPosition ((x) - (ScrollX)) ((y) - (ScrollY))\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: [380] y: [0]\n    Clone at x: [400] y: [0]\n    Clone at x: [360] y: [50]\nelse\n    if <(Level) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at x: [360] y: [260]\n        Clone at x: [450] y: [150]\n        Clone at x: [450] y: [150]\n        Clone at x: [250] y: [-100]\n        Clone at x: [300] y: [-50]\n        Clone at x: [170] y: [-170]\n        Clone at x: [-150] y: [0]\n    else\n        if <(Level) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [600] y: [350]\n            Clone at x: [530] y: [50]\n            Clone at x: [360] y: [30]\n            Clone at x: [220] y: [100]\n            Clone at x: [480] y: [-30]\n            Clone at x: [350] y: [0]\n        else\n            if <(Level) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at x: [470] y: [0]\n                Clone at x: [230] y: [100]\n                Clone at x: [-100] y: [400]\n                Clone at x: [600] y: [-200]\n                Clone at x: [390] y: [380]\n                Clone at x: [480] y: [295]\n            else\n                switch costume to (level 5 1 v)\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\n@Red\n\nwhen flag clicked\nshow\n\nwhen I receive [repeat v]\nPosition ((x) - (ScrollX)) ((y) - (ScrollY))\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: [380] y: [0]\n    Clone at x: [400] y: [0]\n    Clone at x: [360] y: [50]\nelse\n    if <(Level) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at x: [360] y: [260]\n        Clone at x: [450] y: [150]\n        Clone at x: [450] y: [150]\n        Clone at x: [250] y: [-100]\n        Clone at x: [300] y: [-50]\n        Clone at x: [170] y: [-170]\n        Clone at x: [-150] y: [0]\n    else\n        if <(Level) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [600] y: [350]\n            Clone at x: [530] y: [50]\n            Clone at x: [360] y: [30]\n            Clone at x: [220] y: [100]\n            Clone at x: [480] y: [-30]\n            Clone at x: [350] y: [0]\n        else\n            if <(Level) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at x: [470] y: [0]\n                Clone at x: [230] y: [100]\n                Clone at x: [-100] y: [400]\n                Clone at x: [600] y: [-200]\n                Clone at x: [390] y: [380]\n                Clone at x: [480] y: [295]\n            else\n                switch costume to (level 5 2 v)\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <not <(Level) = [5]>> then\n    if <<(x) = (x position)> and <(y) = (y position)>> then\n        show\n    else\n        hide\n    end\nelse\n    if <<(ScrollY) < [10]> and <<(ScrollX) > [38]> and <(ScrollX) < [52]>>> then\n        show\n    else\n        hide\n    end\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\n@Orbs\n\nwhen flag clicked\nshow\nset [counter v] to [1]\n\nwhen I receive [repeat v]\nPosition ((x) - (ScrollX)) ((y) - (ScrollY))\nif <(Colletctable?) = [yes]> then\n    if <touching (player v)?> then\n        start sound [Collect v]\n        change [collected v] by (1)\n        if <(Collected) = (Collected Max)> then\n            broadcast (Open Portal v)\n        end\n        delete this clone\n    end\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: [100] y: [0]\n    Clone at x: [190] y: [90]\n    Clone at x: [430] y: [150]\n    Clone at x: [750] y: [-70]\n    Clone at x: [1165] y: [-55]\nelse\n    if <(Level) = [2]> then\n        switch costume to (dot v)\n        Clone at x: [393] y: [395]\n        Clone at x: [322] y: [147]\n        Clone at x: [998] y: [576]\n        Clone at x: [1750] y: [544]\n        Clone at x: [1717] y: [296]\n    else\n        if <(Level) = [3]> then\n            switch costume to (dot v)\n            Clone at x: [282] y: [215]\n            Clone at x: [705] y: [620]\n            Clone at x: [1813] y: [515]\n            Clone at x: [2275] y: [700]\n            Clone at x: [2691] y: [650]\n        else\n            if <(Level) = [4]> then\n                switch costume to (dot v)\n                Clone at x: [260] y: [107]\n                Clone at x: [460] y: [489]\n                Clone at x: [1266] y: [505]\n                Clone at x: [1557] y: [903]\n                Clone at x: [2078] y: [1106]\n            else\n                repeat (9)\n                    Clone at x: [-125] y: ((8) * (Counter))\n                    change [counter v] by (4)\n                end\n                set [counter v] to [1]\n                repeat (9)\n                    Clone at x: [-100] y: ((8) * (Counter))\n                    change [counter v] by (4)\n                end\n                set [counter v] to [1]\n                repeat (9)\n                    Clone at x: [-75] y: ((8) * (Counter))\n                    change [counter v] by (4)\n                end\n                set [counter v] to [1]\n                repeat (9)\n                    Clone at x: [-50] y: ((8) * (Counter))\n                    change [counter v] by (4)\n                end\n                set [counter v] to [1]\n                repeat (9)\n                    Clone at x: [-25] y: ((8) * (Counter))\n                    change [counter v] by (4)\n                end\n                set [counter v] to [1]\n                repeat (9)\n                    Clone at x: [0] y: ((8) * (Counter))\n                    change [counter v] by (4)\n                end\n                set [counter v] to [1]\n                repeat (9)\n                    Clone at x: [100] y: ((8) * (Counter))\n                    change [counter v] by (4)\n                end\n                set [counter v] to [1]\n                repeat (9)\n                    Clone at x: [125] y: ((8) * (Counter))\n                    change [counter v] by (4)\n                end\n                set [counter v] to [1]\n                repeat (9)\n                    Clone at x: [150] y: ((8) * (Counter))\n                    change [counter v] by (4)\n                end\n                set [counter v] to [1]\n                repeat (9)\n                    Clone at x: [175] y: ((8) * (Counter))\n                    change [counter v] by (4)\n                end\n                set [counter v] to [1]\n                repeat (9)\n                    Clone at x: [200] y: ((8) * (Counter))\n                    change [counter v] by (4)\n                end\n                set [counter v] to [1]\n                repeat (9)\n                    Clone at x: [225] y: ((8) * (Counter))\n                    change [counter v] by (4)\n                end\n            end\n        end\n    end\nend\nset [x v] to [-9999999]\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\nset [counter v] to [1]\nrepeat (9)\n    Clone at x: [75] y: ((8) * (Counter))\n    change [counter v] by (4)\nend\n\n@Light\n\nwhen I receive [go to palyer v]\nshow\nset size to (100) %\nset [ghost v] effect to (0)\npoint in direction (90)\ngo to x: ([x position v] of [player v]) y: ([y position v] of [player v])\nif <(Exit) > []> then\n    repeat (3)\n        hide\n        wait (0.1) seconds\n        show\n        wait (0.1) seconds\n    end\n    hide\n    wait (0.3) seconds\nend\n\nwhen I receive [win v]\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\nwait (1) seconds\n\n@Bouncy Stuff\n\nwhen flag clicked\nhide\n\nwhen I receive [repeat v]\nPosition ((x) - (ScrollX)) ((y) - (ScrollY))\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: [380] y: [0]\n    Clone at x: [400] y: [0]\n    Clone at x: [360] y: [50]\nelse\n    if <(Level) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at x: [360] y: [260]\n        Clone at x: [450] y: [150]\n        Clone at x: [450] y: [150]\n        Clone at x: [250] y: [-100]\n        Clone at x: [300] y: [-50]\n        Clone at x: [170] y: [-170]\n    else\n        if <(Level) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [600] y: [350]\n            Clone at x: [530] y: [50]\n            Clone at x: [360] y: [30]\n            Clone at x: [220] y: [100]\n            Clone at x: [480] y: [-30]\n            Clone at x: [350] y: [0]\n        else\n            if <(Level) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at x: [470] y: [0]\n                Clone at x: [230] y: [100]\n                Clone at x: [-100] y: [400]\n                Clone at x: [600] y: [-200]\n                Clone at x: [390] y: [380]\n                Clone at x: [480] y: [295]\n            else\n                switch costume to (level 5 1 v)\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\n@Exit\n\nwhen I receive [open portal v]\nswitch costume to (open v)\n\nwhen flag clicked\nshow\ngo to [back v] layer\n\nwhen I receive [repeat v]\nPosition ((x) - (ScrollX)) ((y) - (ScrollY))\nif <<(costume [number v]) = [2]> and <touching (player v)?>> then\n    set [exit v] to [win]\nend\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: [1630] y: [115]\nelse\n    if <(Level) = [2]> then\n        switch costume to (closed v)\n        Clone at x: [1535] y: [245]\n    else\n        if <(Level) = [3]> then\n            switch costume to (closed v)\n            Clone at x: [2838] y: [587]\n        else\n            if <(Level) = [4]> then\n                switch costume to (closed v)\n                Clone at x: [2314] y: [1086]\n            else\n                hide\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <not <(Level) = [5]>> then\n    if <<(x) = (x position)> and <(y) = (y position)>> then\n        show\n    else\n        hide\n    end\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\n@Collected\n\nwhen I receive [reset v]\ngo to x: (-215) y: (-165)\nswitch costume to (0 v)\nif <(Level) = [5]> then\n    hide\nelse\n    show\nend\n\nwhen I receive [go to palyer v]\nif <not <(Level) = [5]>> then\n    switch costume to ((Collected) + (1))\nend\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (35) y: (30)\nhide\n\ngo to [front v] layer\ngo [forward v] (99) layers\nset [ghost v] effect to (100)\n\nshow\n\nforever\n\n