Run - A Platformer

Instructions: [WASD] to Move

@Stage\n\nwhen flag clicked\nforever\n    play sound [World 1 v] until done\nend\n\n@Thumbnail\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n@Player\n\nwhen flag clicked\nbroadcast (Run the platformer v)\nhide\n\ndefine Reset the setup\nset size to (80) %\nset [x velocity v] to [0]\nset [y velocity v] to [0]\nset [idk y v] to [0]\ngo to x: (-200) y: (0)\nclear graphic effects\npoint in direction (90)\nshow\n\ndefine death\nset [idk y v] to [1]\nrepeat (25)\n    change size by (-5)\n    change [ghost v] effect by (5)\nend\nReset the setup\n\nwhen I receive [run the platformer v]\nset [level v] to [1]\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nrepeat (10)\n    change size by (-5)\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\nwhen I receive [run the platformer v]\nforever\n    if <<[235] < (x position)> and <(idk y) = [0]>> then\n        broadcast (Next level please? v)\n        change [level v] by (1)\n        Reset the setup\n    end\nend\n\nwhen I receive [run the platformer v]\nset size to (80) %\nset [idk y v] to [0]\nset [level v] to [1]\nReset the setup\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)>>> and <(idk y) = [0]>> then\n        change [x velocity v] by (2)\n    end\n    if <<<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> and <(idk y) = [0]>> then\n        change [x velocity v] by (-2)\n    end\n    set [x velocity v] to ((X velocity) * (0.8))\n    change x by (X velocity)\n    if <touching (level v)?> then\n        change y by (2)\n        if <touching (level v)?> then\n            change y by (2)\n            if <touching (level v)?> then\n                change y by (2)\n                if <touching (level v)?> then\n                    change y by (2)\n                    if <touching (level v)?> then\n                        change y by (2)\n                        if <touching (level v)?> then\n                            change x by ((X velocity) * (-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) + (10))>>>> then\n                                if <(X velocity) > [0]> then\n                                    set [x velocity v] to [-5]\n                                else\n                                    set [x velocity v] to [5]\n                                end\n                                set [y velocity v] to [13]\n                            else\n                                set [x velocity v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [y velocity v] by (-0.8)\n    change y by (Y velocity)\n    if <touching (level v)?> then\n        change y by ((Y velocity) * (-1))\n        set [y velocity v] to [0]\n    end\n    change y by (-1)\n    if <touching (level v)?> then\n        if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > ((y position) + (10))>>>> then\n            set [y velocity v] to [12]\n        end\n    end\n    change y by (1)\n    if <touching (danger v)?> then\n        death\n    end\n    if <(y position) < [-178]> then\n        death\n    end\nend\n\nwhen I receive [run the platformer v]\nforever\n    if <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> then\n        switch costume to (right v)\n    end\n    if <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> then\n        switch costume to (left v)\n    end\n    if <<<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> and <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>> then\n        switch costume to (up-left v)\n    end\n    if <<<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> and <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>> then\n        switch costume to (up-right v)\n    end\n    if <not <<key (right arrow v) pressed?> or <<key (left arrow v) pressed?> or <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<key (a v) pressed?> or <<key (d v) pressed?> or <<<mouse down?> and <(mouse x) > (x position)>> or <<mouse down?> and <(mouse x) < (x position)>>>>>>>>>> then\n        switch costume to (default v)\n    end\nend\n\n@Level\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\nend\n\n@Danger\n\nwhen flag clicked\nforever\n    switch costume to (Level)\nend\n\n@Text\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo [forward v] (20) layers\nforever\n    switch costume to (Level)\nend\n\n@Background\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    go to [back v] layer\n    switch costume to (Level)\nend\n\n@Love fave\n\nwhen flag clicked\nset [costume v] to [0]\nhide\nforever\n    if <not <<(Love) = [1]> and <(Favorite) = [1]>>> then\n        wait (pick random (30) to (40)) seconds\n        switch costume to (costume1 v)\n        go to x: (0) y: (50)\n        show\n        go to [front v] layer\n        start sound [pop v]\n        repeat (9)\n            change y by (-6)\n        end\n        repeat (5)\n            change y by (3)\n        end\n        repeat (5)\n            change y by (-1)\n        end\n        wait (2) seconds\n        repeat (15)\n            change y by (7)\n        end\n        hide\n    end\n    if <(Costume) > [0]> then\n        hide\n        stop [this script v]\n    end\nend\n\n