World of Elements 2- A platformer

Instructions: Welcome to World of Elements 2- A platformer my best project yet\nPLEASE PLAY PART ONE FIRST. LINK: https://scratch.mit.edu/projects/435084867/\nWORLD OF ELEMENTS 3 IS OUT!!! Link: \nhttps://scratch.mit.edu/projects/445324234/\nInstructions\n------------------------------------\narrow keys, wad or swipe to move\npress n to skip a level\n press space to attack\ndon't touch enemies or spikes\n\n\nCredits\n------------------------\n@XXtra_Burn for Thumbnail \n\n

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nforever\n    if <([costume # v] of [ground v]) = [6]> then\n        switch backdrop to (backdrop2 v)\n    end\n    if <([costume # v] of [ground v]) = [12]> then\n        switch backdrop to (backdrop3 v)\n    end\n    if <([costume # v] of [ground v]) = [17]> then\n        switch backdrop to (backdrop6 v)\n    end\n    if <([costume # v] of [ground v]) = [22]> then\n        switch backdrop to (backdrop4 v)\n    end\n    if <([costume # v] of [ground v]) = [27]> then\n        switch backdrop to (backdrop5 v)\n    end\nend\n\n@Player\n\ndefine reset\nclear graphic effects\ngo to x: (-200) y: (-50)\npoint in direction (90)\nset [dead? v] to [0]\nset [x v v] to [0]\nset [y v v] to [0]\nset size to (100) %\nshow\n\nwhen I receive [next level v]\nset [change? v] to [1]\nreset\nset [change? v] to [0]\n\nwhen I receive [game begin v]\nset [level v] to [1]\nset [dead? v] to [0]\nset size to (100) %\nreset\nforever\n    go to [front v] layer\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        change [x v v] by (.9)\n        broadcast (right v)\n    end\n    if <<<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> and <(dead?) = [0]>> then\n        change [x v v] by (-.9)\n        broadcast (left v)\n    end\n    set [x v v] to ((X v) * (0.9))\n    change x by (X v)\n    if <touching (ground v)?> then\n        change y by (2)\n        if <touching (ground v)?> then\n            change y by (2)\n            if <touching (ground v)?> then\n                change y by (2)\n                if <touching (ground v)?> then\n                    change y by (2)\n                    if <touching (ground v)?> then\n                        change y by (2)\n                        if <touching (ground v)?> then\n                            change x by ((X v) * (-2))\n                            change y by (-5)\n                            if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > ((y position) + (20))>>>> then\n                                if <(X v) > [0]> then\n                                    set [x v v] to [-5]\n                                else\n                                    set [x v v] to [5]\n                                end\n                                set [y v v] to [13]\n                            else\n                                set [x v v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [y v v] by (-0.8)\n    change y by (Y v)\n    if <touching (ground v)?> then\n        change y by ((Y v) * (-1))\n        set [y v v] to [0]\n    end\n    change y by (-1)\n    if <touching (ground v)?> then\n        if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > ((y position) + (20))>>>> then\n            set [y v v] to [12]\n        end\n    end\n    change y by (1)\n    if <<<<<touching (killer wheel v)?> or <touching (spikes   v)?>> or <touching (killer wheel2 v)?>> or <touching (lightning v)?>> and <(dead?) = [0]>> then\n        Spin off screen\n    end\n    if <touching (jump pad v)?> then\n        set [y v v] to [20]\n    end\nend\n\nwhen I receive [game begin v]\nforever\n    set [direction v] to (direction)\nend\n\nwhen I receive [game begin v]\nset [change? v] to [0]\nforever\n    if <<(x position) = [240]> and <(dead?) = [0]>> then\n        broadcast (NEXT LEVEL v)\n        change [level v] by (1)\n    end\nend\n\nwhen I receive [game begin v]\nforever\n    if <(y position) = [-179]> then\n        Spin off screen\n    end\nend\n\nwhen [r v] key pressed\nif <(dead?) = [0]> then\n    reset\nend\n\nwhen flag clicked\nhide\ngo to [back v] layer\n\nwhen I receive [game begin v]\nshow\n\ndefine Spin off screen\nset [dead? v] to [1]\nchange [player death v] by (1)\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nreset\n\nwhen I receive [game begin v]\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nswitch costume to (center2 v)\nrepeat (10)\n    change [ghost v] effect by (5)\n    change size by (-5)\nend\ndelete this clone\n\nwhen I receive [game begin v]\nforever\n    if <touching (spikes   v)?> then\n        reset\n    end\nend\n\nwhen I receive [game begin v]\nforever\n    if <key (n v) pressed?> then\n        broadcast (NEXT LEVEL v)\n    end\nend\n\nwhen flag clicked\nbroadcast (Game begin v)\nforever\n    switch costume to (center v)\n    if <([costume # v] of [ground v]) = [6]> then\n        switch costume to (leaf v)\n    end\n    if <([costume # v] of [ground v]) = [7]> then\n        switch costume to (leaf v)\n    end\n    if <([costume # v] of [ground v]) = [8]> then\n        switch costume to (leaf v)\n    end\n    if <([costume # v] of [ground v]) = [9]> then\n        switch costume to (leaf v)\n    end\n    if <([costume # v] of [ground v]) = [10]> then\n        switch costume to (leaf v)\n    end\n    if <([costume # v] of [ground v]) = [11]> then\n        switch costume to (leaf v)\n    end\n    if <([costume # v] of [ground v]) = [12]> then\n        switch costume to (ice v)\n    end\n    if <([costume # v] of [ground v]) = [13]> then\n        switch costume to (ice v)\n    end\n    if <([costume # v] of [ground v]) = [14]> then\n        switch costume to (ice v)\n    end\n    if <([costume # v] of [ground v]) = [15]> then\n        switch costume to (ice v)\n    end\n    if <([costume # v] of [ground v]) = [16]> then\n        switch costume to (ice v)\n    end\n    if <([costume # v] of [ground v]) = [17]> then\n        switch costume to (wind v)\n    end\n    if <([costume # v] of [ground v]) = [18]> then\n        switch costume to (wind v)\n    end\n    if <([costume # v] of [ground v]) = [19]> then\n        switch costume to (wind v)\n    end\n    if <([costume # v] of [ground v]) = [20]> then\n        switch costume to (wind v)\n    end\n    if <([costume # v] of [ground v]) = [21]> then\n        switch costume to (wind v)\n    end\n    if <([costume # v] of [ground v]) = [22]> then\n        switch costume to (metal v)\n    end\n    if <([costume # v] of [ground v]) = [23]> then\n        switch costume to (metal v)\n    end\n    if <([costume # v] of [ground v]) = [24]> then\n        switch costume to (metal v)\n    end\n    if <([costume # v] of [ground v]) = [25]> then\n        switch costume to (metal v)\n    end\n    if <([costume # v] of [ground v]) = [26]> then\n        switch costume to (metal v)\n    end\n    if <([costume # v] of [ground v]) = [27]> then\n        switch costume to (metal v)\n    end\nend\n\nwhen I receive [game begin v]\nforever\n    if <touching (enemy v)?> then\n        reset\n    end\nend\n\nwhen flag clicked\nplay sound [Cosmosys - Seismic Wave v] until done\n\n@Ground\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen I receive [next level v]\nwait (0.01) seconds\nnext costume\n\n@deco\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen I receive [next level v]\nwait (0.01) seconds\nnext costume\n\n@Spikes  \n\nwhen flag clicked\ngo [backward v] (1) layers\nswitch costume to (costume1 v)\n\nwhen I receive [next level v]\nwait (0.01) seconds\nnext costume\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n@attacks\n\nwhen flag clicked\nforever\n    switch costume to (costume1 v)\n    hide\n    if <([costume # v] of [ground v]) = [6]> then\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [7]> then\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [8]> then\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [9]> then\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [12]> then\n        switch costume to (costume2 v)\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [13]> then\n        switch costume to (costume2 v)\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [14]> then\n        switch costume to (costume2 v)\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [15]> then\n        switch costume to (costume2 v)\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [16]> then\n        switch costume to (costume2 v)\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [17]> then\n        switch costume to (costume3 v)\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [18]> then\n        switch costume to (costume3 v)\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [19]> then\n        switch costume to (costume3 v)\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [20]> then\n        switch costume to (costume3 v)\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [21]> then\n        switch costume to (costume3 v)\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [22]> then\n        switch costume to (costume4 v)\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [23]> then\n        switch costume to (costume4 v)\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [24]> then\n        switch costume to (costume4 v)\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [25]> then\n        switch costume to (costume4 v)\n        go to (player v)\n    end\n    if <([costume # v] of [ground v]) = [26]> then\n        switch costume to (costume4 v)\n        go to (player v)\n    end\n    if <key (space v) pressed?> then\n        show\n        repeat (10)\n            move (16) steps\n        end\n        go to (player v)\n    end\nend\n\nwhen I receive [left v]\npoint in direction (-90)\n\nwhen I receive [right v]\npoint in direction (90)\n\nwhen flag clicked\nforever\n    if <touching (enemy v)?> then\n        broadcast (Enemy hit v)\n    end\nend\n\n@enemy\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    if <([costume # v] of [ground v]) = [9]> then\n        show\n        glide (1) secs to x: (169) y: (-80)\n        glide (1) secs to x: (-134) y: (-80)\n        glide (1) secs to x: (169) y: (-80)\n        glide (1) secs to x: (-134) y: (-80)\n    end\n    if <([costume # v] of [ground v]) = [10]> then\n        show\n        go to x: (80) y: (-59)\n        glide (1) secs to x: (-25) y: (-59)\n        glide (1) secs to x: (80) y: (-59)\n    end\n    if <([costume # v] of [ground v]) = [13]> then\n        show\n        glide (1) secs to x: (169) y: (-105)\n        glide (1) secs to x: (-134) y: (-105)\n        glide (1) secs to x: (169) y: (-105)\n        glide (1) secs to x: (-134) y: (-105)\n    end\n    if <([costume # v] of [ground v]) = [14]> then\n        show\n        glide (1) secs to x: (169) y: (-105)\n        glide (1) secs to x: (-134) y: (-105)\n        glide (1) secs to x: (169) y: (-105)\n        glide (1) secs to x: (-134) y: (-105)\n    end\n    if <([costume # v] of [ground v]) = [21]> then\n        show\n        glide (1) secs to x: (169) y: (-38)\n        glide (1) secs to x: (-134) y: (-38)\n        glide (1) secs to x: (169) y: (-38)\n        glide (1) secs to x: (-134) y: (-38)\n    end\n    if <([costume # v] of [ground v]) = [25]> then\n        show\n        go to x: (-50) y: (-95)\n        glide (1) secs to x: (-140) y: (-95)\n        glide (1) secs to x: (-92) y: (-10)\n        glide (1) secs to x: (-74) y: (26)\n        glide (1) secs to x: (-56) y: (38)\n        glide (1) secs to x: (41) y: (36)\n        glide (1) secs to x: (-56) y: (38)\n        glide (1) secs to x: (-74) y: (26)\n        glide (1) secs to x: (-92) y: (10)\n        glide (1) secs to x: (-140) y: (-95)\n        glide (1) secs to x: (-50) y: (-95)\n    end\nend\n\nwhen I receive [enemy hit v]\nswitch costume to (costume2 v)\n\nif <touching (attacks v)?> then\n    hide\nend\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\n\nhide\nswitch costume to (costume1 v)\n\nwhen I receive [next level v]\nhide\n\nwhen I receive [next level v]\nswitch costume to (costume1 v)\n\n@Jump Pad\n\nwhen flag clicked\nhide\nforever\n    if <([costume # v] of [ground v]) = [1]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [2]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [3]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [4]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [5]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [6]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [7]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [8]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [9]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [10]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [11]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [12]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [13]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [14]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [15]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [16]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [17]> then\n        hide\n    end\n    if <([costume # v] of [ground v]) = [18]> then\n        show\n        go to x: (-27) y: (-20)\n    end\n    if <([costume # v] of [ground v]) = [19]> then\n        show\n        go to x: (-27) y: (-1)\n    end\n    if <([costume # v] of [ground v]) = [20]> then\n        hide\n    end\nend\n\nwhen I receive [game begin v]\nswitch costume to (costume1 v)\nshow\nforever\n    if <touching (player v)?> then\n        repeat (6)\n            next costume\n            wait (.05) seconds\n        end\n    end\nend\n\n