+ - Math - A Scrolling Platformer × ÷

Instructions: + - × ÷ × - +\n\nDISCLAIMER: You might want to click the flag twice.\n\n+ - × ÷ × - +\n\nA or D/Left or Right Keys: Move\nW or Up Key: Jump\n\n+ - × ÷ × - +

@Stage\n\nwhen I receive [start v]\nforever\n    play sound [Loud Pipes v] until done\nend\n\n@Player\n\nwhen flag clicked\nset [xv v] to [0]\nset [yv v] to [0]\nset [scroll x v] to [230]\nset [scroll y v] to (item ([costume # v] of [floor v]) of [starting y v])\nset size to (100) %\nshow\n\nwhen I receive [start v]\npoint in direction (90)\nforever\n    if <(glitch) = [0]> then\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            change [xv 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 [xv v] by (1)\n            point in direction (90)\n        end\n        set [xv v] to ((Xv) * (0.9))\n        change x by (Xv)\n        if <touching (floor v)?> then\n            change y by (1)\n            if <touching (floor v)?> then\n                change y by (1)\n                if <touching (floor v)?> then\n                    change y by (1)\n                    if <touching (floor v)?> then\n                        change y by (1)\n                    end\n                    if <touching (floor v)?> then\n                        change y by (1)\n                        if <touching (floor v)?> then\n                            change x by ((Xv) * (-1))\n                            change y by (-5)\n                            if <<key (up arrow v) pressed?> or <key (w 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        change [yv v] by (-1)\n        change y by (Yv)\n        if <touching (floor v)?> then\n            change y by ((Yv) * (-1))\n            set [yv v] to [0]\n        end\n        change y by (-1)\n        if <touching (floor v)?> then\n            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                set [yv v] to [10]\n            end\n        end\n        change y by (1)\n        change [scroll x v] by ((x position) * (-1))\n        change [scroll y v] by ((y position) * (-1))\n        go to x: (0) y: (0)\n        if <touching (hazards v)?> then\n            point in direction (90)\n            set [scroll x v] to [230]\n            set [scroll y v] to (item ([costume # v] of [floor v]) of [starting y v])\n            set [xv v] to [0]\n            set [yv v] to [0]\n        end\n    end\n    if <touching (bouncy v)?> then\n        set [yv v] to [20]\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <touching (goal v)?> then\n        wait () seconds\n        set size to (100) %\n        point in direction (90)\n        set [pixelate v] effect to (0)\n        set [scroll x v] to [230]\n        set [scroll y v] to (item (([costume # v] of [floor v]) + (1)) of [starting y v])\n        set [xv v] to [0]\n        set [yv v] to [0]\n        broadcast (next v)\n        wait () seconds\n    end\nend\n\nwhen I receive [start v]\nforever\n    broadcast (tick v)\nend\n\nwhen flag clicked\nforever\n    set [distance v] to (round (((round (distance to [goal v])) - (40)) / (1.5)))\nend\n\n@Floor\n\nwhen flag clicked\nswitch costume to (costume1 v)\nforever\n    if <(Scroll X) > [275]> then\n        set [scroll x v] to [274]\n    end\n    if <(Scroll X) < [-373]> then\n        set [scroll x v] to [-374]\n    end\nend\n\nwhen I receive [next v]\nnext costume\nwait (0.1) seconds\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [21]> then\n        broadcast (end v)\n        stop [this script v]\n    end\nend\n\nwhen I receive [tick v]\ngo to x: (Scroll X) y: (Scroll Y)\nif <(Scroll X) > [275]> then\n    set [scroll x v] to [274]\nend\nif <(Scroll X) < [-373]> then\n    set [scroll x v] to [-374]\nend\n\n@Thumbnail\n\nwhen flag clicked\nshow\nwait (1) seconds\nbroadcast (start v)\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\nwhen this sprite clicked\nhide\n\n@Goal\n\nwhen flag clicked\nswitch costume to (costume1 v)\nforever\n    if <(Scroll X) > [275]> then\n        set [scroll x v] to [274]\n    end\n    if <(Scroll X) < [-373]> then\n        set [scroll x v] to [-374]\n    end\nend\n\ngo to x: (0) y: (Scroll Y)\n\nwhen I receive [next v]\nnext costume\nwait (0.1) seconds\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [10]> then\n        broadcast (end v)\n        stop [this script v]\n    end\nend\n\nwhen I receive [tick v]\ngo to x: ((Scroll X) + (item (((([costume # v] of [floor v]) - (1)) * (2)) + (1)) of [goal positions v])) y: ((Scroll Y) + (item (((([costume # v] of [floor v]) - (1)) * (2)) + (2)) of [goal positions v]))\nif <(Scroll X) > [275]> then\n    set [scroll x v] to [274]\nend\nif <(Scroll X) < [-373]> then\n    set [scroll x v] to [-374]\nend\n\n@meters away\n\nwhen I start as a clone\nif <<<<<<([costume # v] of [floor v]) = [5]> or <([costume # v] of [floor v]) = [10]>> or <([costume # v] of [floor v]) = [15]>> or <([costume # v] of [floor v]) = [18]>> or <([costume # v] of [floor v]) = [20]>> or <([costume # v] of [floor v]) = [21]>> then\n    hide\nelse\n    show\nend\nset [ghost v] effect to (50)\n\ndefine Clone\nswitch costume to (glitch v)\ngo to x: (225) y: (160)\nset [temp v] to (length of (Distance))\nrepeat (length of (Distance))\n    switch costume to (join [_] (letter (temp) of (Distance)))\n    create clone of (_myself_ v)\n    change x by (-25)\n    change [temp v] by (-1)\nend\nchange x by (-5)\nswitch costume to (_g v)\ncreate clone of (_myself_ v)\n\nwhen I receive [delete clones v]\ndelete this clone\n\nwhen I receive [start v]\nforever\n    broadcast (Delete Clones v)\n    Clone\nend\n\n@Elements\n\nwhen flag clicked\nswitch costume to (costume1 v)\nforever\n    if <(Scroll X) > [275]> then\n        set [scroll x v] to [274]\n    end\n    if <(Scroll X) < [-373]> then\n        set [scroll x v] to [-374]\n    end\nend\n\nwhen I receive [next v]\nnext costume\nwait (0.1) seconds\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [21]> then\n        broadcast (end v)\n        stop [this script v]\n    end\nend\n\nwhen I receive [tick v]\ngo to [back v] layer\ngo to x: (Scroll X) y: (Scroll Y)\nif <(Scroll X) > [275]> then\n    set [scroll x v] to [274]\nend\nif <(Scroll X) < [-373]> then\n    set [scroll x v] to [-374]\nend\n\n@Hazards\n\nwhen flag clicked\nswitch costume to (costume1 v)\nforever\n    if <(Scroll X) > [275]> then\n        set [scroll x v] to [274]\n    end\n    if <(Scroll X) < [-373]> then\n        set [scroll x v] to [-374]\n    end\nend\n\nwhen I receive [next v]\nnext costume\nwait (0.1) seconds\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [21]> then\n        broadcast (end v)\n        stop [this script v]\n    end\nend\n\nwhen I receive [tick v]\ngo to x: (Scroll X) y: (Scroll Y)\nif <(Scroll X) > [275]> then\n    set [scroll x v] to [274]\nend\nif <(Scroll X) < [-373]> then\n    set [scroll x v] to [-374]\nend\n\n@Bouncy\n\nwhen flag clicked\nswitch costume to (costume1 v)\nforever\n    if <(Scroll X) > [275]> then\n        set [scroll x v] to [274]\n    end\n    if <(Scroll X) < [-373]> then\n        set [scroll x v] to [-374]\n    end\nend\n\nwhen I receive [next v]\nnext costume\nwait (0.1) seconds\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [21]> then\n        broadcast (end v)\n        stop [this script v]\n    end\nend\n\nwhen I receive [tick v]\ngo to x: (Scroll X) y: (Scroll Y)\nif <(Scroll X) > [275]> then\n    set [scroll x v] to [274]\nend\nif <(Scroll X) < [-373]> then\n    set [scroll x v] to [-374]\nend\n\n@Congrats!\n\nwhen flag clicked\nhide\ngo to [front v] layer\nhide variable [your time v]\nhide variable [☁ world record v]\nset [your time v] to [???]\n\nwhen I receive [end v]\ngo to [front v] layer\nshow\nset [your time v] to (timer)\nif <(Your Time) < (☁ World Record)> then\n    set [☁ world record v] to (Your Time)\nend\nshow variable [your time v]\nshow variable [☁ world record v]\n\ndefine Reset World Record\nif <(username) = [Twin138956Scratch]> then\n    set [☁ world record v] to [99999.999]\nend\n\n