Neon - 100% Pen Scrolling Platformer

Instructions: Arrow keys/WASD/Mobile to move\nAvoid red\nBounce on yellow\nHot pink and light pink change your gravity\nGo to the green portal to get to the next level

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nforever\n    play sound [musique v] until done\nend\n\n@pen\n\nwhen flag clicked\nerase all\npen up\nset [level v] to [1]\nwait (1) seconds\nbroadcast (reset v) and wait\nforever\n    erase all\n    draw background\n    draw horizontal lines (horizontal lines)\n    draw vertical lines (vertical lines)\n    draw frame thingy\n    player\nend\n\ndefine draw line from x: (x) y: (y) to x: (x2) y: (y2)\npen up\ngo to x: ((x) + ((scroll x) * (-1))) y: ((y) + ((scroll y) * (-1)))\npen down\ngo to x: ((x2) + ((scroll x) * (-1))) y: ((y2) + ((scroll y) * (-1)))\npen up\n\ndefine player\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > ((x) - (scroll x))>>> then\n    change [xv v] by (.9)\nend\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <((x) - (scroll x)) > (mouse x)>>> then\n    change [xv v] by (-.9)\nend\nset [xv v] to ((Xv) * (.9))\nchange [x v] by (Xv)\nvertical collisions\nif <(vertical touching?) = [1]> then\n    change [x v] by ((Xv) * (-1))\n    set [xv v] to [0]\nend\nif <(gravity) = [0]> then\n    if <(Yv) > [-15]> then\n        change [yv v] by (-1)\n    end\nelse\n    if <[15] > (Yv)> then\n        change [yv v] by (1)\n    end\nend\nchange [y v] by (Yv)\nhorizontal collisions\nif <(horizontal touching?) = [1]> then\n    change [y v] by ((Yv) * (-1))\n    set [yv v] to [0]\nend\nif <(touching bounce?) = [1]> then\n    if <(gravity) = [0]> then\n        set [yv v] to [20]\n    else\n        set [yv v] to [-20]\n    end\n    set [touching bounce? v] to [0]\nend\nif <(gravity) = [0]> then\n    change [y v] by (-1)\n    horizontal collisions\n    if <(horizontal touching?) = [1]> then\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (((y) - (scroll y)) + (20))>>> then\n            set [yv v] to [15]\n        end\n    end\n    change [y v] by (1)\nelse\n    change [y v] by (1)\n    horizontal collisions\n    if <(horizontal touching?) = [1]> then\n        if <<<key (down arrow v) pressed?> or <key (s v) pressed?>> or <<mouse down?> and <(((y) - (scroll y)) + (-20)) > (mouse y)>>> then\n            set [yv v] to [-15]\n        end\n    end\n    change [y v] by (-1)\nend\nchange [scroll x v] by (((x) - (scroll x)) / (10))\nchange [scroll y v] by (((y) - (scroll y)) / (10))\ndraw player size: [10]\nif <[-500] > (y)> then\n    broadcast (reset v)\nend\nif <(y) > [850]> then\n    broadcast (reset v)\nend\n\ndefine draw player size: (size)\nset pen size to (5)\nset pen color to (#ffffff)\nset [size for collisions v] to (size)\npen up\ngo to x: (((x) - (scroll x)) - (size)) y: (((y) - (scroll y)) + (size))\npen down\ngo to x: (((x) - (scroll x)) + (size)) y: (((y) - (scroll y)) + (size))\ngo to x: (((x) - (scroll x)) + (size)) y: (((y) - (scroll y)) - (size))\ngo to x: (((x) - (scroll x)) - (size)) y: (((y) - (scroll y)) - (size))\ngo to x: (((x) - (scroll x)) - (size)) y: (((y) - (scroll y)) + (size))\n\ndefine add horizontal (x) (y) (x2) (y2) (type)\nadd ((x) - (20)) to [line point x horizontal v]\nadd (y) to [line point y horizontal v]\nadd ((x2) + (20)) to [line point x2 horizontal v]\nadd (y2) to [line point y2 horizontal v]\nadd (type) to [horizontal type v]\nchange [horizontal lines v] by (1)\n\ndefine horizontal collisions\nset [# for player collisions v] to [1]\nrepeat (length of [line point x horizontal v])\n    if <<<(item (# for player collisions) of [line point x horizontal v]) < ((x) - (size for collisions))> and <(item (# for player collisions) of [line point x2 horizontal v]) > ((x) + (size for collisions))>> and <<((y) - (size for collisions)) < (item (# for player collisions) of [line point y horizontal v])> and <((y) + (size for collisions)) > (item (# for player collisions) of [line point y2 horizontal v])>>> then\n        if <(item (# for player collisions) of [horizontal type v]) = [1]> then\n            set [horizontal touching? v] to [1]\n            stop [this script v]\n        end\n        if <(item (# for player collisions) of [horizontal type v]) = [2]> then\n            broadcast (reset v)\n        end\n        if <(item (# for player collisions) of [horizontal type v]) = [3]> then\n            set [touching bounce? v] to [1]\n        end\n        if <(item (# for player collisions) of [horizontal type v]) = [4]> then\n            set [gravity v] to [1]\n        end\n        if <(item (# for player collisions) of [horizontal type v]) = [5]> then\n            set [gravity v] to [0]\n        end\n        if <(item (# for player collisions) of [horizontal type v]) = [6]> then\n            change [level v] by (1)\n            broadcast (reset v) and wait\n        end\n    else\n        set [horizontal touching? v] to [0]\n    end\n    change [# for player collisions v] by (1)\nend\n\ndefine draw horizontal lines (amount)\nset [# for line points v] to [1]\nrepeat (amount)\n    if <(item (# for line points) of [horizontal type v]) = [1]> then\n        set pen color to (#00ffff)\n        set pen size to (5)\n    end\n    if <(item (# for line points) of [horizontal type v]) = [2]> then\n        set pen color to (#ff0000)\n        set pen size to (5)\n    end\n    if <(item (# for line points) of [horizontal type v]) = [3]> then\n        set pen color to (#ffc300)\n        set pen size to (5)\n    end\n    if <(item (# for line points) of [horizontal type v]) = [4]> then\n        set pen color to (#ff00dc)\n        set pen size to (5)\n    end\n    if <(item (# for line points) of [horizontal type v]) = [5]> then\n        set pen color to (#ff7d9d)\n        set pen size to (5)\n    end\n    if <(item (# for line points) of [horizontal type v]) = [6]> then\n        set pen color to (#00ff2e)\n        set pen size to (6)\n    end\n    draw line from x: ((item (# for line points) of [line point x horizontal v]) + (20)) y: (item (# for line points) of [line point y horizontal v]) to x: ((item (# for line points) of [line point x2 horizontal v]) - (20)) y: (item (# for line points) of [line point y2 horizontal v])\n    change [# for line points v] by (1)\nend\n\ndefine add vertical (x) (y) (x2) (y2) (type)\nadd (x) to [line point x vertical v]\nadd ((y) - (20)) to [line point y vertical v]\nadd (x2) to [line point x2 vertical v]\nadd ((y2) + (20)) to [line point y2 vertical v]\nadd (type) to [vertical type v]\nchange [vertical lines v] by (1)\n\ndefine draw vertical lines (amount)\nset [# for line points v] to [1]\nrepeat (amount)\n    if <(item (# for line points) of [vertical type v]) = [1]> then\n        set pen color to (#00ffff)\n        set pen size to (5)\n    end\n    if <(item (# for line points) of [vertical type v]) = [2]> then\n        set pen color to (#ff0000)\n        set pen size to (5)\n    end\n    if <(item (# for line points) of [vertical type v]) = [3]> then\n        set pen color to (#ffc300)\n        set pen size to (5)\n    end\n    if <(item (# for line points) of [vertical type v]) = [4]> then\n        set pen color to (#ff00dc)\n        set pen size to (5)\n    end\n    if <(item (# for line points) of [vertical type v]) = [5]> then\n        set pen color to (#ff7da2)\n        set pen size to (5)\n    end\n    if <(item (# for line points) of [vertical type v]) = [6]> then\n        set pen color to (#00ff2e)\n        set pen size to (6)\n    end\n    draw line from x: (item (# for line points) of [line point x vertical v]) y: ((item (# for line points) of [line point y vertical v]) + (20)) to x: (item (# for line points) of [line point x2 vertical v]) y: ((item (# for line points) of [line point y2 vertical v]) - (20))\n    change [# for line points v] by (1)\nend\n\nwhen I receive [reset v]\ndelete all of [line point x horizontal v]\ndelete all of [line point y horizontal v]\ndelete all of [line point x2 horizontal v]\ndelete all of [line point y2 horizontal v]\ndelete all of [line point y vertical v]\ndelete all of [line point x vertical v]\ndelete all of [line point y2 vertical v]\ndelete all of [line point x2 vertical v]\ndelete all of [horizontal type v]\ndelete all of [vertical type v]\nset [gravity v] to [0]\nset [horizontal lines v] to [0]\nset [vertical lines v] to [0]\nset [horizontal touching? v] to [0]\nset [vertical touching? v] to [0]\nset [touching bounce? v] to [0]\nset [x v] to [0]\nset [y v] to [-50]\nset [xv v] to [0]\nset [yv v] to [0]\nif <(level) = [1]> then\n    square from top left: [-100] [-120] to top right: [100] [-120] to bottom left: [-100] [-170] to bottom right: [100] [-170] type: [1]\n    square from top left: [200] [-60] to top right: [350] [-60] to bottom left: [200] [-100] to bottom right: [350] [-100] type: [1]\n    square from top left: [355] [-60] to top right: [415] [-60] to bottom left: [355] [-100] to bottom right: [415] [-100] type: [2]\n    square from top left: [420] [-60] to top right: [500] [-60] to bottom left: [420] [-100] to bottom right: [500] [-100] type: [1]\n    square from top left: [505] [-60] to top right: [570] [-60] to bottom left: [505] [-100] to bottom right: [570] [-100] type: [3]\n    square from top left: [580] [100] to top right: [650] [100] to bottom left: [580] [65] to bottom right: [650] [65] type: [1]\n    square from top left: [700] [130] to top right: [750] [130] to bottom left: [700] [100] to bottom right: [750] [100] type: [1]\n    square from top left: [800] [170] to top right: [850] [170] to bottom left: [800] [140] to bottom right: [850] [140] type: [1]\n    square from top left: [900] [200] to top right: [1100] [200] to bottom left: [900] [150] to bottom right: [1100] [150] type: [1]\n    square from top left: [975] [205] to top right: [1025] [205] to bottom left: [975] [205] to bottom right: [1025] [205] type: [2]\n    square from top left: [1105] [200] to top right: [1180] [200] to bottom left: [1105] [150] to bottom right: [1180] [150] type: [4]\n    square from top left: [1105] [520] to top right: [1300] [520] to bottom left: [1105] [450] to bottom right: [1300] [450] type: [1]\n    square from top left: [1305] [520] to top right: [1395] [520] to bottom left: [1305] [450] to bottom right: [1395] [450] type: [2]\n    square from top left: [1400] [520] to top right: [1460] [520] to bottom left: [1400] [450] to bottom right: [1460] [450] type: [3]\n    square from top left: [1475] [320] to top right: [1600] [320] to bottom left: [1475] [275] to bottom right: [1600] [275] type: [1]\n    square from top left: [1605] [320] to top right: [1680] [320] to bottom left: [1605] [275] to bottom right: [1680] [275] type: [5]\n    square from top left: [1605] [100] to top right: [1680] [100] to bottom left: [1605] [30] to bottom right: [1680] [30] type: [1]\n    square from top left: [1685] [100] to top right: [1720] [100] to bottom left: [1685] [30] to bottom right: [1720] [30] type: [2]\n    square from top left: [1725] [100] to top right: [1800] [100] to bottom left: [1725] [30] to bottom right: [1800] [30] type: [1]\n    square from top left: [1850] [175] to top right: [1900] [175] to bottom left: [1850] [125] to bottom right: [1900] [125] type: [6]\nend\nif <(level) = [2]> then\n    square from top left: [-100] [-120] to top right: [100] [-120] to bottom left: [-100] [-170] to bottom right: [100] [-170] type: [1]\n    square from top left: [105] [-120] to top right: [155] [-120] to bottom left: [105] [-170] to bottom right: [155] [-170] type: [4]\n    square from top left: [160] [100] to top right: [210] [100] to bottom left: [160] [50] to bottom right: [210] [50] type: [5]\n    square from top left: [215] [-120] to top right: [265] [-120] to bottom left: [215] [-170] to bottom right: [265] [-170] type: [4]\n    square from top left: [270] [100] to top right: [320] [100] to bottom left: [270] [50] to bottom right: [320] [50] type: [5]\n    square from top left: [325] [-120] to top right: [375] [-120] to bottom left: [325] [-170] to bottom right: [375] [-170] type: [4]\n    square from top left: [380] [100] to top right: [430] [100] to bottom left: [380] [50] to bottom right: [430] [50] type: [5]\n    square from top left: [435] [-120] to top right: [500] [-120] to bottom left: [435] [-170] to bottom right: [500] [-170] type: [1]\n    square from top left: [505] [-120] to top right: [575] [-120] to bottom left: [505] [-170] to bottom right: [575] [-170] type: [2]\n    square from top left: [580] [-120] to top right: [700] [-120] to bottom left: [580] [-170] to bottom right: [700] [-170] type: [1]\n    square from top left: [650] [-30] to top right: [700] [-30] to bottom left: [650] [-60] to bottom right: [700] [-60] type: [4]\n    square from top left: [650] [120] to top right: [800] [120] to bottom left: [650] [60] to bottom right: [800] [60] type: [1]\n    square from top left: [600] [120] to top right: [645] [120] to bottom left: [600] [60] to bottom right: [645] [60] type: [2]\n    square from top left: [700] [155] to top right: [750] [155] to bottom left: [700] [125] to bottom right: [750] [125] type: [3]\n    square from top left: [800] [200] to top right: [850] [200] to bottom left: [800] [160] to bottom right: [850] [160] type: [5]\n    square from top left: [700] [300] to top right: [750] [300] to bottom left: [700] [270] to bottom right: [750] [270] type: [4]\n    square from top left: [700] [480] to top right: [750] [480] to bottom left: [700] [450] to bottom right: [750] [450] type: [5]\n    square from top left: [800] [400] to top right: [950] [400] to bottom left: [800] [350] to bottom right: [950] [350] type: [1]\n    square from top left: [955] [400] to top right: [1000] [400] to bottom left: [955] [350] to bottom right: [1000] [350] type: [2]\n    square from top left: [1005] [400] to top right: [1100] [400] to bottom left: [1005] [350] to bottom right: [1100] [350] type: [1]\n    square from top left: [1105] [400] to top right: [1155] [400] to bottom left: [1105] [350] to bottom right: [1155] [350] type: [6]\nend\nif <(level) = [3]> then\n    square from top left: [-100] [-120] to top right: [100] [-120] to bottom left: [-100] [-170] to bottom right: [100] [-170] type: [1]\n    square from top left: [-150] [-120] to top right: [-105] [-120] to bottom left: [-150] [-170] to bottom right: [-105] [-170] type: [3]\n    square from top left: [-200] [50] to top right: [-150] [50] to bottom left: [-200] [20] to bottom right: [-150] [20] type: [1]\n    square from top left: [-300] [150] to top right: [-250] [150] to bottom left: [-300] [120] to bottom right: [-250] [120] type: [1]\n    square from top left: [-400] [100] to top right: [-350] [100] to bottom left: [-400] [70] to bottom right: [-350] [70] type: [1]\n    square from top left: [-600] [0] to top right: [-450] [0] to bottom left: [-600] [-50] to bottom right: [-450] [-50] type: [1]\n    square from top left: [-675] [0] to top right: [-605] [0] to bottom left: [-675] [-50] to bottom right: [-605] [-50] type: [2]\n    square from top left: [-750] [0] to top right: [-680] [0] to bottom left: [-750] [-50] to bottom right: [-680] [-50] type: [4]\n    square from top left: [-750] [200] to top right: [-650] [200] to bottom left: [-750] [150] to bottom right: [-650] [150] type: [1]\n    square from top left: [-750] [300] to top right: [-605] [300] to bottom left: [-750] [270] to bottom right: [-605] [270] type: [5]\n    square from top left: [-800] [200] to top right: [-755] [200] to bottom left: [-800] [-150] to bottom right: [-755] [-150] type: [2]\n    square from top left: [-870] [200] to top right: [-805] [200] to bottom left: [-870] [170] to bottom right: [-805] [170] type: [3]\n    square from top left: [-600] [300] to top right: [-500] [300] to bottom left: [-600] [130] to bottom right: [-500] [130] type: [2]\n    square from top left: [-830] [380] to top right: [-500] [380] to bottom left: [-830] [305] to bottom right: [-500] [305] type: [1]\n    square from top left: [-695] [400] to top right: [-635] [400] to bottom left: [-695] [385] to bottom right: [-635] [385] type: [2]\n    square from top left: [-450] [450] to top right: [-300] [450] to bottom left: [-450] [410] to bottom right: [-300] [410] type: [1]\n    square from top left: [-200] [400] to top right: [-100] [400] to bottom left: [-200] [360] to bottom right: [-100] [360] type: [1]\n    square from top left: [-50] [480] to top right: [0] [480] to bottom left: [-50] [430] to bottom right: [0] [430] type: [6]\nend\nif <(level) = [4]> then\n    stop [other scripts in sprite v]\n    erase all\n    pen up\n    go to x: (0) y: (0)\n    set pen color to (#000000)\n    set pen size to (3000)\n    pen down\n    pen up\n    go to x: (-50) y: (20)\n    set pen color to (#ffffff)\n    set pen size to (5)\n    pen down\n    point in direction (165)\n    repeat (17)\n        move (2) steps\n    end\n    point in direction (30)\n    repeat (10)\n        move (2) steps\n    end\n    point in direction (150)\n    repeat (10)\n        move (2) steps\n    end\n    point in direction (15)\n    repeat (17)\n        move (2) steps\n    end\n    pen up\n    go to x: (0) y: (10)\n    point in direction (45)\n    pen down\n    set pen size to (4)\n    repeat (55)\n        move (2) steps\n        turn right (8) degrees\n    end\n    pen up\n    go to x: (40) y: (20)\n    point in direction (180)\n    pen down\n    set pen size to (5)\n    repeat (15)\n        move (2) steps\n    end\n    pen up\n    go to x: (40) y: (20)\n    point in direction (135)\n    pen down\n    repeat (19)\n        move (2) steps\n    end\n    point in direction (0)\n    repeat (15)\n        move (2) steps\n    end\n    forever\n        fireworks\n        wait (1) seconds\n    end\nend\n\ndefine draw background\nset pen color to (#000000)\nset pen size to (300000)\npen up\ngo to x: (0) y: (0)\npen down\n\ndefine vertical collisions\nset [# for player collisions v] to [1]\nrepeat (length of [line point x vertical v])\n    if <<<((x) - (size for collisions)) < (item (# for player collisions) of [line point x vertical v])> and <((x) + (size for collisions)) > (item (# for player collisions) of [line point x2 vertical v])>> and <<(item (# for player collisions) of [line point y vertical v]) < ((y) - (size for collisions))> and <(item (# for player collisions) of [line point y2 vertical v]) > ((y) + (size for collisions))>>> then\n        if <(item (# for player collisions) of [vertical type v]) = [1]> then\n            set [vertical touching? v] to [1]\n            stop [this script v]\n        end\n        if <(item (# for player collisions) of [vertical type v]) = [2]> then\n            broadcast (reset v)\n        end\n        if <(item (# for player collisions) of [vertical type v]) = [3]> then\n            set [touching bounce? v] to [1]\n        end\n        if <(item (# for player collisions) of [vertical type v]) = [4]> then\n            set [gravity v] to [1]\n        end\n        if <(item (# for player collisions) of [vertical type v]) = [5]> then\n            set [gravity v] to [0]\n        end\n        if <(item (# for player collisions) of [vertical type v]) = [6]> then\n            change [level v] by (1)\n            broadcast (reset v) and wait\n        end\n    else\n        set [vertical touching? v] to [0]\n    end\n    change [# for player collisions v] by (1)\nend\n\ndefine square from top left: (x) (y) to top right: (x2) (y2) to bottom left: (x3) (y3) to bottom right: (x4) (y4) type: (type)\nadd horizontal (x) (y) (x2) (y2) (type)\nadd horizontal (x3) (y3) (x4) (y4) (type)\nadd vertical (x3) (y3) (x) (y) (type)\nadd vertical (x4) (y4) (x2) (y2) (type)\n\ndefine draw frame thingy\nset pen color to (#000000)\nset pen size to (6)\npen up\ngo to x: (-240) y: (200)\npen down\ngo to x: (240) y: (200)\ngo to x: (240) y: (-200)\ngo to x: (-240) y: (-200)\ngo to x: (-240) y: (200)\n\ndefine fireworks\nrepeat (10)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nset pen color to (#00ffff)\nset pen size to (5)\nset pen (transparency v) to (90)\npen up\ngo to x: (pick random (-240) to (240)) y: (pick random (-180) to (180))\npen down\nset [momentum v] to (pick random (-10) to (10))\nset [gravity v] to (pick random (5) to (10))\nrepeat until <[-170] > (y position)>\n    set [momentum v] to ((momentum) * (.95))\n    change [firework gravity v] by (-1)\n    change x by (momentum)\n    change y by (firework gravity)\nend\ndelete this clone\n\n