Sonic ball platformer 3

Instructions: Arrow keys to move \n

@Stage\n\nwhen flag clicked\nforever\n    if <(Leavle) = [2]> then\n        next backdrop\n        stop all sounds\n        play sound [295 - Green Hill Zone v] until done\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [1]> then\n        switch backdrop to (backdrop1 v)\n        stop all sounds\n        play sound [Sonic movie green hill v] until done\n    end\nend\n\nshow variable [leavle v]\n\nhide variable [leavle v]\n\nwhen flag clicked\nforever\n    if <(Leavle) = [7]> then\n        switch backdrop to (backdrop1 v)\n        stop all sounds\n        play sound [Sonic unleashed Alpost day v] until done\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [11]> then\n        switch backdrop to (backdrop3 v)\n        stop all sounds\n        play sound [05 v] until done\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [14]> then\n        switch backdrop to (backdrop4 v)\n        stop all sounds\n        play sound [1-06 Star Light Zone v] until done\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [18]> then\n        next backdrop\n        stop all sounds\n        play sound [1-04 v] until done\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [22]> then\n        next backdrop\n        stop all sounds\n        play sound [23 v] until done\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [26]> then\n        next backdrop\n        stop all sounds\n        play sound [3-20 Aquatic Base ~Level 2~ v] until done\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [30]> then\n        next backdrop\n        stop all sounds\n        play sound [15 Honeycomb Highway v] until done\n    end\nend\n\n@Sprite1\n\nwhen flag clicked\nhide\n\n@Sprite2\n\n@Player2\n\nwhen flag clicked\nshow\nswitch costume to (costume1 v)\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    broadcast (Tick v)\nend\n\ndefine Tick\nif <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    change [xv v] by (5)\nend\nif <<key (left arrow v) pressed?> or <<mouse down?> and <(x position) > (mouse x)>>> then\n    change [xv v] by (-5)\nend\nchange x by (Xv)\nset [xv v] to ((Xv) * (0.9))\nif <touching color (#000000)?> then\n    change y by (1)\n    if <touching color (#000000)?> then\n        change y by (1)\n        if <touching color (#000000)?> then\n            change y by (1)\n            if <touching color (#000000)?> then\n                change y by (1)\n                if <touching color (#000000)?> then\n                    change y by (1)\n                    if <touching color (#000000)?> then\n                        change x by ((Xv) * (-1.3))\n                        change y by (-5)\n                        if <key (up arrow v) pressed?> then\n                            if <(Xv) > [0]> then\n                                set [xv v] to [-10]\n                            else\n                                set [xv v] to [0]\n                            end\n                            set [yv v] to [15]\n                        else\n                            set [xv v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange [yv v] by (-1)\nchange y by (Yv)\nif <touching color (#000000)?> then\n    change y by ((Yv) * (-1))\n    set [yv v] to [0]\nend\nchange y by (-1)\nif <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n    if <touching color (#000000)?> then\n        set [yv v] to [20]\n        start sound [jump v]\n    end\nend\nchange y by (1)\nchange [scrollx v] by ((x position) * (-1))\nchange [scrolly v] by ((y position) * (-1))\ngo to x: (0) y: (0)\nif <<touching color (#ff0000)?> or <(ScrollY) > [700]>> then\n    set [scrollx v] to [-191]\n    set [scrolly v] to [124]\nend\nif <touching color (#0006ff)?> then\n    broadcast (Next Level v) and wait\nend\n\nwhen I receive [tick v]\nTick\n\nwhen I receive [its thumb time v]\nhide\n\nwhen flag clicked\nforever\n    turn right (15) degrees\nend\n\nwhen flag clicked\ngo to [front v] layer\n\nwhen flag clicked\nforever\n    if <(Tails) = [0]> then\n        switch costume to (costume1 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Tails) = [1]> then\n        switch costume to (costume4 v)\n    end\nend\n\nwhen I receive [switch v]\nnext costume\n\nwhen flag clicked\nforever\n    if <(Knuckles) = [2]> then\n        set [knuckles v] to [0]\n    end\nend\n\nchange [knuckles v] by (1)\n\nwhen flag clicked\nforever\n    if <(Knuckles) = [0]> then\n        switch costume to (costume1 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Knuckles) = [1]> then\n        switch costume to (costume3 v)\n    end\nend\n\n@Sprite3\n\nwhen flag clicked\n\nshow\n\nwhen flag clicked\nforever\n    if <(Leavle) = [1]> then\n        go to [front v] layer\n        switch costume to (costume1 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [2]> then\n        go to [front v] layer\n        switch costume to (costume2 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [3]> then\n        go to [front v] layer\n        switch costume to (costume3 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [4]> then\n        go to [front v] layer\n        switch costume to (costume4 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [5]> then\n        go to [front v] layer\n        switch costume to (costume5 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [6]> then\n        go to [front v] layer\n        switch costume to (costume6 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [7]> then\n        go to [front v] layer\n        switch costume to (costume7 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [8]> then\n        go to [front v] layer\n        switch costume to (costume8 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [9]> then\n        go to [front v] layer\n        switch costume to (costume9 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [10]> then\n        go to [front v] layer\n        switch costume to (costume10 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [11]> then\n        go to [front v] layer\n        switch costume to (costume11 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [12]> then\n        go to [front v] layer\n        switch costume to (costume12 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [13]> then\n        go to [front v] layer\n        switch costume to (costume13 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [14]> then\n        go to [front v] layer\n        switch costume to (costume14 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [15]> then\n        go to [front v] layer\n        switch costume to (costume15 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [16]> then\n        go to [front v] layer\n        switch costume to (costume17 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [17]> then\n        go to [front v] layer\n        switch costume to (costume17 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [18]> then\n        go to [front v] layer\n        switch costume to (costume18 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [19]> then\n        go to [front v] layer\n        switch costume to (costume19 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [20]> then\n        go to [front v] layer\n        switch costume to (costume20 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [21]> then\n        go to [front v] layer\n        switch costume to (costume21 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [22]> then\n        go to [front v] layer\n        switch costume to (costume22 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [23]> then\n        go to [front v] layer\n        switch costume to (costume23 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [24]> then\n        go to [front v] layer\n        switch costume to (costume24 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [25]> then\n        go to [front v] layer\n        switch costume to (costume25 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [26]> then\n        go to [front v] layer\n        switch costume to (costume26 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Leavle) = [30]> then\n        hide\n    end\nend\n\ngo to [front v] layer\nswitch costume to (costume26 v)\n\nwhen flag clicked\nhide\n\nshow\n\n@Level2\n\nwhen flag clicked\nset [leavle v] to [1]\nshow\nswitch costume to (blank v)\nset size to (400) %\nswitch costume to (level 1 v)\nset [scrollx v] to [-191]\nset [scrolly v] to [124]\nPosition \nforever\n    go to x: (ScrollX) y: (ScrollY)\nend\n\ndefine Position \nset [scrollx v] to [-191]\nset [scrolly v] to [124]\n\nwhen I receive [next level v]\nchange [leavle v] by (1)\nnext costume\nPosition \n\nwhen I receive [its thumb time v]\nhide\n\nwhen [m v] key pressed\nstop all sounds\nstop [this script v]\n\nwhen [p v] key pressed\nplay sound [ParagonX9 - Chaoz Fantasy v] until done\nstop [this script v]\n\nwhen flag clicked\nstart sound [ParagonX9 - Chaoz Fantasy v]\nstop [this script v]\n\n@Sprite4\n\nwhen flag clicked\nset [knuckles v] to [0]\nswitch costume to (costume1 v)\nhide\n\nwhen flag clicked\nforever\n    if <(Leavle) = [30]> then\n        show\n        switch costume to (costume1 v)\n        go to [front v] layer\n    end\nend\n\nwhen this sprite clicked\nbroadcast (Switch v)\nswitch costume to (costume2 v)\nchange [knuckles v] by (1)\n\n@score\n\nwhen flag clicked\nhide\nDisplay (Leavle) at (-130) (156)\nforever\n    broadcast (Reload Number Display v)\nend\n\ndefine Display (variable) at (x) (y)\nset [x v] to (x)\nset [y v] to (y)\nset [number display clone id v] to [0]\nrepeat (10)\n    change [number display clone id v] by (1)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [reload number display v]\nif <<(Number Display Clone ID) > (length of (Leavle))> or <(Number Display Clone ID) = (Points)>> then\n    hide\nelse\n    show\nend\ngo to x: ((X) + (((Number Display Clone ID) - (1)) * (15))) y: (Y)\nswitch costume to ((letter (Number Display Clone ID) of (Leavle)) + (1))\n\nwhen I start as a clone\nforever\n    set size to (200) %\nend\n\nwhen I start as a clone\nshow\ngo to x: ((X) + (((Number Display Clone ID) - (1)) * (30))) y: (Y)\nswitch costume to ((letter (Number Display Clone ID) of []) + (score))\n\nwhen I start as a clone\nforever\n    go to [front v] layer\nend\n\n@Sprite5\n\n