Lag - A platformer
@Stage\n\nwhen I receive [animation finished v]\nswitch backdrop to (backdrop2 v)\n\nwhen I receive [play v]\nwait until <<(Mobile mode y/n) = [y]> or <(Mobile mode y/n) = [n]>>\nbroadcast (Play 2 v)\nstop [other scripts in sprite v]\n\nwhen I receive [animation finished v]\nforever\n    wait (pick random (1.) to (4)) seconds\n    set [lag menu y/n v] to [y]\n    wait (pick random (1.) to (2)) seconds\n    set [lag menu y/n v] to [n]\nend\n\nwhen flag clicked\nset [lag menu y/n v] to [n]\nset [music v] to []\n\n@Back\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (176) y: (122)\nhide\n\nwhen this sprite clicked\nbroadcast (Back v)\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\nwhen I receive [costumes v]\nshow\n\nwhen flag clicked\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        change [brightness v] effect by (10)\n    end\nend\n\nwhen I receive [instructions v]\nshow\n\nwhen I receive [cloud v]\nshow\n\n@Play button\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (0) y: (-56)\nhide\n\nwhen I receive [animation finished v]\nshow\n\nwhen flag clicked\nforever\n    if <(lag menu y/n) = [n]> then\n        point in direction ((90) + (([cos v] of (((timer) - (0)) * (100)) ) * (10)))\n        set [brightness v] effect to (0)\n        if <touching (mouse-pointer v)?> then\n            change [brightness v] effect by (10)\n        end\n    end\nend\n\nwhen I receive [music v]\nhide\n\nwhen I receive [play v]\nhide\n\nwhen I receive [costumes v]\nhide\n\nwhen I receive [back v]\nshow\n\nwhen I receive [instructions v]\nhide\n\nwhen I receive [cloud v]\nhide\n\nwhen this sprite clicked\nif <(lag menu y/n) = [n]> then\n    broadcast (Play v)\nend\n\n@Instructions\n\nwhen flag clicked\nset [random variable2 v] to [0]\nset size to (250) %\nswitch costume to (costume1 v)\nforever\n    if <(lag menu y/n) = [n]> then\n        point in direction ((90) + (([cos v] of (((timer) - (0)) * (100)) ) * (10)))\n        set [brightness v] effect to (0)\n        if <touching (mouse-pointer v)?> then\n            change [brightness v] effect by (10)\n        end\n    end\nend\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (-58) y: (-144)\nhide\n\nwhen I receive [animation finished v]\nshow\n\nwhen I receive [music v]\nhide\n\nwhen I receive [play v]\nhide\n\nwhen I receive [costumes v]\nhide\n\nwhen this sprite clicked\nif <(lag menu y/n) = [n]> then\n    broadcast (Instructions v)\nend\n\nwhen I receive [instructions v]\nset [random variable2 v] to [1]\nhide\ncreate clone of (_myself_ v)\n\nwhen I receive [back v]\nset size to (250) %\nset [random variable2 v] to [0]\nswitch costume to (costume1 v)\nshow\n\nwhen I start as a clone\nshow\nswitch costume to (costume3 v)\n\nwhen I receive [back v]\ndelete this clone\n\nwhen I start as a clone\nforever\n    point in direction (90)\nend\n\nwhen I start as a clone\nforever\n    set size to (100) %\n    point in direction (90)\n    go to x: (-50) y: (0)\nend\n\nwhen I receive [cloud v]\nhide\n\n@Intro\n\nwhen I start as a clone\nset [pfp v] to (pick random (75) to (100))\nset [js_ v] to (pick random (75) to (100))\nwait (3.6) seconds\nforever\n    if <(Intro CloneID) = [1]> then\n        point in direction ((pfp) + (([sin v] of ((timer) * (400)) ) * (20)))\n    else\n        if <(Intro CloneID) = [2]> then\n            point in direction ((JS_) + (([sin v] of ((timer) * (400)) ) * (20)))\n        end\n    end\nend\n\nwhen I start as a clone\nwait (3.6) seconds\nforever\n    if <(mp) = [1]> then\n        set [bounce? v] to ((((bounce?) * (0.65)) + ((((200) + ()) - (size)) * (0.3))) - (25))\n        change size by (bounce?)\n    else\n        set [bounce? v] to ((((bounce?) * (0.6)) + ((((150) + ()) - (size)) * (0.3))) - (25))\n        change size by (bounce?)\n    end\nend\n\nwhen I receive [intro v]\nset [intro cloneid v] to [0]\nstart sound [Intro v]\nrepeat (3)\n    change [intro cloneid v] by (1)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nif <(Can we play ;-;) = [y]> then\n    wait (0.001) seconds\n    hide\n    switch backdrop to (backdrop1 v)\n    clear graphic effects\n    broadcast (Intro v)\n    go to x: (0) y: (0)\nend\n\nwhen I start as a clone\nshow\nif <(Intro CloneID) = [1]> then\n    switch costume to (js v)\n    go to x: (0) y: (200)\n    repeat until <(y position) < [1]>\n        change y by (((y position) * (.1)) * (-1))\n    end\n    wait (7.3) seconds\n    delete this clone\nelse\n    if <(Intro CloneID) = [2]> then\n        switch costume to (js_coder v)\n        go to x: (-300) y: (-100)\n        repeat until <(x position) > [-1]>\n            change x by (((x position) * (.1)) * (-1))\n        end\n        wait (7.3) seconds\n        delete this clone\n    else\n        switch costume to (gren squar v)\n        set [ghost v] effect to (100)\n        wait (3.4) seconds\n        repeat (2)\n            change [ghost v] effect by (-50)\n        end\n        wait (.2) seconds\n        repeat (2)\n            change [ghost v] effect by (50)\n        end\n        wait (4.8) seconds\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n        wait (.5) seconds\n        broadcast (Animation Finished v)\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        delete this clone\n    end\nend\n\nwhen I receive [intro v]\nforever\n    set [mp v] to [1]\n    wait (0.2) seconds\n    set [mp v] to [0]\n    wait (0.2) seconds\nend\n\n@Mobile mode y/n\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (0) y: (0)\nset [cloneid v] to [0]\nset [mobile mode y/n v] to []\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [play v]\nwait (.1) seconds\nshow\nrepeat (2)\n    change [cloneid v] by (1)\n    create clone of (_myself_ v)\nend\nset [mobile mode y/n v] to []\n\nwhen I start as a clone\nshow\nif <(CloneID) = [1]> then\n    switch costume to (costume2 v)\n    go to x: (50) y: (-65)\nelse\n    switch costume to (costume3 v)\n    go to x: (-50) y: (-65)\nend\n\nwhen I receive [play 2 v]\nhide\n\nwhen I receive [play 2 v]\ndelete this clone\n\nwhen I start as a clone\nif <(CloneID) = [1]> then\n    wait until <<mouse down?> and <touching (mouse-pointer v)?>>\n    set [mobile mode y/n v] to [y]\nelse\n    wait until <<mouse down?> and <touching (mouse-pointer v)?>>\n    set [mobile mode y/n v] to [n]\nend\n\n@Title\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (0) y: (100)\nset [pixelate v] effect to (100)\ngo to [back v] layer\nhide\n\nwhen I receive [animation finished v]\nshow\nwait (.1) seconds\nrepeat (20)\n    change [pixelate v] effect by (-5)\nend\nforever\n    if <(lag menu y/n) = [n]> then\n        set x to ((0) + (([sin v] of ((timer) * (275)) ) * (7)))\n    end\nend\n\nwhen I receive [play v]\nhide\n\nwhen I receive [music v]\nhide\n\nwhen I receive [instructions v]\nhide\n\nwhen I receive [back v]\nshow\n\n@Moosik Button\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (58) y: (-144)\ngo to [back v] layer\nset volume to (100) %\nhide\n\nwhen I receive [animation finished v]\nshow\n\nwhen flag clicked\nforever\n    if <(lag menu y/n) = [n]> then\n        point in direction ((90) + (([cos v] of (((timer) - (0)) * (100)) ) * (10)))\n        set [brightness v] effect to (0)\n        if <touching (mouse-pointer v)?> then\n            change [brightness v] effect by (10)\n        end\n    end\nend\n\nwhen I receive [music v]\nhide\n\nwhen I receive [play v]\nhide\n\nwhen I receive [back v]\nshow\n\nwhen I receive [instructions v]\nhide\n\nwhen this sprite clicked\nif <(lag menu y/n) = [n]> then\n    broadcast (Music v)\nend\n\nwhen I receive [play 2 v]\nif <(MUSIC) = []> then\n    forever\n        play sound (pick random (1) to (13)) until done\n    end\nelse\n    if <(MUSIC) = [1]> then\n        forever\n            play sound [Avicii - Levels v] until done\n        end\n    else\n        if <(MUSIC) = [2]> then\n            forever\n                play sound [Swif7 - The Memory of You v] until done\n            end\n        else\n            if <(MUSIC) = [3]> then\n                forever\n                    play sound [Disfigure - Blank.mp3 v] until done\n                end\n            else\n                if <(MUSIC) = [4]> then\n                    forever\n                        play sound [TheFatRat - Windfall v] until done\n                    end\n                else\n                    if <(MUSIC) = [5]> then\n                        forever\n                            play sound [Never gonna give you up v] until done\n                        end\n                    else\n                        if <(MUSIC) = [6]> then\n                            forever\n                                play sound [Lights \[Dream Trance\] v] until done\n                            end\n                        else\n                            if <(MUSIC) = [7]> then\n                                forever\n                                    play sound [COMA NA DANÇA v] until done\n                                end\n                            else\n                                if <(MUSIC) = [8]> then\n                                    forever\n                                        play sound [Kasger & Limitless - Miles Away \[NCS Release\].mp3 v] until done\n                                    end\n                                else\n                                    if <(MUSIC) = [9]> then\n                                        forever\n                                            play sound [Electro-Light - Symbolism \[NCS Release\].mp3 v] until done\n                                        end\n                                    else\n                                        if <(MUSIC) = [10]> then\n                                            forever\n                                                play sound [music v] until done\n                                            end\n                                        else\n                                            if <(MUSIC) = [11]> then\n                                                forever\n                                                    play sound [Nebula v] until done\n                                                end\n                                            else\n                                                forever\n                                                    play sound [Vicetone - United We Dance v] until done\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [play 2 v]\nforever\n    wait (pick random (5.) to (10)) seconds\n    set volume to (0) %\n    wait (pick random (.5) to (1)) seconds\n    set volume to (100) %\nend\n\n@hehe\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\n@Avicii - Levels\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (-200) y: (54)\nhide\n\nwhen this sprite clicked\nstart sound [menu001 v]\nbroadcast (Back v)\nset [music v] to [1]\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\nwhen flag clicked\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        change [brightness v] effect by (10)\n    end\nend\n\n@Swift7 - The memory of you\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (-100) y: (54)\nhide\n\nwhen this sprite clicked\nstart sound [menu001 v]\nbroadcast (Back v)\nset [music v] to [2]\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\nwhen flag clicked\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        change [brightness v] effect by (10)\n    end\nend\n\n@Disfigure - Blank\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (0) y: (54)\nhide\n\nwhen this sprite clicked\nstart sound [menu001 v]\nbroadcast (Back v)\nset [music v] to [3]\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\nwhen flag clicked\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        change [brightness v] effect by (10)\n    end\nend\n\n@TheFatRat - Windfall\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (100) y: (54)\nhide\n\nwhen this sprite clicked\nstart sound [menu001 v]\nbroadcast (Back v)\nset [music v] to [4]\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\nwhen flag clicked\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        change [brightness v] effect by (10)\n    end\nend\n\n@?????\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (200) y: (54)\nhide\n\nwhen this sprite clicked\nstart sound [menu001 v]\nbroadcast (Back v)\nset [music v] to [5]\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\nwhen flag clicked\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        change [brightness v] effect by (10)\n    end\nend\n\n@Lights [Dream Trance]\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (-200) y: (-46)\nhide\n\nwhen this sprite clicked\nstart sound [menu001 v]\nbroadcast (Back v)\nset [music v] to [6]\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\nwhen flag clicked\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        change [brightness v] effect by (10)\n    end\nend\n\n@????\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (-100) y: (-46)\nhide\n\nwhen this sprite clicked\nstart sound [menu001 v]\nbroadcast (Back v)\nset [music v] to [7]\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\nwhen flag clicked\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        change [brightness v] effect by (10)\n    end\nend\n\n@Kasger & Limitless - Miles Away [NCS Release]\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (0) y: (-46)\nhide\n\nwhen this sprite clicked\nstart sound [menu001 v]\nbroadcast (Back v)\nset [music v] to [8]\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\nwhen flag clicked\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        change [brightness v] effect by (10)\n    end\nend\n\n@Electro-Light - Symbolism [NCS Release]\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (100) y: (-46)\nhide\n\nwhen this sprite clicked\nstart sound [menu001 v]\nbroadcast (Back v)\nset [music v] to [9]\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\nwhen flag clicked\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        change [brightness v] effect by (10)\n    end\nend\n\n@???\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (200) y: (-46)\nhide\n\nwhen this sprite clicked\nstart sound [menu001 v]\nbroadcast (Back v)\nset [music v] to [10]\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\nwhen flag clicked\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        change [brightness v] effect by (10)\n    end\nend\n\n@Nebula\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (-200) y: (-146)\nhide\n\nwhen this sprite clicked\nstart sound [menu001 v]\nbroadcast (Back v)\nset [music v] to [11]\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\nwhen flag clicked\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        change [brightness v] effect by (10)\n    end\nend\n\n@Vicetone - United We Dance\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (-100) y: (-146)\nhide\n\nwhen this sprite clicked\nstart sound [menu001 v]\nbroadcast (Back v)\nset [music v] to [12]\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\nwhen flag clicked\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        change [brightness v] effect by (10)\n    end\nend\n\n@Random\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (0) y: (-146)\nhide\n\nwhen this sprite clicked\nstart sound [menu001 v]\nbroadcast (Back v)\nset [music v] to []\n\nwhen I receive [back v]\nhide\n\nwhen I receive [music v]\nshow\n\nwhen flag clicked\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        change [brightness v] effect by (10)\n    end\nend\n\n@hitbox\n\nwhen flag clicked\nwait (0.001) seconds\ngo to x: (-200) y: (-60)\nhide\n\nwhen I receive [play 2 v]\nshow\nset [ghost v] effect to (100)\nforever\n    if <(Mobile mode y/n) = [n]> then\n        if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n            change [x v] by (1)\n        end\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            change [x v] by (-1)\n        end\n        set [x v] to ((x) * (.9))\n        change x by (x)\n        if <touching (level v)?> then\n            change y by (1)\n            if <touching (level v)?> then\n                change y by (1)\n                if <touching (level v)?> then\n                    change y by (1)\n                    if <touching (level v)?> then\n                        change y by (1)\n                        if <touching (level v)?> then\n                            change y by (1)\n                            if <touching (level v)?> then\n                                change x by ((x) * (-1))\n                                change y by (-5)\n                                if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                    if <(x) > [0]> then\n                                        set [x v] to [-5]\n                                    else\n                                        set [x v] to [5]\n                                    end\n                                    set [y v] to [10]\n                                else\n                                    set [x v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [y v] by (-1)\n        change y by (y)\n        if <touching (level v)?> then\n            change y by ((y) * (-1))\n            set [y v] to [0]\n        end\n        change y by (-1)\n        if <touching (level v)?> then\n            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                change [y v] by (15)\n            end\n        end\n        change y by (1)\n    else\n        if <<mouse down?> and <(mouse x) > (x position)>> then\n            change [x v] by (1)\n        end\n        if <<mouse down?> and <(mouse x) < (x position)>> then\n            change [x v] by (-1)\n        end\n        set [x v] to ((x) * (.9))\n        change x by (x)\n        if <touching (level v)?> then\n            change y by (1)\n            if <touching (level v)?> then\n                change y by (1)\n                if <touching (level v)?> then\n                    change y by (1)\n                    if <touching (level v)?> then\n                        change y by (1)\n                        if <touching (level v)?> then\n                            change y by (1)\n                            if <touching (level v)?> then\n                                change x by ((x) * (-1))\n                                change y by (-5)\n                                if <<mouse down?> and <(mouse y) > (y position)>> then\n                                    if <(x) > [0]> then\n                                        set [x v] to [-5]\n                                    else\n                                        set [x v] to [5]\n                                    end\n                                    set [y v] to [10]\n                                else\n                                    set [x v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [y v] by (-1)\n        change y by (y)\n        if <touching (level v)?> then\n            change y by ((y) * (-1))\n            set [y v] to [0]\n        end\n        change y by (-1)\n        if <touching (level v)?> then\n            if <<mouse down?> and <(mouse y) > (y position)>> then\n                change [y v] by (15)\n            end\n        end\n        change y by (1)\n    end\n    if <<touching (spikes v)?> or <(y position) < [-170]>> then\n        Reset\n        broadcast (Died v)\n    end\n    if <(x position) > [225]> then\n        Reset\n        change [level v] by (1)\n        broadcast (Next Level v)\n    end\nend\n\ndefine Reset\nset [x v] to [0]\nset [y v] to [0]\ngo to x: (-200) y: (-60)\n\n@Player\n\nwhen flag clicked\nwait (0.001) seconds\nhide\nset [lag gameplay y/n v] to [n]\n\nwhen I receive [play 2 v]\nshow\nforever\n    go to (hitbox v)\n    set [lag gameplay y/n v] to [y]\n    wait (pick random (.25) to (.5)) seconds\n    set [lag gameplay y/n v] to [n]\nend\n\nwhen I receive [died v]\ngo to (hitbox v)\n\nwhen I receive [next level v]\ngo to (hitbox v)\n\n@Level\n\nwhen flag clicked\nwait (0.001) seconds\nset [level v] to [1]\nswitch costume to (level 9 v)\nhide\n\nwhen I receive [play 2 v]\nshow\nforever\n    if <(lag gameplay y/n) = [n]> then\n        go to x: (0) y: (0)\n        switch costume to (Level)\n        go to [front v] layer\n    end\nend\n\nwhen I receive [next level v]\nswitch costume to (Level)\n\n@Spikes\n\nwhen flag clicked\nwait (0.001) seconds\nswitch costume to (level 1 v)\nhide\n\nwhen I receive [play 2 v]\nshow\nforever\n    if <(lag gameplay y/n) = [n]> then\n        go to x: (0) y: (0)\n        switch costume to (Level)\n        go to [back v] layer\n    end\nend\n\nwhen I receive [next level v]\nswitch costume to (Level)\n\n@Totally real Error yeaah\n\nwhen flag clicked\nwait (0.001) seconds\nif <(Can we play ;-;) = [y]> then\n    hide\nend\n\nwhen I receive [next level v]\nif <(Level) = [11]> then\n    show\n    go to [front v] layer\n    set [can we play ;-; v] to [n]\n    stop [all v]\nend\n\nset [can we play ;-; v] to [y]\n\nwhen flag clicked\nif <(Can we play ;-;) = [n]> then\n    stop [all v]\nend\n\n@TB\n\nwhen flag clicked\nforever\n    if <(Can we play ;-;) = [y]> then\n        show\n        go to [front v] layer\n        set [ghost v] effect to (100)\n    else\n        hide\n    end\nend\n\n