Platformer pen v1.5
@Stage\n\nwhen I receive [play v]\nforever\n    play sound [music0 v] until done\nend\n\nwhen I receive [stop v]\nstop [other scripts in sprite v]\n\n@pen\n\nwhen flag clicked\nhide\nset [id v] to [0]\nerase all\nswitch backdrop to (2 v)\ninit\nrepeat (2)\n    change [id v] by (1)\n    create clone of (_myself_ v)\nend\nwait (1) seconds\nchange [id v] by (1)\ncreate clone of (_myself_ v)\n\ndefine level\nset pen color to (#4cff00)\nset pen size to (5)\nerase all\nif <(level) = [1]> then\n    draw ground X: [-240] Y: [-180]\n    pen down\n    draw ground X: [-240] Y: [7]\n    pen down\n    draw ground X: [-59] Y: [7]\n    pen down\n    draw ground X: [-59] Y: [-180]\n    pen down\n    pen up\n    draw ground X: [81] Y: [-180]\n    pen down\n    draw ground X: [81] Y: [7]\n    pen down\n    draw ground X: [240] Y: [7]\n    pen down\n    draw ground X: [240] Y: [-180]\n    pen down\n    pen up\n    portal X [180] Y [40]\nend\nif <(level) = [2]> then\n    draw ground X: [-240] Y: [-180]\n    pen down\n    draw ground X: [-240] Y: [7]\n    pen down\n    draw ground X: [-90] Y: [7]\n    pen down\n    draw ground X: [-90] Y: [30]\n    pen down\n    draw ground X: [-80] Y: [30]\n    pen down\n    set pen color to (#cccccc)\n    draw ground X: [-60] Y: [80]\n    pen down\n    draw ground X: [-40] Y: [30]\n    pen down\n    set pen color to (#4cff00)\n    draw ground X: [-30] Y: [30]\n    pen down\n    draw ground X: [-30] Y: [-180]\n    pen down\n    pen up\n    draw ground X: [120] Y: [-180]\n    pen down\n    draw ground X: [120] Y: [30]\n    pen down\n    draw ground X: [240] Y: [30]\n    pen down\n    portal X [180] Y [80]\nend\nif <(level) = [3]> then\n    draw ground X: [-240] Y: [-120]\n    pen down\n    draw ground X: [240] Y: [-120]\n    pen down\n    pen up\n    draw ground X: [-100] Y: [-20]\n    pen down\n    draw ground X: [-30] Y: [-20]\n    pen down\n    pen up\n    draw ground X: [0] Y: [30]\n    pen down\n    draw ground X: [70] Y: [30]\n    pen down\n    pen up\n    draw ground X: [120] Y: [80]\n    pen down\n    draw ground X: [190] Y: [80]\n    pen down\n    pen up\n    portal X [160] Y [120]\nend\nif <(level) = [4]> then\n    set pen color to (#ff0000)\n    draw ground X: [-240] Y: [-140]\n    pen down\n    draw ground X: [240] Y: [-140]\n    pen down\n    pen up\n    set pen color to (#4cff00)\n    draw ground X: [-170] Y: [-110]\n    pen down\n    draw ground X: [-120] Y: [-110]\n    pen down\n    pen up\n    draw ground X: [-70] Y: [-70]\n    pen down\n    draw ground X: [-20] Y: [-70]\n    pen down\n    pen up\n    draw ground X: [30] Y: [-70]\n    pen down\n    draw ground X: [80] Y: [-70]\n    pen down\n    pen up\n    portal X [160] Y [-26]\nend\nif <(level) = [5]> then\n    draw ground X: [-240] Y: [-140]\n    pen down\n    draw ground X: [-60] Y: [-140]\n    pen down\n    set pen color to (#ffe900)\n    set pen size to (15)\n    draw ground X: [0] Y: [-140]\n    pen down\n    set pen color to (#4bff00)\n    set pen size to (5)\n    draw ground X: [240] Y: [-140]\n    pen down\n    pen up\n    draw ground X: [0] Y: [-140]\n    pen down\n    draw ground X: [0] Y: [-3]\n    pen down\n    set pen size to (15)\n    draw ground X: [0] Y: [0]\n    pen down\n    set pen size to (5)\n    draw ground X: [0] Y: [90]\n    pen down\n    portal X [160] Y [-26]\nend\nif <(level) = [6]> then\n    set pen color to (#ff0000)\n    draw ground X: [-240] Y: [-140]\n    pen down\n    draw ground X: [240] Y: [-140]\n    pen down\n    pen up\n    set pen color to (#4cff00)\n    draw ground X: [-130] Y: [-110]\n    pen down\n    draw ground X: [-240] Y: [-110]\n    pen down\n    pen up\n    set pen color to (#4cff00)\n    draw ground X: [-80] Y: [-70]\n    pen down\n    draw ground X: [-30] Y: [-70]\n    pen down\n    set pen color to (#ff0000)\n    draw ground X: [20] Y: [-70]\n    pen down\n    pen up\n    set pen color to (#4cff00)\n    draw ground X: [70] Y: [-50]\n    pen down\n    draw ground X: [120] Y: [-50]\n    pen down\n    set pen color to (#ff0000)\n    draw ground X: [170] Y: [-50]\n    pen down\n    pen up\n    portal X [150] Y [-80]\nend\nif <(level) = [7]> then\n    draw ground X: [-240] Y: [-140]\n    pen down\n    draw ground X: [240] Y: [-140]\n    pen down\n    pen up\n    set pen color to (#cccccc)\n    draw ground X: [-30] Y: [-140]\n    pen down\n    draw ground X: [-10] Y: [-90]\n    pen down\n    draw ground X: [10] Y: [-140]\n    pen down\n    set pen color to (#4bff00)\n    draw ground X: [10] Y: [-50]\n    pen down\n    draw ground X: [60] Y: [-50]\n    pen down\n    draw ground X: [60] Y: [0]\n    pen down\n    draw ground X: [90] Y: [0]\n    pen down\n    pen up\n    portal X [50] Y [-120]\nend\nstart\n\ndefine play\nchange [tick v] by (1)\nx\ny\nTouch ground <(scrolly) > [0]>\ndie [-175]\ntime (timer)\nnew level\nup y\nlist\nmouse\n\ndefine draw ground X: (x) Y: (y)\ngo to x: (x) y: (y)\n\nwhen I receive [play v]\nmap\nlevel\n\ndefine x\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<(mouse x) > (x position)> and <mouse down?>>> then\n    set [scrollx v] to [7]\n    scrollx (scrollx)\n    if <touching color (#4bff00)?> then\n        scrollx ((0) - (scrollx))\n    end\nend\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<(mouse x) < (x position)> and <mouse down?>>> then\n    set [scrollx v] to [7]\n    scrollx ((0) - (scrollx))\n    if <touching color (#4bff00)?> then\n        scrollx (scrollx)\n    end\nend\n\ndefine scrollx (scrollx)\nchange x by (scrollx)\n\nwhen I receive [play v]\nswitch backdrop to (1 v)\nwait (0.3) seconds\nshow\nforever\n    switch costume to (1 v)\n    play\nend\n\ndefine y\nchange [scrolly v] by (-1)\nchange y by (scrolly)\nchange [i v] by (1)\n\ndefine Touch ground <up>\nrepeat until <not <touching color (#4bff00)?>>\n    if <up> then\n        change y by (-2)\n    else\n        change y by (1)\n        set [scrolly v] to [0]\n    end\n    set [i v] to [0]\nend\n\ndefine up y\nif <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(mouse y) > (y position)> and <mouse down?>>> then\n    if <<(jump) = [0]> and <(i) < [3]>> then\n        set [scrolly v] to [15]\n        set [jump v] to [1]\n    end\nelse\n    set [jump v] to [0]\nend\nif <touching color (#ffe900)?> then\n    set [scrolly v] to [20]\nend\n\ndefine init\nset [the end v] to [no]\nset [scrollx v] to [0]\nset [yes v] to [no]\nset [scrolly v] to [0]\nset [level v] to [1]\nset [pfc v] to [?]\ndelete all of [x v]\ndelete all of [y v]\nshow list [force game v]\nhide variable [time v]\n\ndefine list\nadd (x position) to [x v]\nadd (y position) to [y v]\nset [x v] to (x position)\nset [y v] to (y position)\n\ndefine mouse\nif <(mouse y) > [100]> then\n    hide list [force game v]\nelse\n    show list [force game v]\nend\n\ndefine die (y)\nif <(y position) < (y)> then\n    start\nend\nif <touching color (#cccccc)?> then\n    start\nend\nif <touching color (#ff0000)?> then\n    start\nend\n\ndefine time (time)\nset [time v] to (time)\n\ndefine start\npen up\nset [scrolly v] to [0]\ndraw ground X: [-142] Y: [96]\n\nwhen I start as a clone\nshow\nif <(id) = [1]> then\n    switch costume to (2 v)\n    go to x: (-240) y: (0)\n    glide (1) secs to x: (-30) y: (0)\nend\nif <(id) = [2]> then\n    switch costume to (3 v)\n    go to x: (240) y: (0)\n    glide (1) secs to x: (30) y: (0)\nend\nif <(id) = [3]> then\n    switch costume to (4 v)\n    start sound [Ricochet v]\n    go to x: (240) y: (-40)\n    glide (0.3) secs to x: (30) y: (-40)\n    wait (1) seconds\n    broadcast (play v)\nend\nif <(id) = [4]> then\n    go to [front v] layer\n    erase all\n    set [ghost v] effect to (100)\n    stop [other scripts in sprite v]\n    broadcast (stop v)\n    go to x: (0) y: (0)\n    switch costume to (5 v)\n    repeat (50)\n        change [ghost v] effect by (-2)\n    end\n    set [yes v] to [yes]\nend\nforever\n    if <(yes) = [yes]> then\n        set [the end v] to [yes]\n        switch costume to (6 v)\n        if <(The end) = [yes]> then\n            go to x: (0) y: (50)\n            set [the end v] to [no]\n        end\n        set y to ((([sin v] of ((tick) * (5)) ) * (10)) + (50))\n    end\nend\n\nwhen I receive [play v]\ndelete this clone\n\ndefine portal X (x) Y (y)\npen up\nset pen color to (#c72cba)\nset pen size to (30)\ngo to x: (x) y: (y)\npen down\npen up\n\ndefine new level\nif <touching color (#c72cba)?> then\n    if <not <(level) = [8]>> then\n        change [level v] by (1)\n        level\n    end\n    if <(level) = [8]> then\n        stop [other scripts in sprite v]\n        hide\n        repeat (2)\n            change [id v] by (1)\n            create clone of (_myself_ v)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    set [stop time v] to ((timer) + (0.1))\nend\n\ndefine map\npen down\ngo to x: (0) y: (0)\nset pen size to (10000000000000000)\nset pen color to (#000000)\npen up\n\nchange [level v] by (-1)\nlevel\n\nchange [level v] by (1)\nlevel\n\n@foto\n\nwhen flag clicked\nforever\n    show\n    set [ghost v] effect to (100)\n    go to [front v] layer\n    go to x: (0) y: (0)\nend\n\nwhen [timer v] > (stop time)\nshow list [force game v]\n\n