Scrolling Platformer Tutorial


@Stage\n\nwhen I receive [bad v]\nset [brightness v] effect to (100)\nwait (0.1) seconds\nset [brightness v] effect to (0)\n\n@Ground\n\nwhen flag clicked\nset [xv v] to [0]\nset [yv v] to [0]\nswitch costume to (costume2 v)\nset size to (600) %\nswitch costume to (costume1 v)\ngo to x: (-180) y: (471)\nshow\nbroadcast (levelStartSwitch v)\nforever\n    set [ghost v] effect to (0)\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        if <not <<key (left arrow v) pressed?> or <key (a v) pressed?>>> then\n            set [xv v] to [6]\n            change x by ((-1) * (XV))\n        end\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        set [xv v] to [-6]\n        change x by ((-1) * (XV))\n    end\n    if <not <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>>> then\n        set [xv v] to [0]\n    end\n    if <touching (player v)?> then\n        change y by (-1)\n        if <touching (player v)?> then\n            change y by (-1)\n            if <touching (player v)?> then\n                change y by (-1)\n                if <touching (player v)?> then\n                    change y by (-1)\n                    if <touching (player v)?> then\n                        change y by (-1)\n                        if <touching (player v)?> then\n                            change x by (XV)\n                            set [xv v] to [0]\n                            change y by (5)\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [yv v] by (1)\n    change y by (YV)\n    change [inair v] by (1)\n    if <touching (player v)?> then\n        set [inair v] to [0]\n        change y by ((YV) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (1)\n    if <<touching (player v)?> and <<<key (up arrow v) pressed?> or <key (space v) pressed?>> or <key (w v) pressed?>>> then\n        set [yv v] to [-20]\n    end\n    change y by (-1)\nend\n\nwhen I receive [bad v]\nset [brightness v] effect to (100)\nwait (0.1) seconds\nset [brightness v] effect to (0)\n\nwhen I receive [bad v]\ngo to x: (-180) y: (471)\n\nwhen flag clicked\nforever\n    if <(y position) > [670]> then\n        go to x: (-180) y: (471)\n    end\nend\n\n@Player\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\nwhen I receive [bad v]\nset [brightness v] effect to (100)\nwait (0.1) seconds\nset [brightness v] effect to (0)\n\n@Screen\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\n\nwhen I receive [bad v]\nset [brightness v] effect to (100)\nwait (0.1) seconds\nset [brightness v] effect to (0)\n\n@Bad\n\nwhen flag clicked\ncreate clone of (_myself_ v)\nhide\n\nwhen I receive [bad v]\nset [brightness v] effect to (100)\nwait (0.1) seconds\nset [brightness v] effect to (0)\n\nwhen I start as a clone\nswitch costume to (costume2 v)\nset size to (600) %\nswitch costume to (costume1 v)\ngo to x: (-180) y: (471)\nshow\nbroadcast (levelStartSwitch v)\nforever\n    go to (ground v)\nend\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        broadcast (bad v)\n    end\nend\n\n@Sprite1\n\nwhen flag clicked\nhide\n\n