scrolling platformer v.1.3
@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop3 v)\n\nwhen I receive [start game v]\nswitch backdrop to (backdrop2 v)\n\n@Sprite1\n\nwhen I receive [loop v]\nshow\nforever\n    broadcast (animate v) and wait\n    if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n        turbo check\n    end\n    wait (0.03) seconds\nend\n\nwhen I receive [layer4 v]\ngo to [front v] layer\nbroadcast (layer5 v)\n\nwhen flag clicked\nshow\ngo to x: (-143) y: (-32)\npoint in direction (90)\nforever\n    play sound [Return of the Heroes.mp3 v] until done\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [start game v]\nshow\n\ndefine turbo check\nchange y by (-4)\nif <touching color (#ffff00)?> then\n    broadcast (message1 v) and wait\nend\nchange y by (4)\n\nforever\n    if <key (right arrow v) pressed?> then\n        change [xv v] by (1)\n    end\n    if <key (left arrow v) pressed?> then\n        change [xv v] by (-1)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching color (#666666)?> then\n        change y by (1)\n        if <touching color (#666666)?> then\n            change y by (1)\n            if <touching color (#666666)?> then\n                change y by (1)\n                if <touching color (#666666)?> then\n                    change y by (1)\n                    if <touching color (#666666)?> then\n                        change y by (1)\n                        if <touching color (#666666)?> then\n                            change x by ((Xv) * (-1))\n                            change y by (-5)\n                            if <key (up arrow v) pressed?> then\n                                if <(Xv) > [0]> then\n                                    set [xv v] to [-5]\n                                else\n                                    set [xv v] to [5]\n                                end\n                                set [yv v] to [10]\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [yv v] by (-1)\n    change y by (Yv)\n    if <touching color (#666666)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching color (#666666)?> then\n        if <key (up arrow v) pressed?> then\n            set [yv v] to [15]\n        end\n    end\n    change y by (1)\nend\n\n@Sprite2\n\nwhen I receive [message1 v]\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\n    change [whirl v] effect by (150)\n    wait (0.1) seconds\nend\nnext costume\ngo to x: (145) y: (28)\nset [yv v] to [-15]\nchange y by (-15)\nrepeat (10)\n    change [ghost v] effect by (-10)\n    change [whirl v] effect by (-150)\n    wait (0.1) seconds\nend\n\nif <key (right arrow v) pressed?> then\n    change [xv v] by (1)\nend\nif <key (left arrow v) pressed?> then\n    change [xv v] by (-1)\nend\nset [xv v] to ((Xv) * (0.9))\nchange x by (Xv)\nif <touching color (#666666)?> then\n    change y by (1)\n    if <touching color (#666666)?> then\n        change y by (1)\n        if <touching color (#666666)?> then\n            change y by (1)\n            if <touching color (#666666)?> then\n                change y by (1)\n                if <touching color (#666666)?> then\n                    change y by (1)\n                    if <touching color (#666666)?> then\n                        change x by ((Xv) * (-1))\n                        change y by (-5)\n                        if <key (up arrow v) pressed?> then\n                            if <(Xv) > [0]> then\n                                set [xv v] to [-15]\n                            else\n                                set [xv v] to [15]\n                            end\n                            set [yv v] to [10]\n                        else\n                            set [xv v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange [yv v] by (-1)\nchange y by (Yv)\nif <touching color (#666666)?> then\n    change y by ((Yv) * (-1))\n    set [yv v] to [0]\nend\nchange y by (-1)\nif <touching color (#666666)?> then\n    if <key (up arrow v) pressed?> then\n        set [yv v] to [15]\n    end\nend\nchange y by (1)\n\nwhen flag clicked\nforever\n    if <(Yv) > [40]> then\n        if <(costume [number v]) = [5]> then\n            go to x: (145) y: (8)\n            set [yv v] to [-15]\n        else\n            go to x: (145) y: (28)\n            set [yv v] to [-15]\n        end\n    end\nend\n\nwhen I receive [animate v]\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    change [xv v] by (-1)\nend\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    change [xv v] by (1)\nend\nset [xv v] to ((Xv) * (0.9))\nchange x by (Xv)\nif <touching (sprite1 v)?> then\n    change y by (-1)\n    if <touching (sprite1 v)?> then\n        change y by (-1)\n        if <touching (sprite1 v)?> then\n            change y by (-1)\n            if <touching (sprite1 v)?> then\n                change y by (-1)\n                if <touching (sprite1 v)?> then\n                    change y by (-1)\n                    if <touching (sprite1 v)?> then\n                        change y by (-1)\n                        if <touching (sprite1 v)?> then\n                            change y by (-1)\n                            if <touching (sprite1 v)?> then\n                                change x by ((Xv) * (-1))\n                                change y by (7)\n                                if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> then\n                                    if <(Xv) > [0]> then\n                                        set [xv v] to [-15]\n                                    else\n                                        set [xv v] to [15]\n                                    end\n                                    set [yv v] to [-10]\n                                else\n                                    set [xv v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange [yv v] by (1)\nchange y by (Yv)\nif <touching (sprite1 v)?> then\n    change y by ((Yv) * (-1))\n    set [yv v] to [0]\nend\nchange y by (1)\nif <touching (sprite1 v)?> then\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> then\n        set [yv v] to [-15]\n    end\nend\nchange y by (-1)\n\nwhen I receive [layer3 v]\ngo to [front v] layer\nbroadcast (layer4 v)\n\ndefine None\nset [rawangle v] to ([acos v] of ((X) / (Distance)) )\nset [v v] to (speed)\nrepeat until <<<((ypos) - (3)) < (y position)> and <(y position) < ((ypos) + (3))>> and <<((xpos) - (3)) < (x position)> and <(x position) < ((xpos) + (3))>>>\n    change x by (((xpos) - (x position)) * ((V) / (8)))\n    change y by (((ypos) - (y position)) * ((V) / (8)))\n    wait (0.035) seconds\nend\nrepeat (4)\n    change x by (((xpos) - (x position)) * ((V) / (8)))\n    change y by (((ypos) - (y position)) * ((V) / (8)))\n    set [v v] to ((V) / (1.2))\n    wait (0.035) seconds\nend\n\ndefine None\nset [rawangle v] to ([acos v] of ((X) / (Distance)) )\nset [v v] to (speed)\nrepeat until <<<((ypos) - (3)) < (y position)> and <(y position) < ((ypos) + (3))>> and <<((xpos) - (3)) < (x position)> and <(x position) < ((xpos) + (3))>>>\n    change x by (((xpos) - (x position)) * ((V) / (8)))\n    change y by (((ypos) - (y position)) * ((V) / (8)))\n    wait (0.035) seconds\nend\n\nwhen I receive [start game v]\nhide\ngo to x: (240) y: (279)\nwait (1) seconds\nswitch costume to (costume1 v)\nshow\nGlide (240) (28) (1)\nquick glide x: (125) y: (78) Speed: (3)\ngo to x: (125) y: (78)\nset [yv v] to [-10]\nset [xv v] to [-5]\nbroadcast (loop v)\n\nwhen flag clicked\nhide\n\n@Sprite3\n\nset [ghost v] effect to (20)\n\nwhen I receive [layer5 v]\ngo to [front v] layer\nbroadcast (layer6 v)\n\ngo to x: (-140) y: (-152)\n\nwhen flag clicked\nhide\n\nwhen I receive [start game v]\nshow\nforever\n    set [ghost v] effect to (20)\n    set x to (([x position v] of [sprite2 v]) * (1.5))\n    set y to (([y position v] of [sprite2 v]) * (1.5))\n    if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n        hide\n    else\n        show\n    end\nend\n\n@Sprite4\n\ngo [backward v] (5) layers\n\nwhen I receive [layer2 v]\ngo to [front v] layer\nbroadcast (layer3 v)\n\nset [ghost v] effect to (25)\n\nwhen flag clicked\nhide\n\nwhen I receive [start game v]\nbroadcast (layer v)\nshow\nforever\n    set [ghost v] effect to (25)\n    set x to (([x position v] of [sprite2 v]) * (0.5))\n    set y to (([y position v] of [sprite2 v]) * (0.5))\nend\n\n@Sprite5\n\nwhen flag clicked\nshow\nforever\n    go to (sprite6 v)\nend\n\ngo [backward v] (6) layers\n\nwhen I receive [layer6 v]\ngo to (sprite6 v)\ngo to [front v] layer\n\nwhen [8 v] key pressed\nbroadcast (layer v)\n\nwhen flag clicked\nhide\n\nwhen I receive [start game v]\nshow\n\n@Sprite6\n\nwhen flag clicked\nshow\nforever\n    set x to (([x position v] of [sprite2 v]) * (0.1))\n    set y to (([y position v] of [sprite2 v]) * (0.1))\nend\n\nwhen I receive [layer v]\ngo to [front v] layer\nbroadcast (layer2 v)\n\nwhen flag clicked\nhide\n\nwhen I receive [start game v]\nshow\n\n@Sprite7\n\ndefine None\nset [rawangle v] to ([acos v] of ((X) / (Distance)) )\nset [v v] to (speed)\nrepeat until <<<((ypos) - (3)) < (y position)> and <(y position) < ((ypos) + (3))>> and <<((xpos) - (3)) < (x position)> and <(x position) < ((xpos) + (3))>>>\n    change x by (((xpos) - (x position)) * ((V) / (8)))\n    change y by (((ypos) - (y position)) * ((V) / (8)))\n    wait (0.03) seconds\nend\nrepeat (4)\n    change x by (((xpos) - (x position)) * ((V) / (8)))\n    change y by (((ypos) - (y position)) * ((V) / (8)))\n    set [v v] to ((V) / (1.2))\n    wait (0.03) seconds\nend\n\nwhen this sprite clicked\nstop [other scripts in sprite v]\nbroadcast (Prestart v)\n\nwhen I receive [prestart v]\nGlide (1) (-180) (2)\nhide\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\ngo to x: (0) y: (-180)\nwait (2) seconds\nshow\nGlide (0) (0) (2)\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (costume2 v)\n    else\n        switch costume to (costume1 v)\n    end\nend\n\n@Sprite8\n\ndefine None\nset [rawangle v] to ([acos v] of ((X) / (Distance)) )\nset [v v] to (speed)\nrepeat until <<<((ypos) - (3)) < (y position)> and <(y position) < ((ypos) + (3))>> and <<((xpos) - (3)) < (x position)> and <(x position) < ((xpos) + (3))>>>\n    change x by (((xpos) - (x position)) * ((V) / (8)))\n    change y by (((ypos) - (y position)) * ((V) / (8)))\n    wait (0.03) seconds\nend\nrepeat (4)\n    change x by (((xpos) - (x position)) * ((V) / (8)))\n    change y by (((ypos) - (y position)) * ((V) / (8)))\n    set [v v] to ((V) / (1.2))\n    wait (0.03) seconds\nend\n\nwhen flag clicked\nhide\ngo to x: (0) y: (-180)\nwait (1) seconds\nshow\nGlide (0) (0) (2)\n\nwhen I receive [prestart v]\nwait (1) seconds\nGlide (0) (-300) (2)\nhide\nbroadcast (Start game v)\n\n