Pen - A Platformer
@Stage\n\n@the player\n\nwhen flag clicked\nset size to (100) %\ngo to x: (-216) y: (-66)\npoint in direction (90)\nset rotation style [left-right v]\nset [x v] to [0]\nset [y v] to [0]\nforever\n    change [y v] by (-1)\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        switch costume to (costume2 v)\n        change [x v] by (1)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        switch costume to (costume3 v)\n        change [x v] by (-1)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching color (#000000)?> then\n        fast\n        if <touching color (#000000)?> then\n            change y by (-6)\n            xcoll\n            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                set [y v] to [12]\n                if <([abs v] of (x) ) = (x)> then\n                    set [x v] to [-8]\n                else\n                    set [x v] to [8]\n                end\n            else\n                set [x v] to [0]\n            end\n        end\n    end\n    change y by (y)\n    if <touching color (#000000)?> then\n        ycoll\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(y) < [0]>> then\n            set [y v] to [14]\n        else\n            set [y v] to [0]\n        end\n    end\nend\n\ndefine fast\nrepeat (6)\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\nend\n\ndefine ycoll\nrepeat until <not <touching color (#000000)?>>\n    if <(y) > [0]> then\n        change y by (-1)\n    else\n        change y by (1)\n    end\nend\n\ndefine xcoll\nrepeat until <not <touching color (#000000)?>>\n    if <(x) > [0]> then\n        change x by (-1)\n    else\n        change x by (1)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(y position) < [-179]> then\n        go to x: (-216) y: (-66)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(x position) > [239]> then\n        erase all\n        go to x: (-216) y: (-66)\n        change [level v] by (1)\n    end\nend\n\nwhen flag clicked\nforever\n    if <not <<<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> or <<key (a v) pressed?> or <key (d v) pressed?>>>> then\n        switch costume to (costume1 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(level) = [7]> then\n        set size to (50) %\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching color (#ff0000)?> then\n        go to x: (-216) y: (-66)\n    end\nend\n\n@levels\n\nwhen flag clicked\nset [level v] to [1]\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@pen\n\nwhen flag clicked\nshow\nset pen size to (10)\npen up\nset pen color to (#000000)\nerase all\nforever\n    pen up\n    delete all of [previous v]\n    add (x position) to [previous v]\n    add (y position) to [previous v]\n    change x by (((mouse x) - (x position)) / (3))\n    change y by (((mouse y) - (y position)) / (3))\n    add (x position) to [previous v]\n    add (y position) to [previous v]\n    if <key (space v) pressed?> then\n        go to x: (item (1) of [previous v]) y: (item (2) of [previous v])\n        pen down\n        go to x: (item (3) of [previous v]) y: (item (4) of [previous v])\n    else\n        pen up\n    end\nend\n\n@Button3\n\nwhen [e v] key pressed\ngo to [front v] layer\nerase all\n\n@TB\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\n
UPDATED: Levels are harder, the eraser button is now invisible\n\nREAD BEFORE PLAYING\n\nArrow keys or WASD to move\n\nADVERTISING WILL BE REPORTED\n\nPress space to draw\nPress the e key to erase all drawing\n\nIf you are going to follow me, then you will be invited to all my studios