Worlds // A platformer

Instructions: Look my second platformer!!!\nWorlds 2 // A platformer:\nhttps://scratch.mit.edu/projects/395411531/\n\n___________________Worlds___________________\nUse WASD KEYS or ARROW KEYS to move the character.\nDo not touch the spikes.\nThere are 3 worlds !!!\nn: To skip level\nr: To reset the level\n\nRemember: \n- follow @blinsing\n- Put a like\n- And reinvent yourself to make your own platform games!!!

@Stage\n\nwhen flag clicked\nswitch backdrop to (fons4 v)\nforever\n    if <(LEVEL) = [7]> then\n        switch backdrop to (fons2 v)\n    end\n    if <(LEVEL) > [7]> then\n        switch backdrop to (fons3 v)\n    end\nend\n\nwhen I receive [play play v]\nswitch backdrop to (fons1 v)\n\n@Player\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\ngo to [front v] layer\nclear graphic effects\nset [ghost v] effect to (0)\nset size to (100) %\npoint in direction (90)\ngo to x: (-219) y: (-100)\nshow\nset [lvl. # v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nforever\n    change [y v] by (-1)\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [x v] by (-1)\n        point in direction (-90)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [x v] by (1)\n        point in direction (90)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching (platformer level v)?> then\n        change y by (1)\n    end\n    if <touching (platformer level v)?> then\n        change y by (1)\n    end\n    if <touching (platformer level v)?> then\n        change y by (1)\n    end\n    if <touching (platformer level v)?> then\n        change y by (1)\n    end\n    if <touching (platformer level v)?> then\n        change y by (-4)\n        change x by ((x) * (-1))\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [y v] to [15]\n            if <([abs v] of (x) ) = (x)> then\n                set [x v] to [-10]\n            else\n                set [x v] to [10]\n            end\n        else\n            set [x v] to [0]\n        end\n    end\n    change y by (y)\n    if <touching (platformer level v)?> then\n        change y by ((y) - ((y) * (2)))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <touching (platformer level v)?>> then\n        set [y v] to [12.5]\n    end\n    change y by (1)\n    if <touching (platformer level v)?> then\n        set [y v] to [1]\n    end\n    if <(x position) > [231]> then\n        broadcast (seguent v)\n        broadcast (play v)\n    end\n    if <<touching (trampolí v)?> or <<touching (trampolí2 v)?> or <touching (trampolí3 v)?>>> then\n        set [y v] to [20]\n    end\n    if <touching (spikes v)?> then\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        broadcast (play v)\n    end\n    if <(y position) < [-178]> then\n        broadcast (play v)\n    end\nend\n\nwhen flag clicked\nforever\n    switch costume to ([costume # v] of [player selected v])\nend\n\nwhen I receive [play play v]\nforever\n    if <key (r v) pressed?> then\n        broadcast (play v)\n    end\n    if <key (n v) pressed?> then\n        broadcast (seguent v)\n        broadcast (play v)\n        wait (1) seconds\n    end\nend\n\nwhen flag clicked\nforever\n    play sound (pick random (1) to (2)) until done\nend\n\n@Player selected\n\nwhen flag clicked\ngo to [back v] layer\nset size to (100) %\nswitch costume to (vestit1 v)\ngo to x: (2) y: (53)\nshow\n\nwhen I receive [next v]\nrepeat (10)\n    change size by (-5)\n    change [ghost v] effect by (15)\nend\nnext costume\nrepeat (10)\n    change size by (5)\n    change [ghost v] effect by (-15)\nend\n\nwhen I receive [enredera v]\nrepeat (10)\n    change size by (-5)\n    change [ghost v] effect by (15)\nend\nswitch costume to ((costume [number v]) - (1))\nrepeat (10)\n    change size by (5)\n    change [ghost v] effect by (-15)\nend\n\nwhen I receive [play play v]\nhide\n\n@Platformer level\n\nwhen I receive [seguent v]\nchange [level v] by (1)\nwait (0.02) seconds\nnext costume\n\nwhen flag clicked\nset [level v] to [0]\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [play play v]\nshow\nswitch costume to (vestit1 v)\n\n@trampolí\n\nwhen flag clicked\nhide\nswitch costume to (trampolí v)\nforever\n    if <(LEVEL) = [1]> then\n        go to x: (-96) y: (-115)\n        show\n        if <touching (player v)?> then\n            switch costume to (trampolí2 v)\n            wait (0.1) seconds\n        else\n            switch costume to (trampolí v)\n        end\n    else\n        hide\n        if <(LEVEL) = [4]> then\n            go to x: (-143) y: (-115)\n            show\n            if <touching (player v)?> then\n                switch costume to (trampolí2 v)\n                wait (0.1) seconds\n            else\n                switch costume to (trampolí v)\n            end\n        else\n            hide\n            if <(LEVEL) = [8]> then\n                go to x: (-124) y: (-125)\n                show\n                if <touching (player v)?> then\n                    switch costume to (trampolí2 v)\n                    wait (0.1) seconds\n                else\n                    switch costume to (trampolí v)\n                end\n            else\n                hide\n                if <(LEVEL) = [14]> then\n                    go to x: (-105) y: (-125)\n                    show\n                    if <touching (player v)?> then\n                        switch costume to (trampolí2 v)\n                        wait (0.1) seconds\n                    else\n                        switch costume to (trampolí v)\n                    end\n                else\n                    hide\n                end\n            end\n        end\n    end\nend\n\n@trampolí2\n\nwhen flag clicked\nhide\nswitch costume to (trampolí v)\ngo to [back v] layer\nforever\n    if <(LEVEL) = [8]> then\n        go to x: (28) y: (-125)\n        show\n        if <touching (player v)?> then\n            switch costume to (trampolí2 v)\n            wait (0.1) seconds\n        else\n            switch costume to (trampolí v)\n        end\n    else\n        hide\n    end\nend\n\n@trampolí3\n\nwhen flag clicked\nhide\nswitch costume to (trampolí v)\nforever\n    if <(LEVEL) = [8]> then\n        go to x: (170) y: (-125)\n        show\n        if <touching (player v)?> then\n            switch costume to (trampolí2 v)\n            wait (0.1) seconds\n        else\n            switch costume to (trampolí v)\n        end\n    else\n        hide\n    end\nend\n\n@spikes\n\nwhen flag clicked\nhide\ngo [backward v] (5) layers\nforever\n    if <(LEVEL) = [2]> then\n        go to x: (6) y: (-110)\n        switch costume to (level2 v)\n        show\n    else\n        hide\n        if <(LEVEL) = [4]> then\n            go to x: (-18) y: (-110)\n            switch costume to (level4 v)\n            show\n        else\n            hide\n            if <(LEVEL) = [5]> then\n                go to x: (0) y: (-120)\n                switch costume to (level5 v)\n                show\n            else\n                hide\n                if <(LEVEL) = [6]> then\n                    go to x: (-13) y: (-10)\n                    switch costume to (punxes5 v)\n                    show\n                else\n                    hide\n                    if <(LEVEL) = [7]> then\n                        go to x: (-23) y: (-55)\n                        switch costume to (punxes7 v)\n                        show\n                    else\n                        hide\n                        if <(LEVEL) = [8]> then\n                            go to x: (-4) y: (60)\n                            switch costume to (punxes6 v)\n                            show\n                        else\n                            hide\n                            if <(LEVEL) = [9]> then\n                                go to x: (-4) y: (50)\n                                switch costume to (punxes2 v)\n                                show\n                            else\n                                hide\n                                if <(LEVEL) = [10]> then\n                                    go to x: (-8) y: (50)\n                                    switch costume to (punxes3 v)\n                                    show\n                                else\n                                    hide\n                                    if <(LEVEL) = [11]> then\n                                        go to x: (0) y: (50)\n                                        switch costume to (punxes4 v)\n                                        show\n                                    else\n                                        hide\n                                        if <(LEVEL) = [13]> then\n                                            go to x: (-4) y: (50)\n                                            switch costume to (punxes8 v)\n                                            show\n                                        else\n                                            hide\n                                            if <(LEVEL) = [14]> then\n                                                go to x: (-4) y: (60)\n                                                switch costume to (punxes9 v)\n                                                show\n                                            else\n                                                hide\n                                                if <(LEVEL) = [15]> then\n                                                    go to x: (-74) y: (-45)\n                                                    switch costume to (punxes10 v)\n                                                    show\n                                                else\n                                                    hide\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\n@Background stuff\n\nwhen I start as a clone\nshow\ngo to [back v] layer\npoint in direction (pick random (-70) to (-100))\ngo to x: (300) y: (pick random (-180) to (180))\nset size to (pick random (20) to (50)) %\nset [ghost v] effect to (pick random (40) to (90))\ngo to [back v] layer\nrepeat until <(x position) < [-220]>\n    move (5) steps\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    hide\n    create clone of (_myself_ v)\nend\n\n@TB\n\nwhen flag clicked\nhide variable [level v]\ngo to x: (0) y: (0)\nswitch costume to (1 v)\ngo to [front v] layer\nshow\nwait (2) seconds\nrepeat (20)\n    change [ghost v] effect by (10)\nend\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\n@play platformer\n\nwhen flag clicked\ngo to [back v] layer\ngo to x: (1) y: (-45)\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (20)\n        change size by (((220) - (size)) / (3))\n        if <mouse down?> then\n            hide\n            broadcast (play play v)\n            broadcast (play v)\n        end\n    else\n        set [brightness v] effect to (0)\n        set size to (200) %\n    end\nend\n\n@fletxa\n\nwhen flag clicked\ngo to x: (55) y: (55)\ngo to [back v] layer\nswitch costume to (play v)\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (40)\n        if <mouse down?> then\n            broadcast (next v)\n            wait (0.5) seconds\n        end\n    else\n        clear graphic effects\n    end\nend\n\nwhen I receive [play play v]\nhide\n\n@flexa2\n\nwhen flag clicked\ngo to x: (-52) y: (53)\nset [color v] effect to (0)\nswitch costume to (play v)\ngo to [back v] layer\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (40)\n        if <mouse down?> then\n            broadcast (enredera v)\n            wait (0.5) seconds\n        end\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I receive [play play v]\nhide\n\n@Personatge1\n\nwhen flag clicked\nhide\n\nwhen I receive [play play v]\ngo to [back v] layer\ngo to x: (154) y: (-116)\nforever\n    if <(LEVEL) = [0]> then\n        go to x: (154) y: (-100)\n        switch costume to (vestit1 v)\n        show\n    else\n        hide\n        if <(LEVEL) = [8]> then\n            go to x: (-15) y: (160)\n            switch costume to (vestit2 v)\n            show\n        else\n            hide\n            if <(LEVEL) = [13]> then\n                go to x: (75) y: (-20)\n                switch costume to (vestit3 v)\n                show\n            else\n                hide\n            end\n        end\n    end\nend\n\n@Congratulations\n\nwhen flag clicked\ngo to x: (2) y: (177)\nhide\nforever\n    if <(LEVEL) = [16]> then\n        show\n        glide (1) secs to x: (2) y: (0)\n        change [color v] effect by (25)\n    else\n        go to x: (2) y: (177)\n        hide\n    end\nend\n\n@skip button\n\nwhen this sprite clicked\nbroadcast (seguent v)\nbroadcast (play v)\n\nwhen I receive [play play v]\nshow\ngo to x: (-220) y: (120)\n\nwhen flag clicked\ngo to [front v] layer\nhide\n\n@restart button\n\nwhen this sprite clicked\nbroadcast (play v)\n\nwhen I receive [play play v]\nshow\ngo to x: (-220) y: (160)\n\nwhen flag clicked\ngo to [front v] layer\nhide\n\n