NIGHT || a mobile scrolling platformer

Instructions: sorry that this is kinda generic i started making this before the whole #STGP started  \ni will make non-generic platformers from now on\nINSTRUCTIONS\narrow keys or mobile to move\nGO IN FULLSCREEN!!!!!!!!!!!!!!!!\nmust collect all coins to go to next level!!!

@Stage\n\n@blank\n\n@Player\n\nwhen I start as a clone\nshow\nset rotation style [all around v]\nswitch costume to (player v)\nrepeat (20)\n    turn right (15) degrees\n    change y by (10)\n    change [ghost v] effect by (5)\nend\nset [ghost v] effect to (0)\nhide\n\nwhen [u v] key pressed\nif <(volume) = [0]> then\n    set volume to (100) %\nend\n\nwhen [m v] key pressed\nif <(volume) = [100]> then\n    set volume to (0) %\nend\n\ndefine Game - Win\nif <<key (p v) pressed?> and <not <(LEVEL) = [4]>>> then\n    change [level v] by (1)\nelse\n    set rotation style [all around v]\n    repeat (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)\n    end\n    hide\n    change [level v] by (1)\n    wait (1) seconds\n    clear graphic effects\n    set rotation style [left-right v]\nend\n\ndefine Game - Die\nhide\nset [exit v] to []\ncreate clone of (_myself_ v)\nplay sound [DEATH v] until done\nwait (0.5) seconds\n\ndefine Clone (num)\nrepeat (num)\n    create clone of (particles v)\nend\n\nwhen flag clicked\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        Clone [20]\n        Game - Die\n    end\nend\n\ndefine Game On\nset rotation style [left-right v]\nset [x v] to [0]\nset [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) %\nshow\n\ndefine Tick\nif <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<<mouse down?> and <(x position) > (mouse x)>> and <(distance to [mouse-pointer v]) > [20]>>>> then\n    Change Player x by [-8]\n    point in direction (-90)\nend\nif <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<<mouse down?> and <(mouse x) > (x position)>> and <(distance to [mouse-pointer v]) > [20]>>>> then\n    Change Player x by [8]\n    point in direction (90)\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?> or <<key (space v) pressed?> or <<key (w v) pressed?> or <<<mouse down?> and <(mouse y) > (y position)>> and <(distance to [mouse-pointer v]) > [20]>>>>> then\n    if <(in air) < [4]> then\n        set [sy v] to [16]\n    end\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nChange Player y by (sy)\nPosition\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\nPosition\nif <(y) < [-180]> then\n    set [exit v] to [die]\nend\nif <touching (trampoline v)?> then\n    set [speedy v] to [30]\nend\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    end\n    Position\n    set [sy v] to [0]\nend\nif <touching (trampoline v)?> then\n    set [sy v] to [30]\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 (15)\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?> or <<key (space v) pressed?> or <<key (w v) pressed?> or <<<mouse down?> and <(mouse y) > (y position)>> and <(distance to [mouse-pointer v]) > [20]>>>>> 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\ndefine Test - Die\nif <touching (danger oof v)?> then\n    set [exit v] to [die]\nend\n\nif <touching (bounce v)?> then\n    set [exit v] to [die]\nend\n\nwhen flag clicked\nhide\n\nchange [sx v] by (-2)\n\nchange [sx v] by (2)\n\nwhen flag clicked\nforever\n    play sound [Mysterious Sleeper v] until done\nend\n\nbroadcast (Tick v)\n\n@Platforms\n\nwhen I receive [green flag v]\nhide\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]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\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: [360 ] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [400] y: [100]\n        Clone at x: [400] y: [100]\n        Clone at x: [360] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [360] y: [-8]\n            Clone at x: [360] y: [0]\n            Clone at x: [360] y: [0]\n            Clone at x: [-400] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at x: [360] y: [0]\n            end\n        end\n    end\nend\n\nClone at x: [360] y: [0]\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\nswitch costume to (level 1 1 v)\n\n@Collectables\n\nwhen I receive [tick v]\nswitch costume to ((((timer) * (15)) mod (6)) + (1))\n\nwhen I receive [green flag v]\nhide\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    else\n        start sound [Coin 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: [250] y: [20]\n    Clone at x: [420] y: [20]\n    Clone at x: [780] y: [40]\n    Clone at x: [890] y: [175]\n    Clone at x: [1340] y: [10]\n    Clone at x: [1470] y: [200]\n    Clone at x: [1750] y: [250]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (dot v)\n        Clone at x: [-198] y: [118]\n        Clone at x: [270] y: [44]\n        Clone at x: [440] y: [40]\n        Clone at x: [650] y: [0]\n        Clone at x: [800] y: [20]\n        Clone at x: [990] y: [190]\n        Clone at x: [1300] y: [20]\n        Clone at x: [1540] y: [200]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (dot v)\n            Clone at x: [250] y: [20]\n            Clone at x: [550] y: [175]\n            Clone at x: [720] y: [175]\n            Clone at x: [950] y: [30]\n            Clone at x: [1240] y: [100]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (dot v)\n                Clone at x: [-200] y: [-40]\n                Clone at x: [-150] y: [-40]\n                Clone at x: [-100] y: [-40]\n                Clone at x: [-50] y: [-40]\n                Clone at x: [0] y: [-40]\n                Clone at x: [50] y: [-40]\n                Clone at x: [100] y: [-40]\n                Clone at x: [150] y: [-40]\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\n@Exit\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <<(costume [name v]) = [Open]> and <touching (player v)?>> then\n    play sound [smb3_nspade_match v] until done\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: [1900] y: [320]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (closed v)\n        Clone at x: [1700] y: [180]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (closed v)\n            Clone at x: [1650] y: [300]\n        else\n            set [x v] to [-9999999]\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\n@Danger oof\n\nwhen I receive [green flag v]\nhide\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]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\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: [360] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [360] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [360] y: [0]\n            Clone at x: [360] y: [0]\n            Clone at x: [360] y: [0]\n            Clone at x: [360] y: [0]\n            Clone at x: [360] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 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\nwhen flag clicked\ngo to [back v] layer\n\n@Decor boii\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen flag clicked\nforever\n    go to [back v] layer\nend\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\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 [setup v]\nset [y v] to [0]\nset [x v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (costume1 v)\n    Position x: [450] y: [0]\n    Position x: [450] y: [0]\n    Position x: [450] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (costume4 v)\n        Position x: [450] y: [0]\n        Position x: [450] y: [0]\n        Position x: [450] y: [0]\n        Position x: [450] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (costume10 v)\n            Position x: [450] y: [0]\n            Position x: [450] y: [0]\n            Position x: [450] y: [0]\n            Position x: [450] y: [0]\n            Position x: [450] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (costume25 v)\n                Position x: [360] y: [0]\n            end\n        end\n    end\nend\n\ndefine Position x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I start as a clone\nset [ghost v] effect to (0)\n\nwhen I receive [green flag v]\nhide\n\n@Trampoline\n\nwhen I start as a clone\nshow\nswitch costume to (1 v)\nforever\n    if <<touching (player v)?> and <(dead?) = [0]>> then\n        start sound [Jump v]\n        repeat (5)\n            next costume\n        end\n        repeat (5)\n            switch costume to ((costume [number v]) - (1))\n        end\n    end\nend\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [reset v]\ndelete this clone\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\ndefine Clone 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 I receive [setup v]\nhide\nset [y v] to [0]\nset [x v] to [0]\nwait (0) seconds\nif <(LEVEL) = [1]> then\n    Clone x: [780] y: [-64]\nelse\n    if <(LEVEL) = [2]> then\n        Clone x: [900] y: [-70]\n    else\n        if <(LEVEL) = [3]> then\n            Clone x: [480] y: [-65]\n            Clone x: [640] y: [-67]\n        else\n            if <(LEVEL) = [5]> then\n        end\n    end\nend\nset [y v] to [-99999999999]\n\nClone x: [1140] y: [-58]\nClone x: [850] y: [-58]\nClone x: [1150] y: [-58]\n\nwhen flag clicked\n\nhide\n\ngo to [back v] layer\n\n@thumb\n\nwhen flag clicked\nforever\n    hide\nend\n\ngo to [front v] layer\nshow\n\n