Diamond platformer

Instructions: use left right and up arrow to move and jump\ndon't touch the spikes \ndon't worry about the background its just decoration\ncollect the diamonds to change costume\nclick the scroll to read more rules\nALL LEVELS HAVE BEEN TESTED AND ARE POSSIBLE !!!\nclick the red square to stop

@Stage\n\nwhen flag clicked\nswitch backdrop to (1 v)\nforever\n    if <(LEVEL) = [1]> then\n        switch backdrop to (1 v)\n    end\n    if <(LEVEL) = [2]> then\n        switch backdrop to (2 v)\n    end\n    if <(LEVEL) = [3]> then\n        switch backdrop to (4 v)\n    end\n    if <(LEVEL) = [4]> then\n        switch backdrop to (3 v)\n    end\nend\n\nwhen I receive [game over v]\nswitch backdrop to (3 v)\n\n@diamond\n\nwhen flag clicked\nswitch costume to (a v)\nhide\nforever\n    if <(LEVEL) = [1]> then\n        hide\n    end\n    if <(LEVEL) = [2]> then\n        show\n        switch costume to (a v)\n        go to x: (-27) y: (10)\n    end\n    if <not <(LEVEL) = [2]>> then\n        hide\n    end\n    if <touching (sprite1 v)?> then\n        set [diomond yes v] to [yes]\n        wait (0.001) seconds\n        forever\n            hide\n        end\n    end\nend\n\nwhen I receive [game over v]\nhide\n\n@Sprite1\n\nwhen flag clicked\nhide\nswitch costume to (grey  v)\nset [back v] to [0]\n\nwhen flag clicked\nforever\n    if <<touching (sprite5 v)?> and <(diomond yes) = [yes]>> then\n        change [level v] by (1)\n        broadcast (next level v)\n        go to x: (-226) y: (-45)\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (diamond v)?> then\n        switch costume to (a v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (diamond2 v)?> then\n        switch costume to (e v)\n    end\nend\n\nwhen I receive [starts v]\nwait (0.8) seconds\nshow\ngo to x: (-226) y: (-45)\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    if <<<touching (sprite7 v)?> or <<touching (sprite8 v)?> or <touching (sprite9 v)?>>> or <touching (sprite12 v)?>> then\n        set volume to (5) %\n        start sound [wub beatbox v]\n        go to x: (-226) y: (-127)\n        wait (0.1) seconds\n    end\n    go to [front v] layer\n    if <(back) = [1]> then\n        hide\n        stop [this script v]\n    end\n    if <(x position) > [235]> then\n        broadcast (next v)\n        set x to (-222)\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\n    if <<(y position) < [-175]> or > then\n        go to x: (-197) y: (-44)\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        point in direction (90)\n        change [xv v] by (-1)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        point in direction (-90)\n        change [xv v] by (1)\n    end\n    set [xv v] to ((xv) * (0.85))\n    change x by (xv)\n    if <touching color (#666666)?> then\n        change y by (-2)\n        if <touching color (#666666)?> then\n            change y by (1)\n            if <touching color (#666666)?> then\n                change y by (1)\n                if <touching color (#666666)?> then\n                    change y by (1)\n                    if <touching color (#666666)?> then\n                        change y by (1)\n                        if <touching color (#666666)?> then\n                            change y by (1)\n                            if <touching color (#666666)?> then\n                                change y by (-5)\n                                change x by ((-1) * (xv))\n                                if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <not <(xv) = [0]>>> then\n                                    set [mode v] to [walljump]\n                                    set [yv v] to [8]\n                                    set [xv v] to (((xv) / ([abs v] of (xv) )) * (-10))\n                                else\n                                    set [mode v] to [wallslide]\n                                    set [xv v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change y by (2)\n    end\n    change y by (-3)\n    if <touching color (#666666)?> then\n        if <(yv) = [-3]> then\n            if <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> then\n                set [mode v] to [run]\n            else\n                if <([abs v] of (xv) ) > [.1]> then\n                    set [mode v] to [skid]\n                else\n                    set [mode v] to [stand]\n                end\n            end\n        end\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [mode v] to [jump]\n            set [yv v] to [9]\n        end\n    end\n    if <<(mode) = [jump]> or <<(mode) = [walljump]> and <<(yv) < [0]> or <<(mode) = [run]> or <<(mode) = [skid]> and <(yv) < [-3]>>>>>> then\n        set [mode v] to [fall]\n    end\n    change y by (3)\n    if <(yv) > [-15]> then\n        change [yv v] by (-0.5)\n    end\n    change y by (-2)\n    if <not <touching color (#666666)?>> then\n        change y by (-1)\n        if <not <touching color (#666666)?>> then\n            change y by (-1)\n            if <not <touching color (#666666)?>> then\n                change y by (-1)\n                if <not <touching color (#666666)?>> then\n                    change y by (-1)\n                    if <not <touching color (#666666)?>> then\n                        change y by (-1)\n                        if <not <touching color (#666666)?>> then\n                            change y by (5)\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (2)\n    change y by (yv)\n    if <touching color (#666666)?> then\n        change y by (-2)\n        if <touching color (#666666)?> then\n            change y by ((-1) * (yv))\n            set [yv v] to [-3]\n        end\n        change y by (2)\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (diamond6 v)?> then\n        switch costume to (f v)\n    end\n    if <touching (diamond7 v)?> then\n        switch costume to (l v)\n    end\n    if <touching (diamond2 v)?> then\n        switch costume to (e v)\n    end\n    if <touching (diamond3 v)?> then\n        switch costume to (d v)\n    end\n    if <touching (diamond4 v)?> then\n        switch costume to (c v)\n    end\n    if <touching (diamond5 v)?> then\n        switch costume to (b v)\n    end\nend\n\nwhen I receive [game over v]\nhide\n\nhide\n\n@Sprite4\n\nwhen I receive [back v]\nshow\ngo to x: (-3000) y: (-33)\nset [ghost v] effect to (0)\nrepeat (25)\n    change x by (((0) - (x position)) * (0.2))\nend\nwait until <<touching (mouse-pointer v)?> and <mouse down?>>\nwait until <not <mouse down?>>\nif <touching (mouse-pointer v)?> then\n    broadcast (starts v)\n    stop [this script v]\nend\n\nwhen flag clicked\nset [start on v] to [yes]\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to (190) %\n    else\n        set size to (160) %\n    end\nend\n\nwhen I receive [starts v]\nset [start on v] to [off]\nset [play1 v] to [10]\nrepeat until \n    change y by (play1)\n    change [play1 v] by (-2)\n    if <touching (_edge_ v)?> then\n        hide\n        stop [this script v]\n    end\nend\n\nwhen I receive [game over v]\nhide\n\n@Sprite2\n\nwhen flag clicked\nset [start on v] to [yes]\nbroadcast (back v)\nforever\n    set volume to (50) %\n    play sound [Beliver v] until done\nend\n\nwhen I receive [back v]\nshow\ngo to x: (50) y: (45)\nset [ghost v] effect to (80)\nrepeat (25)\n    change x by (((-5) - (x position)) * (0.05))\n    change [ghost v] effect by (-10)\nend\n\nwhen I receive [starts v]\nset [start on v] to [off]\nset [play1 v] to [10]\nrepeat until \n    change y by (play1)\nend\nhide\n\nwhen I receive [game over v]\nhide\n\n@Sprite6\n\nwhen I receive [starts v]\nshow\n\nwhen flag clicked\ngo to x: (77) y: (-110)\n\nwhen I receive [game over v]\nhide\n\n@Sprite3\n\nwhen flag clicked\nset [level v] to [1]\nshow\nswitch costume to (1 v)\nforever\n    if <(costume [number v]) = [1]> then\n        set [level v] to [1]\n        go to x: (91) y: (-78)\n    end\n    if <(costume [number v]) = [2]> then\n        set [level v] to [2]\n        go to x: (91) y: (-78)\n    end\n    if <(costume [number v]) = [3]> then\n        switch costume to (3 v)\n        set [level v] to [3]\n        go to x: (91) y: (-78)\n    end\n    if <(costume [number v]) = [4]> then\n        switch costume to (4 v)\n        set [level v] to [4]\n        go to x: (91) y: (-78)\n    end\n    if <(costume [number v]) = [5]> then\n        go to x: (91) y: (-78)\n        switch costume to (5 v)\n        set [level v] to [5]\n    end\n    if <(costume [number v]) = [6]> then\n        go to x: (91) y: (-78)\n        switch costume to (6 v)\n        set [level v] to [6]\n    end\n    if <(costume [number v]) = [7]> then\n        go to x: (91) y: (-78)\n        switch costume to (7 v)\n        set [level v] to [7]\n    end\n    if <(costume [number v]) = [8]> then\n        go to x: (25) y: (-76)\n        switch costume to (8 v)\n        set [level v] to [8]\n    end\nend\n\nwhen I receive [next level v]\nnext costume\n\nwhen I receive [game over v]\nswitch costume to (1 v)\n\n@Sprite5\n\nwhen I receive [starts v]\nset [level v] to [1]\ngo to x: (146) y: (-131)\nwait (0.8) seconds\nshow\nforever\n    next costume\n    wait (0.05) seconds\n    if <(LEVEL) = [2]> then\n        go to x: (144) y: (36)\n    end\n    if <(LEVEL) = [3]> then\n        go to x: (146) y: (-131)\n    end\n    if <(LEVEL) = [4]> then\n        go to x: (144) y: (-131)\n    end\n    if <(LEVEL) = [5]> then\n        go to x: (-38) y: (-127)\n    end\n    if <(LEVEL) = [6]> then\n        go to x: (145) y: (-130)\n    end\n    if <(LEVEL) = [8]> then\n        go to x: (126) y: (-130)\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [game over v]\nhide\n\n@Sprite7\n\nwhen flag clicked\nset [level v] to [1]\nhide\nforever\n    if <<(LEVEL) = [3]> or <(LEVEL) = [7]>> then\n        show\n        go to x: (-56) y: (-88)\n    end\n    if <not <<(LEVEL) = [3]> or <(LEVEL) = [7]>>> then\n        hide\n    end\n    if <touching (sprite1 v)?> then\n        broadcast (life v)\n    end\nend\n\nwhen I receive [game over v]\nforever\n    hide\nend\n\n@diamond2\n\nwhen flag clicked\nhide\nswitch costume to (b v)\nforever\n    if <<(LEVEL) = [1]> and <(start on) = [off]>> then\n        show\n        switch costume to (f v)\n        go to x: (-1) y: (-113)\n    end\n    if <not <(LEVEL) = [1]>> then\n        hide\n    end\n    if <touching (sprite1 v)?> then\n        set [diomond yes v] to [yes]\n        wait (0.001) seconds\n        forever\n            hide\n        end\n    end\nend\n\nwhen I receive [game over v]\nhide\n\n@Sprite8\n\nwhen flag clicked\nset [level v] to [1]\nhide\nforever\n    if <(LEVEL) = [4]> then\n        show\n        go to x: (-86) y: (-85)\n    end\n    if <not <<(LEVEL) = [4]> or <(LEVEL) = [8]>>> then\n        hide\n    end\n    if <touching (sprite1 v)?> then\n        broadcast (life v)\n    end\n    if <(LEVEL) = [8]> then\n        show\n        go to x: (-60) y: (88)\n    end\nend\n\nwhen I receive [game over v]\nhide\n\n@diamond3\n\nwhen flag clicked\nswitch costume to (d v)\nhide\nforever\n    if <(LEVEL) = [1]> then\n        hide\n    end\n    if <(LEVEL) = [4]> then\n        show\n        switch costume to (b v)\n        go to x: (2) y: (-90)\n    end\n    if <not <(LEVEL) = [4]>> then\n        hide\n    end\n    if <touching (sprite1 v)?> then\n        set [diomond yes v] to [yes]\n        wait (0.001) seconds\n        forever\n            hide\n        end\n    end\nend\n\nwhen I receive [game over v]\nhide\n\n@Sprite9\n\nwhen flag clicked\nset [level v] to [1]\nhide\nforever\n    if <(LEVEL) = [5]> then\n        show\n        go to x: (15) y: (-58)\n    end\n    if <not <(LEVEL) = [5]>> then\n        hide\n    end\n    if <touching (sprite1 v)?> then\n        broadcast (life v)\n    end\nend\n\nhide\n\nshow\n\nwhen I receive [game over v]\nhide\n\n@diamond4\n\nwhen flag clicked\nswitch costume to (d v)\nhide\nforever\n    if <(LEVEL) = [1]> then\n        hide\n    end\n    if <(LEVEL) = [3]> then\n        show\n        switch costume to (e v)\n        go to x: (24) y: (70)\n    end\n    if <not <(LEVEL) = [3]>> then\n        hide\n    end\n    if <touching (sprite1 v)?> then\n        set [diomond yes v] to [yes]\n        wait (0.001) seconds\n        forever\n            hide\n        end\n    end\nend\n\nwhen I receive [game over v]\nforever\n    hide\nend\n\n@diamond5\n\nwhen flag clicked\nswitch costume to (d v)\nhide\nforever\n    if <(LEVEL) = [1]> then\n        hide\n    end\n    if <(LEVEL) = [5]> then\n        show\n        switch costume to (d v)\n        go to x: (53) y: (32)\n    end\n    if <not <(LEVEL) = [5]>> then\n        hide\n    end\n    if <touching (sprite1 v)?> then\n        set [diomond yes v] to [yes]\n        wait (0.001) seconds\n        forever\n            hide\n        end\n    end\nend\n\nshow\n\nwhen I receive [game over v]\nhide\n\n@Sprite10\n\nwhen I receive [rules v]\nshow\nnext costume\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\n\nwhen I receive [game over v]\nhide\n\n@Sprite11\n\nwhen flag clicked\nswitch costume to (costume4 v)\nhide\n\nwhen I receive [starts v]\nshow\n\nwhen this sprite clicked\nswitch costume to (costume3 v)\nbroadcast (rules v)\n\nwhen I receive [game over v]\nhide\n\n@Sprite12\n\nwhen flag clicked\nset [level v] to [1]\nhide\nforever\n    if <(LEVEL) = [6]> then\n        show\n        go to x: (139) y: (50)\n    end\n    if <not <(LEVEL) = [6]>> then\n        hide\n    end\n    if <touching (sprite1 v)?> then\n        broadcast (life v)\n    end\nend\n\nwhen I receive [game over v]\nhide\n\nshow\n\ngo to [front v] layer\n\n@diamond6\n\nwhen flag clicked\ngo to [front v] layer\nswitch costume to (d v)\nhide\nforever\n    if <(LEVEL) = [1]> then\n        hide\n    end\n    if <(LEVEL) = [6]> then\n        show\n        switch costume to (c v)\n        go to x: (97) y: (1)\n    end\n    if <not <(LEVEL) = [6]>> then\n        hide\n    end\n    if <touching (sprite1 v)?> then\n        set [diomond yes v] to [yes]\n        wait (0.001) seconds\n        forever\n            hide\n        end\n    end\nend\n\nshow\n\nwhen I receive [game over v]\nhide\n\n@diamond7\n\nwhen flag clicked\nswitch costume to (d v)\nhide\nforever\n    if <(LEVEL) = [1]> then\n        hide\n    end\n    if <(LEVEL) = [7]> then\n        show\n        switch costume to (c2 v)\n        go to x: (23) y: (64)\n    end\n    if <not <(LEVEL) = [7]>> then\n        hide\n    end\n    if <touching (sprite1 v)?> then\n        set [diomond yes v] to [yes]\n        wait (0.001) seconds\n        forever\n            hide\n        end\n    end\nend\n\nwhen I receive [game over v]\nhide\n\n@Sprite13\n\nwhen flag clicked\nhide\ngo to x: (211) y: (131)\n\nwhen I receive [life v]\nnext costume\nif <(costume [number v]) = [5]> then\n    wait (1) seconds\n    broadcast (game over v)\nend\n\nwhen I receive [starts v]\nswitch costume to (1 v)\nshow\n\n@Sprite14\n\nwhen flag clicked\nhide\n\nwhen I receive [game over v]\nshow\nstop [all v]\n\n@Sprite15\n\nwhen flag clicked\nhide\nset [level v] to [1]\nhide\ngo to x: (-42) y: (112)\n\nwhen I receive [game over v]\nhide\n\nif <(LEVEL) = [8]> then\n    show\nend\nif <not <(LEVEL) = [8]>> then\n    hide\nend\nif <touching (sprite1 v)?> then\n    broadcast (life v)\nend\n\nshow\n\nforever\n    point in direction (180)\n    change x by (1)\nend\n\n@Sprite16\n\nwhen flag clicked\ngo to [front v] layer\nhide\n\nshow\n\n@Sprite17\n\nwhen this sprite clicked\nstop [all v]\n\n