Sonic Platformer! Prerelease 1

Instructions: Update from the Cathy390 of July 30th, 2020:\nI will no longer be updating this, I have many other things to do, such as animations, and I don't really enjoy working on games as much as I like working on animations. So...please don't tell me to update. :)\n\nArrow Keys to Move.\n\nThis is my second platformer! I used some of the code that @jacko1234567 used to make his famous platformer Pentagon to make this. Enjoy! \n\nUpdate: OMGOMGOMGOMG 2nd on trending search for "Sonic"!!!!!!!!!! OMG 912 VIEWS!!! We're almost at 1000! \n\nChangelog here: https://scratch.mit.edu/discuss/topic/398092/?page=1#post-3950250

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\n\nwhen I receive [start game v]\nswitch backdrop to (2 v)\n\nwhen I receive [next level v]\nnext backdrop\n\nwhen backdrop switches to [20 v]\nbroadcast (end v)\n\n@Sprite3\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\ngo to [front v] layer\nshow\nwait (2) seconds\nrepeat until <key (space v) pressed?>\n    switch costume to (costume2 v)\n    wait (0.5) seconds\n    switch costume to (costume3 v)\n    wait (0.5) seconds\nend\n\nwhen I receive [end v]\ngo to [front v] layer\nset [ghost v] effect to (100)\nstop [other scripts in sprite v]\nshow\nswitch costume to (costume1 v)\nstart sound [Gong v]\nrepeat (66)\n    change [ghost v] effect by (-1.5)\nend\nstop [all v]\n\nwhen [space v] key pressed\nset [ghost v] effect to (0)\nshow\n\nwhen [c v] key pressed\nset [ghost v] effect to (100)\nhide\n\nwhen [space v] key pressed\nset [ghost v] effect to (100)\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\nstart sound [E trumpet v]\nwait (1) seconds\nrepeat (5)\n    change [ghost v] effect by (20)\nend\nhide\nbroadcast (start game v)\n\nswitch costume to (costume1 v)\nshow\n\n@Sonic sprites\n\nwhen I receive [start game v]\nshow\nforever\n    if <<key (left arrow v) pressed?> and <not <key (up arrow v) pressed?>>> then\n        set [idle v] to [0]\n        wait (0.01) seconds\n        switch costume to (start run left 3 v)\n        wait (0.01) seconds\n        switch costume to (start run left 4 v)\n        wait (0.01) seconds\n        switch costume to (start run left 5 v)\n        wait (0.01) seconds\n        switch costume to (start run left 6 v)\n    end\n    if <<key (right arrow v) pressed?> and <not <key (up arrow v) pressed?>>> then\n        set [idle v] to [0]\n        wait (0.01) seconds\n        switch costume to (start run right 3 v)\n        wait (0.01) seconds\n        switch costume to (start run right 4 v)\n        wait (0.01) seconds\n        switch costume to (start run right 5 v)\n        wait (0.01) seconds\n        switch costume to (start run right 6 v)\n    end\n    if <<key (left arrow v) pressed?> and <key (up arrow v) pressed?>> then\n        set [idle v] to [0]\n        switch costume to (sonic jump left v)\n    end\n    if <<key (right arrow v) pressed?> and <key (up arrow v) pressed?>> then\n        set [idle v] to [0]\n        switch costume to (sonic jump right v)\n    end\n    if <<not <<key (right arrow v) pressed?> or <<key (left arrow v) pressed?> or <key (up arrow v) pressed?>>>> and <<(costume [name v]) = [start run right 5]> or <<(costume [name v]) = [start run right 6]> or <(costume [name v]) = [facing right]>>>> then\n        switch costume to (facing right v)\n        change [idle v] by (1)\n        if <<[40] < (idle)> and <(costume [name v]) = [facing right]>> then\n            repeat until <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>>\n                change [idle v] by (1)\n                switch costume to (idle 1 right v)\n                wait (0.07) seconds\n                change [idle v] by (1)\n                switch costume to (idle 2 right v)\n                wait (0.07) seconds\n                change [idle v] by (1)\n                switch costume to (idle 3 right v)\n                wait (0.07) seconds\n                change [idle v] by (1)\n                switch costume to (idle right 4 v)\n                wait (0.07) seconds\n            end\n        end\n    end\n    if <<not <<key (right arrow v) pressed?> or <<key (left arrow v) pressed?> or <key (up arrow v) pressed?>>>> and <<(costume [name v]) = [start run left 5]> or <<(costume [name v]) = [start run left 6]> or <(costume [name v]) = [facing left]>>>> then\n        switch costume to (facing left v)\n        change [idle v] by (1)\n        if <<[40] < (idle)> and <(costume [name v]) = [facing left]>> then\n            repeat until <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>>\n                switch costume to (idle 1 left v)\n                wait (0.07) seconds\n                switch costume to (idle 2 left v)\n                wait (0.07) seconds\n                switch costume to (idle 3 left v)\n                wait (0.07) seconds\n                switch costume to (idle left 4 v)\n                wait (0.07) seconds\n            end\n        end\n    end\n    if <<not <<key (right arrow v) pressed?> or <<key (left arrow v) pressed?> or <key (up arrow v) pressed?>>>> and <<(costume [name v]) = [start roll right 3]> or <(costume [name v]) = [start roll right 4]>>> then\n        switch costume to (facing right v)\n    end\n    if <<not <<key (right arrow v) pressed?> or <<key (left arrow v) pressed?> or <key (up arrow v) pressed?>>>> and <<(costume [name v]) = [start roll left 3]> or <(costume [name v]) = [start roll left 4]>>> then\n        switch costume to (facing left v)\n    end\n    if <<not <<key (right arrow v) pressed?> or <<key (left arrow v) pressed?> or <key (up arrow v) pressed?>>>> and <(costume [name v]) = [sonic jump right]>> then\n        switch costume to (facing right v)\n    end\n    if <<not <<key (right arrow v) pressed?> or <<key (left arrow v) pressed?> or <key (up arrow v) pressed?>>>> and <(costume [name v]) = [sonic jump left]>> then\n        switch costume to (facing left v)\n    end\n    if <<not <<key (right arrow v) pressed?> or <<key (left arrow v) pressed?> or <key (down arrow v) pressed?>>>> and <(costume [name v]) = [crouch right 2]>> then\n        switch costume to (facing right v)\n    end\n    if <<not <<key (right arrow v) pressed?> or <<key (left arrow v) pressed?> or <key (down arrow v) pressed?>>>> and <(costume [name v]) = [crouch left 2]>> then\n        switch costume to (facing left v)\n    end\nend\n\nwhen I receive [start game v]\nshow\ngo to x: (-200) y: (-20)\nswitch costume to (facing right v)\nset size to (150) %\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    change [yv v] by (-0.5)\n    if <key (left arrow v) pressed?> then\n        change [xv v] by (-2)\n    end\n    if <key (right arrow v) pressed?> then\n        change [xv v] by (2)\n    end\n    set [xv v] to ((XV) * (0.9))\n    change x by (XV)\n    if <touching color (#7f7f7f)?> then\n        change y by (1)\n        if <touching color (#7f7f7f)?> then\n            change y by (1)\n            if <touching color (#7f7f7f)?> then\n                change y by (1)\n                if <touching color (#7f7f7f)?> then\n                    change y by (1)\n                    if <touching color (#7f7f7f)?> then\n                        change y by (1)\n                        if <touching color (#7f7f7f)?> then\n                            change y by (1)\n                            if <touching color (#7f7f7f)?> then\n                                change y by (-6)\n                                if <key (up arrow v) pressed?> then\n                                    set [idle v] to [0]\n                                    set [yv v] to [12.5]\n                                    if <(XV) > [0]> then\n                                        set [xv v] to [-12.5]\n                                    else\n                                        set [xv v] to [12.5]\n                                    end\n                                else\n                                    change x by ((XV) * (-1))\n                                    set [xv v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (YV)\n    if <touching color (#7f7f7f)?> then\n        change y by ((YV) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-0.5)\n    if <<touching color (#7f7f7f)?> and <key (up arrow v) pressed?>> then\n        set [yv v] to [8]\n    end\n    if <[235] < (x position)> then\n        change [level v] by (1)\n        set size to (150) %\n        broadcast (next level v)\n        go to x: (-200) y: (-20)\n        if <(level) = [6]> then\n            go to x: (-200) y: (50)\n        end\n    end\n    if <touching color (#ff0000)?> then\n        switch costume to (death 1 v)\n        wait (0.5) seconds\n        switch costume to (death 2 v)\n        wait (1) seconds\n        go to x: (-200) y: (-20)\n        switch costume to (facing right v)\n    end\n    if <touching color (#f346ff)?> then\n        set [yv v] to [11]\n    end\n    if <touching color (#00ff55)?> then\n        set size to (75) %\n    end\n    change y by (0.5)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\n\nwhen I receive [start game v]\nforever\n    if <<key (down arrow v) pressed?> and <key (right arrow v) pressed?>> then\n        wait (0.05) seconds\n        switch costume to (start roll right  v)\n        wait (0.05) seconds\n        switch costume to (start roll right 2 v)\n        wait (0.05) seconds\n        switch costume to (start roll right 3 v)\n        wait (0.05) seconds\n        switch costume to (start roll right 4 v)\n        wait (0.05) seconds\n    end\nend\n\nwhen I receive [start game v]\nforever\n    if <<key (down arrow v) pressed?> and <key (left arrow v) pressed?>> then\n        set [idle v] to [0]\n        wait (0.05) seconds\n        switch costume to (start roll left v)\n        wait (0.05) seconds\n        switch costume to (start roll left 2 v)\n        wait (0.05) seconds\n        switch costume to (start roll left 3 v)\n        wait (0.05) seconds\n        switch costume to (start roll left 4 v)\n        wait (0.05) seconds\n    end\nend\n\nwhen backdrop switches to [mario v]\nhide\n\nwhen I receive [start game v]\nplay sound [02 Green Hill Zone v] until done\n\nwhen I receive [end v]\nhide\nstop all sounds\n\nwhen I receive [start game v]\nset [idle v] to [0]\nforever\n    if <<key (down arrow v) pressed?> and <(costume [name v]) = [facing right]>> then\n        set [idle v] to [0]\n        wait (0.08) seconds\n        switch costume to (crouch right  v)\n        wait (0.08) seconds\n        set y to (-53)\n        switch costume to (crouch right 2 v)\n    end\nend\n\nwhen I receive [start game v]\nforever\n    if <<key (down arrow v) pressed?> and <(costume [name v]) = [facing left]>> then\n        wait (0.08) seconds\n        switch costume to (crouch left v)\n        wait (0.08) seconds\n        set y to (-53)\n        switch costume to (crouch left 2 v)\n    end\nend\n\nwhen I receive [end v]\nforever\n    if <touching (sprite3 v)?> then\n        hide\n    end\nend\n\nwhen I receive [end v]\nforever\n    if <[backdrop] = [20]> then\n        hide\n    end\nend\n\nswitch costume to (facing right v)\n\nwhen flag clicked\nhide variable [idle v]\n\nwhen I receive [start game v]\nhide variable [idle v]\n\n@unnamed\n\nwhen I receive [start game v]\ngo to [back v] layer\nhide\nforever\n    if <<key (m v) pressed?> and <<key (a v) pressed?> and <<key (r v) pressed?> and <<key (i v) pressed?> and <key (o v) pressed?>>>>> then\n        go to x: (-7) y: (27)\n        set size to (80) %\n        show\n        go to [front v] layer\n        go to [front v] layer\n        switch backdrop to (mario v)\n        say [Bzzzzt...] for (2) seconds\n        wait (1) seconds\n        say [Bzzzzt...] for (2) seconds\n        wait (1) seconds\n        say [SONIC SHALL DIE!] for (2) seconds\n        wait (1) seconds\n        repeat (20)\n            change [pixelate v] effect by (5)\n            change [ghost v] effect by (5)\n        end\n        wait (1) seconds\n        hide\n        go to [back v] layer\n        go to [back v] layer\n        switch backdrop to (tbc v)\n        stop [all v]\n    end\nend\n\nwhen backdrop switches to [mario v]\nstop all sounds\nplay sound [53 The Evil King Bowser v] until done\n\n@Sprite1\n\nwhen I receive [start game v]\n\nshow\nstop [all v]\n\n