Math ||A Scrolling Platformer
@Stage\n\nwhen flag clicked\nforever\n    play sound [Alan Walker - Faded \(纯音乐\) v] until done\nend\n\n@blank\n\n@player(scrolling)\n\nwhen flag clicked\nsetupAll\nbroadcast (flag v)\nforever\n    setup\n    repeat until <(exit) > [0]>\n        broadcast (tick v)\n        tick\n    end\n    die\nend\n\ndefine setup\nshow\npoint in direction (90)\nset rotation style [left-right v]\nset [ghost v] effect to (0)\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [x v] to (Check X)\nset [y v] to (Check Y)\nset [camera x v] to (x)\nset [camera y v] to (y)\nset [slope v] to [0]\nset [jump v] to [5]\nset [exit v] to []\n\ndefine position\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\n\ndefine tick\ndie test\nwalk <key (left arrow v) pressed?> [-2.3] [-90]\nwalk <key (right arrow v) pressed?> [2.3] [90]\nif <key (up arrow v) pressed?> then\n    if <(jump) < [4]> then\n        set [speed y v] to [17]\n    end\nend\nif <key (down arrow v) pressed?> then\n    switch costume to (costume2 v)\nelse\n    switch costume to (costume1 v)\nend\nif <touching (jump! v)?> then\n    set [jump v] to [5]\n    set [speed y v] to [42]\nend\nif <(speed y) > [-20]> then\n    change [speed y v] by (-2)\nend\nchange y by (speed y)\nif <([abs v] of (speed x) ) > [-0.001]> then\n    change x by (round ((speed x) + (SX Plus)))\nend\nset [speed x v] to ((speed x) * (0.8))\nchange [camera y v] by (((y) - (CAMERA Y)) / (10))\nset [camera x v] to (x)\nposition\n\ndefine walk <boolean> (change x) (direct)\nif <boolean> then\n    change [speed x v] by (change x)\n    point in direction (direct)\nend\n\ndefine change x by (sx)\nchange [x v] by (sx)\nposition\nif <<touching (platformer v)?> or <touching (moving v)?>> then\n    repeat (10)\n        change [y v] by (1)\n        position\n        if <<not <touching (platformer v)?>> and <not <touching (moving v)?>>> then\n            stop [this script v]\n        end\n    end\n    set [speed x v] to [0]\n    change [y v] by (-10)\n    repeat until <<not <touching (platformer v)?>> and <not <touching (moving v)?>>>\n        if <[0] < (sx)> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        position\n    end\n    if <key (up arrow v) pressed?> then\n        set [jump v] to [1]\n        if <(sx) > [0]> then\n            set [speed x v] to [-15]\n        else\n            if <[0] > (sx)> then\n                set [speed x v] to [15]\n            end\n        end\n        position\n    end\nend\n\ndefine change y by (sy)\nchange [y v] by (sy)\nchange [jump v] by (1)\nposition\nif <touching (moving v)?> then\n    set [touching moving v] to [1]\nelse\n    set [touching moving v] to [0]\nend\nrepeat until <<not <touching (platformer v)?>> and <not <touching (moving v)?>>>\n    if <[0] < (sy)> then\n        change [y v] by (-1)\n    else\n        set [jump v] to [0]\n        change [y v] by (1)\n    end\n    position\n    set [speed y v] to [0]\nend\nif <(Touching Moving) = [0]> then\n    set [sx plus v] to [0]\nend\n\ndefine die test\nif <(CAMERA Y) < [-200]> then\n    set [exit v] to [die]\nend\nif <touching (danger v)?> then\n    set [exit v] to [die]\nend\nif <key (space v) pressed?> then\n    set [exit v] to [die]\nend\n\ndefine die\nrepeat (15)\n    change y by (10)\n    change [ghost v] effect by (9)\nend\n\ndefine setupAll\nset [camera x v] to [0]\nset [camera y v] to [0]\nset [check x v] to [0]\nset [check y v] to [0]\nset [win v] to [0]\n\n@platformer\n\ndefine position\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\nif <<(round ((x) - (CAMERA X))) = (round (x position))> and <(round ((y) - (CAMERA Y))) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [tick v]\nposition\n\ndefine clone at (x) (y)\nset [x v] to (x)\nset [y v] to (y)\nnext costume\ncreate clone of (_myself_ v)\n\ndefine clone and change x, y by (x) (y)\ncreate clone of (_myself_ v)\nnext costume\nchange [x v] by (x)\nchange [y v] by (y)\n\nwhen I receive [flag v]\nset clones\n\ndefine set clones\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (costume1 v)\nrepeat (1)\n    clone and change x, y by [450] [0]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [480] [0]\nend\nrepeat (1)\n    clone and change x, y by [0] [360]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [960] [0]\n    clone and change x, y by [0] [360]\n    clone and change x, y by [480] [-360]\nend\nrepeat (1)\n    clone and change x, y by [720] [0]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [0] [360]\n    clone and change x, y by [-480] [0]\n    clone and change x, y by [0] [360]\nend\nclone and change x, y by [480] [-360]\nclone and change x, y by [750] [-250]\nclone and change x, y by [200] [450]\nclone and change x, y by [2000] [2000]\n\nset [camera x v] to [0]\nset [camera y v] to [0]\n\n@background\n\ndefine render\nset [idx v] to [0]\nrepeat (13)\n    draw line from [-250] (((180) - (((CAMERA Y) / (3)) mod (30))) - ((idx) * (30))) to [240] (((180) - (((CAMERA Y) / (3)) mod (30))) - ((idx) * (30)))\n    change [idx v] by (1)\nend\nset [idx v] to [0]\nrepeat (16)\n    draw line from (((240) - (((CAMERA X) / (3)) mod (30))) - ((idx) * (30))) [-180] to (((240) - (((CAMERA X) / (3)) mod (30))) - ((idx) * (30))) [180]\n    change [idx v] by (1)\nend\n\ndefine draw line from (x1) (y1) to (x2) (y2)\ngo to x: (x1) y: (y1)\npen down\ngo to x: (x2) y: (y2)\npen up\n\nwhen I receive [flag v]\nset pen color to (#216fdd)\nset pen size to (3)\nset pen (transparency v) to (70)\n\nwhen I receive [tick v]\nerase all\nrender\n\n@bgmath\n\ndefine position\ngo to x: (((x) - (CAMERA X)) / (3)) y: (((y) - (CAMERA Y)) / (3))\nif <<(round (((x) - (CAMERA X)) / (3))) = (round (x position))> and <(round (((y) - (CAMERA Y)) / (3))) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [tick v]\nposition\n\ndefine clone at (x) (y)\nset [x v] to (x)\nset [y v] to (y)\nnext costume\ncreate clone of (_myself_ v)\n\ndefine clone and change x, y by (x) (y)\ncreate clone of (_myself_ v)\nnext costume\nchange [x v] by ((x) * (3))\nchange [y v] by ((y) * (3))\n\nclone at [0] [0]\nclone at [480] [0]\n\nwhen I receive [flag v]\nset [x v] to [0]\nset [y v] to [0]\nset [ghost v] effect to (50)\nswitch costume to (costume1 v)\nclone and change x, y by [480] [0]\nclone and change x, y by [480] [0]\nclone and change x, y by [0] [180]\nclone and change x, y by [480] [0]\nclone and change x, y by [480] [180]\nclone and change x, y by [0] [-360]\nclone and change x, y by [400] [360]\n\n@Moving\n\ndefine position\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\nif <<(round ((x) - (CAMERA X))) = (round (x position))> and <(round ((y) - (CAMERA Y))) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [tick v]\nif <(clone) = [1]> then\n    position\nelse\n    hide\nend\n\ndefine clone at (x) (y) speed: (speed) range: (x1) (x2)\nset [clone v] to [1]\nset [x v] to (x)\nset [y v] to (y)\nset [speed v] to (speed)\nset [range 1 v] to (x1)\nset [range 2 v] to (x2)\ncreate clone of (_myself_ v)\nset [clone v] to [0]\n\ndefine clone and change x, y by (x) (y)\ncreate clone of (_myself_ v)\nnext costume\nchange [x v] by (x)\nchange [y v] by (y)\n\nwhen I start as a clone\nforever\n    change [x v] by (speed)\n    if <(x) > (range 2)> then\n        set [speed v] to (() - ([abs v] of (speed) ))\n    end\n    if <(x) < (range 1)> then\n        set [speed v] to ([abs v] of (speed) )\n    end\n    if <<(distance to [player\(scrolling\) v]) < [70]> and <(Touching Moving) = [1]>> then\n        set [sx plus v] to (speed)\n    end\nend\n\nwhen I receive [flag v]\nset [clone v] to [0]\nset [x v] to [100000]\nset [y v] to [100000]\nset [speed v] to [0]\nclone at [2850] [443] speed: [5] range: [2900] [3400]\nclone at [4360] [385] speed: [6] range: [4220] [4750]\nclone at [5750] [385] speed: [3] range: [5750] [6000]\n\n@jump!\n\ndefine position\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\nif <<(round ((x) - (CAMERA X))) = (round (x position))> and <(round ((y) - (CAMERA Y))) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [tick v]\nposition\n\ndefine clone at (x) (y)\nset [x v] to (x)\nset [y v] to (y)\nnext costume\ncreate clone of (_myself_ v)\n\ndefine clone and change x, y by (x) (y)\ncreate clone of (_myself_ v)\nnext costume\nchange [x v] by (x)\nchange [y v] by (y)\n\nwhen I receive [flag v]\nset [x v] to [6242]\nset [y v] to [437]\nswitch costume to (costume1 v)\n\n@danger\n\ndefine position\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\nif <<(round ((x) - (CAMERA X))) = (round (x position))> and <(round ((y) - (CAMERA Y))) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [tick v]\nposition\n\ndefine clone at (x) (y)\nset [x v] to (x)\nset [y v] to (y)\nnext costume\ncreate clone of (_myself_ v)\n\ndefine clone and change x, y by (x) (y)\ncreate clone of (_myself_ v)\nnext costume\nchange [x v] by (x)\nchange [y v] by (y)\n\nwhen I receive [flag v]\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (costume1 v)\nrepeat (1)\n    clone and change x, y by [450] [0]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [480] [0]\nend\nrepeat (1)\n    clone and change x, y by [0] [360]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [960] [0]\n    clone and change x, y by [0] [360]\n    clone and change x, y by [480] [-360]\nend\nrepeat (1)\n    clone and change x, y by [720] [0]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [0] [360]\n    clone and change x, y by [-480] [0]\n    clone and change x, y by [0] [360]\nend\nrepeat (1)\n    clone and change x, y by [480] [-360]\n    clone and change x, y by [750] [-250]\n    clone and change x, y by [200] [450]\nend\nclone at [4600] [447]\n\n@checkpoints\n\ndefine position\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\nif <<(round ((x) - (CAMERA X))) = (round (x position))> and <(round ((y) - (CAMERA Y))) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [tick v]\nposition\nif <<(costume [name v]) = [false]> and <touching (player\(scrolling\) v)?>> then\n    next costume\n    set [ghost v] effect to (15)\n    set [check x v] to (x)\n    set [check y v] to (y)\nend\n\ndefine clone at (x) (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\ndefine clone and change x, y by (x) (y)\ncreate clone of (_myself_ v)\nnext costume\nchange [x v] by (x)\nchange [y v] by (y)\n\nwhen I receive [flag v]\nset [ghost v] effect to (40)\nswitch costume to (false v)\nclone at [0] [-45]\nclone at [1315] [120]\nclone at [2236] [293]\nclone at [4920] [392]\n\n@winpoint\n\ndefine position\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\nif <<(round ((x) - (CAMERA X))) = (round (x position))> and <(round ((y) - (CAMERA Y))) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [tick v]\nposition\nif <<touching (player\(scrolling\) v)?> and <(costume [number v]) = [1]>> then\n    set [win v] to [1]\n    set [check x v] to (x)\n    set [check y v] to (y)\n    next costume\n    set [ghost v] effect to (15)\nend\n\nwhen I receive [flag v]\nset [x v] to [6465]\nset [y v] to [877]\nset [ghost v] effect to (40)\nswitch costume to (false v)\n\n@words\n\ndefine position\ngo to x: ((x) - (CAMERA X)) y: ((y) - (CAMERA Y))\nif <<(round ((x) - (CAMERA X))) = (round (x position))> and <(round ((y) - (CAMERA Y))) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [tick v]\nposition\n\ndefine clone at (x) (y)\nset [x v] to (x)\nset [y v] to (y)\nnext costume\ncreate clone of (_myself_ v)\n\ndefine clone and change x, y by (x) (y)\ncreate clone of (_myself_ v)\nnext costume\nchange [x v] by (x)\nchange [y v] by (y)\n\nwhen I receive [flag v]\nset [ghost v] effect to (20)\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (costume1 v)\nrepeat (1)\n    clone and change x, y by [450] [0]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [480] [0]\nend\nrepeat (1)\n    clone and change x, y by [0] [360]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [960] [0]\n    clone and change x, y by [0] [360]\n    clone and change x, y by [480] [-360]\nend\nrepeat (1)\n    clone and change x, y by [720] [0]\n    clone and change x, y by [480] [0]\n    clone and change x, y by [0] [360]\n    clone and change x, y by [-480] [0]\n    clone and change x, y by [0] [360]\nend\nclone and change x, y by [480] [-360]\nclone and change x, y by [750] [-250]\nclone and change x, y by [200] [450]\n\n@thb4\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\n\n@thb2\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\n\n
 A Scrolling Platformer for the contest\nSpam the flag\nArrow keys to move\n\nIt's short and easy, but hope you like it!\n\n\n\n\n\n\n\n\n\n\n\n