Platformer (Pen)


@Stage\n\nwhen flag clicked\nforever\n    set volume to (pick random (40) to (100)) %\nend\n\nwhen flag clicked\nclear graphic effects\nswitch backdrop to (backdrop1 v)\n\nwhen I receive [next level v]\nnext backdrop\n\nwhen flag clicked\nbroadcast (start v)\n\nwhen flag clicked\nif  then\nend\n\nwhen flag clicked\nforever\n    play sound [Iron Fire v] until done\nend\n\n@Sprite1\n\nwhen I receive [start v]\nshow\ngo to x: (-200) y: (0)\npoint in direction (90)\nset [xv v] to [0]\nset [yv v] to [0]\nswitch costume to (costume1 v)\nset volume to (10) %\nforever\n    change [yv v] by (-0.5)\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [xv v] by (-1)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [xv v] by (1)\n    end\n    set [xv v] to ((XV) * (0.8))\n    change x by (XV)\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 y by (1)\n                        if <touching color (#000000)?> then\n                            change y by (1)\n                            if <touching color (#000000)?> then\n                                change y by (-6)\n                                if <key (up arrow v) pressed?> then\n                                    set [yv v] to [10]\n                                    if <(XV) > [0]> then\n                                        set [xv v] to [-10]\n                                    else\n                                        set [xv v] to [10]\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 (#000000)?> 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 (#000000)?> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        start sound [Mario_Jumping-Mike_Koenig-989896458.mp3 v]\n        set [yv v] to [10]\n    end\n    if <<touching color (#cc0000)?> or <touching color (#ff00bf)?>> then\n        go to x: (-200) y: (0)\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\n    if <touching color (#7f00ff)?> then\n        set [yv v] to [11]\n    end\n    if <[230] < (x position)> then\n        if <(backdrop [name v]) = [7]> then\n            broadcast (Stop v)\n            stop [other scripts in sprite v]\n            stop [this script v]\n        end\n        go to x: (-200) y: (0)\n        set [xv v] to [0]\n        set [yv v] to [0]\n        broadcast (Next level v)\n    end\n    if <key (r v) pressed?> then\n        go to x: (-200) y: (0)\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\n    change y by (0.5)\nend\n\nwhen I receive [up v]\ngo to x: (x position) y: (0)\n\nwhen I receive [start v]\nforever\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        point in direction (-90)\n        next costume\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        point in direction (90)\n        next costume\n    end\n    if <not <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>>> then\n        switch costume to (costume1 v)\n    end\n    wait (0.05) seconds\nend\n\nset volume to (10) %\n\nwhen flag clicked\nhide\n\n@Sprite2\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nhide\n\n@Sprite3\n\nwhen flag clicked\nhide\n\nwhen flag clicked\n\n