100% Pen Platformer
@Stage\n\n@100% Pen\n\ndefine draw world\nset [counter y v] to [0]\nrepeat (([floor v] of ((VISIBLE BLOCKS Y) - (0.01)) ) + (2))\n    set [counter x v] to [0]\n    repeat ((VISIBLE BLOCKS X) + (1))\n        2d array read   x (([floor v] of (scroll x) ) + (counter x)) y (([floor v] of (scroll y) ) + (counter y))\n        if <(returned value) > [0]> then\n            draw one block   x (((((counter x) - ((scroll x) mod (1))) * (BLOCK SIZE)) + ((BLOCK SIZE) / (2))) - (240)) y ((-1) * (((((counter y) - ((scroll y) mod (1))) * (BLOCK SIZE)) + (HALF BLOCK SIZE)) - (180))) type (returned value)\n        end\n        change [counter x v] by (1)\n    end\n    change [counter y v] by (1)\nend\n\ndefine 2d array replace   x (x) y (y) value (value)\nreplace item (((y) * (MAP SHAPE X)) + ((x) + (1))) of [current level v] with (value)\n\ndefine 2d array read   x (x) y (y)\nset [returned value v] to (item (((y) * (MAP SHAPE X)) + ((x) + (1))) of [current level v])\n\ndefine scroll to player\nset [scroll x v] to ((player x) - ((VISIBLE BLOCKS X) / (2)))\nset [scroll y v] to ((player y) - ((VISIBLE BLOCKS Y) / (2)))\nif <(scroll x) < [1]> then\n    set [scroll x v] to [1]\nend\nif <(scroll x) > (SCROLL X MAX)> then\n    set [scroll x v] to (SCROLL X MAX)\nend\nif <(scroll y) < [1]> then\n    set [scroll y v] to [1]\nend\nif <(scroll y) > (SCROLL Y MAX)> then\n    set [scroll y v] to (SCROLL Y MAX)\nend\n\ndefine move x\nif <<(right pressed) = [true]> and <(left pressed) = [true]>> then\n    set [right pressed v] to [false]\n    set [left pressed v] to [false]\nend\nif <<(right pressed) = [false]> and <(x speed) > [0]>> then\n    change [x speed v] by ((-1) * (SPEED UP X))\n    if <(x speed) < [0]> then\n        set [x speed v] to [0]\n    end\nend\nif <<(left pressed) = [false]> and <(x speed) < [0]>> then\n    change [x speed v] by (SPEED UP X)\n    if <(x speed) > [0]> then\n        set [x speed v] to [0]\n    end\nend\nif <(right pressed) = [true]> then\n    set [direction v] to [1]\n    change [x speed v] by (SPEED UP X)\n    if <(x speed) > (MAX X SPEED)> then\n        set [x speed v] to (MAX X SPEED)\n    end\nend\nif <(left pressed) = [true]> then\n    set [direction v] to [-1]\n    change [x speed v] by ((-1) * (SPEED UP X))\n    if <(x speed) < ((-1) * (MAX X SPEED))> then\n        set [x speed v] to ((-1) * (MAX X SPEED))\n    end\nend\nchange [player x v] by (x speed)\n\ndefine draw player\nset pen size to ((PLAYER PIXEL SIZE) / (2))\nset pen color to (#00a9ff)\ngo to x: (((((player x) - (scroll x)) * (BLOCK SIZE)) - (240)) - ((PLAYER PIXEL SIZE) / (4))) y: (((-1) * ((((player y) - (scroll y)) * (BLOCK SIZE)) - (180))) + ((PLAYER PIXEL SIZE) / (4)))\npen down\nchange x by ((PLAYER PIXEL SIZE) / (2))\nchange y by ((PLAYER PIXEL SIZE) / (-2))\nchange x by ((PLAYER PIXEL SIZE) / (-2))\nchange y by ((PLAYER PIXEL SIZE) / (2))\npen up\nchange y by ((PLAYER PIXEL SIZE) * (-0.1))\nif <(direction) = [1]> then\n    set x to (((((player x) - (scroll x)) * (BLOCK SIZE)) - (240)) - ((BLOCK SIZE) * (0.05)))\nelse\n    set x to ((((((player x) - (scroll x)) * (BLOCK SIZE)) - (240)) + ((BLOCK SIZE) * (0.05))) - ((PLAYER PIXEL SIZE) * (0.45)))\nend\nrepeat (2)\n    set pen size to ((PLAYER PIXEL SIZE) / (3))\n    set pen color to (#ffffff)\n    pen down\n    pen up\n    set pen size to ((PLAYER PIXEL SIZE) / (5))\n    set pen color to (#000000)\n    pen down\n    pen up\n    set pen size to ((PLAYER PIXEL SIZE) / (3))\n    change x by ((PLAYER PIXEL SIZE) * (0.45))\nend\nchange x by ((PLAYER PIXEL SIZE) * (-0.45))\nset pen size to ((PLAYER PIXEL SIZE) / (10))\nchange y by ((PLAYER PIXEL SIZE) * (-0.3))\npen down\nchange y by ((PLAYER PIXEL SIZE) * (-0.1))\nchange x by ((PLAYER PIXEL SIZE) * (-0.45))\nchange y by ((PLAYER PIXEL SIZE) * (0.1))\npen up\n\ndefine draw background\nerase all\npen up\nset pen color to (#000000)\nset pen size to (600)\ngo to x: (0) y: (0)\npen down\npen up\n\ndefine draw menu  text\npoint in direction (90)\npen up\nset pen color to (#00cce6)\nset pen size to (10)\ngo to x: (-205) y: (165)\npen down\nchange x by (-20)\nchange y by (-20)\nchange x by (20)\nchange y by (-20)\nchange x by (-20)\npen up\nchange x by (60)\nchange y by (40)\npen down\nchange x by (-20)\nchange y by (-20)\nchange x by (20)\npen up\nchange x by (-20)\npen down\nchange y by (-20)\nchange x by (20)\npen up\nchange x by (20)\nchange y by (40)\npen down\nchange y by (-40)\nchange x by (20)\npen up\nchange y by (40)\nchange x by (40)\npen down\nchange x by (-20)\nchange y by (-20)\nchange x by (20)\npen up\nchange x by (-20)\npen down\nchange y by (-20)\nchange x by (20)\npen up\nchange x by (40)\nchange y by (40)\npen down\nchange x by (-20)\nchange y by (-40)\nchange x by (20)\npen up\nchange y by (40)\nchange x by (20)\npen down\nchange x by (20)\npen up\nchange x by (-10)\npen down\nchange y by (-40)\npen up\nchange y by (40)\nchange x by (60)\npen down\nchange y by (-40)\nchange x by (20)\npen up\nchange y by (40)\nchange x by (40)\npen down\nchange x by (-20)\nchange y by (-20)\nchange x by (20)\npen up\nchange x by (-20)\npen down\nchange y by (-20)\nchange x by (20)\npen up\nchange x by (20)\nchange y by (40)\npen down\npoint in direction (165.96)\nmove (41.23) steps\npoint in direction (14.04)\nmove (41.23) steps\npoint in direction (90)\npen up\nchange x by (40)\npen down\nchange x by (-20)\nchange y by (-20)\nchange x by (20)\npen up\nchange x by (-20)\npen down\nchange y by (-20)\nchange x by (20)\npen up\nchange x by (20)\nchange y by (40)\npen down\nchange y by (-40)\nchange x by (20)\npen up\nchange y by (-20)\nchange x by (-450)\npen down\nchange x by (450)\npen up\nset pen color to (#000000)\nset pen size to (20)\ngo to x: (-190) y: (40)\npen down\nchange x by (40)\nchange y by (-80)\npen up\ngo to x: (-20) y: (40)\npen down\nchange x by (40)\nchange y by (-40)\nchange x by (-40)\nchange y by (-40)\nchange x by (40)\npen up\ngo to x: (140) y: (40)\npen down\nchange x by (40)\nchange y by (-40)\nchange x by (-40)\npen up\nchange x by (40)\npen down\nchange y by (-40)\nchange x by (-40)\npen up\n\ndefine level selection\nset [touched button v] to [0]\nset pen size to (140)\nset pen color to (#1bab00)\npen up\nif <([sqrt v] of ((((-160) - (mouse x)) * ((-160) - (mouse x))) + (((0) - (mouse y)) * ((0) - (mouse y)))) ) < [70]> then\n    change pen (brightness v) by (50)\n    set [touched button v] to [1]\nend\ngo to x: (-160) y: (0)\npen down\npen up\nset pen color to (#9ead00)\nif <([sqrt v] of ((((0) - (mouse x)) * ((0) - (mouse x))) + (((0) - (mouse y)) * ((0) - (mouse y)))) ) < [70]> then\n    change pen (brightness v) by (50)\n    set [touched button v] to [2]\nend\ngo to x: (0) y: (0)\npen down\npen up\nset pen color to (#ad0000)\nif <([sqrt v] of ((((160) - (mouse x)) * ((160) - (mouse x))) + (((0) - (mouse y)) * ((0) - (mouse y)))) ) < [70]> then\n    change pen (brightness v) by (50)\n    set [touched button v] to [3]\nend\ngo to x: (160) y: (0)\npen down\npen up\nif <<<(mouse pressed last frame) = [false]> and <(mouse pressed) = [true]>> and <not <(touched button) = [0]>>> then\n    set [selected level v] to (touched button)\nend\n\ndefine load level\ndelete all of [current level v]\nif <(selected level) = [1]> then\n    set [i v] to [1]\n    repeat (length of [level 1 v])\n        add (item (i) of [level 1 v]) to [current level v]\n        change [i v] by (1)\n    end\nend\nif <(selected level) = [2]> then\n    set [i v] to [1]\n    repeat (length of [level 2 v])\n        add (item (i) of [level 2 v]) to [current level v]\n        change [i v] by (1)\n    end\nend\nif <(selected level) = [3]> then\n    set [i v] to [1]\n    repeat (length of [level 3 v])\n        add (item (i) of [level 3 v]) to [current level v]\n        change [i v] by (1)\n    end\nend\n\nwhen flag clicked\nconstants\nmenu\nreset level\nforever\n    repeat until <<(won) = [true]> or <(hurt) = [true]>>\n        input\n        move x\n        correct x position\n        jump\n        fall\n        correct y positon\n        scroll to player\n        draw background\n        draw world\n        draw player\n        draw border\n    end\n    end level\nend\n\ndefine fall\nif <<(y speed) > ((-1) * (JUMP REGULATION))> or <(up pressed) = [true]>> then\n    change [y speed v] by (SPEED UP Y MIN)\nelse\n    change [y speed v] by (SPEED UP Y MAX)\nend\nif <(y speed) > (MAX Y SPEED)> then\n    set [y speed v] to (MAX Y SPEED)\nend\nchange [player y v] by (y speed)\n\ndefine input\nset [up pressed last frame v] to (up pressed)\nset [up pressed v] to <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>>\nset [right pressed v] to <<key (right arrow v) pressed?> or <key (d v) pressed?>>\nset [left pressed v] to <<key (left arrow v) pressed?> or <key (a v) pressed?>>\nset [jump pressed v] to <<(up pressed) = [true]> and <(up pressed last frame) = [false]>>\n\ndefine draw one block   x (x) y (y) type (type)\nif <(type) = [3]> then\n    set pen color to (#db2525)\nelse\n    if <(type) = [4]> then\n        set pen color to (#e800ad)\n    else\n        set pen color to (#db8600)\n    end\nend\nset pen size to (PEN SIZE)\ngo to x: ((x) - ((HALF BLOCK SIZE) - (HALF PEN SIZE))) y: ((y) + ((HALF BLOCK SIZE) - (HALF PEN SIZE)))\npen down\ngo to x: ((x) + ((HALF BLOCK SIZE) - (HALF PEN SIZE))) y: (y position)\ngo to x: (x position) y: ((y) - ((HALF BLOCK SIZE) - (HALF PEN SIZE)))\ngo to x: ((x) - ((HALF BLOCK SIZE) - (HALF PEN SIZE))) y: (y position)\ngo to x: (x position) y: ((y) + ((HALF BLOCK SIZE) - (HALF PEN SIZE)))\npen up\nif <(type) = [2]> then\n    set pen size to (GRASS SIZE)\n    set pen color to (#2bda00)\n    go to x: ((x) - ((HALF BLOCK SIZE) - (HALF GRASS SIZE))) y: ((y) + ((HALF BLOCK SIZE) - (HALF GRASS SIZE)))\n    pen down\n    go to x: ((x) + ((HALF BLOCK SIZE) - (HALF GRASS SIZE))) y: (y position)\n    pen up\nend\nset pen size to (1)\nset pen color to (#000000)\ngo to x: ((x) - (HALF BLOCK SIZE)) y: ((y) + (HALF BLOCK SIZE))\npen down\ngo to x: ((x) + (HALF BLOCK SIZE)) y: (y position)\ngo to x: (x position) y: ((y) - (HALF BLOCK SIZE))\ngo to x: ((x) - (HALF BLOCK SIZE)) y: (y position)\ngo to x: (x position) y: ((y) + (HALF BLOCK SIZE))\npen up\n\ndefine draw border\npen up\nset pen size to ((PEN SIZE) + (1))\nset pen color to (#0000d0)\ngo to x: (-240) y: (180)\npen down\ngo to x: (240) y: (180)\ngo to x: (240) y: (-180)\ngo to x: (-240) y: (-180)\ngo to x: (-240) y: (180)\n\ndefine correct x position\nif <(x speed) > [0]> then\n    2d array read   x ([floor v] of ((player x) + (HALF PLAYER SIZE)) ) y ([floor v] of ((player y) - (HALF PLAYER SIZE)) )\n    set [block 1 v] to (returned value)\n    2d array read   x ([floor v] of ((player x) + (HALF PLAYER SIZE)) ) y ([floor v] of ((player y) + (HALF PLAYER SIZE)) )\n    set [block 2 v] to (returned value)\n    if <<<(block 1) = [1]> or <(block 1) = [2]>> or <<(block 2) = [1]> or <(block 2) = [2]>>> then\n        set [player x v] to ((([floor v] of ((player x) + (HALF PLAYER SIZE)) ) - (HALF PLAYER SIZE)) - (0.004))\n        set [x speed v] to [0]\n    end\n    special hit\nelse\n    2d array read   x ([floor v] of ((player x) - (HALF PLAYER SIZE)) ) y ([floor v] of ((player y) - (HALF PLAYER SIZE)) )\n    set [block 1 v] to (returned value)\n    2d array read   x ([floor v] of ((player x) - (HALF PLAYER SIZE)) ) y ([floor v] of ((player y) + (HALF PLAYER SIZE)) )\n    set [block 2 v] to (returned value)\n    if <<<(block 1) = [1]> or <(block 1) = [2]>> or <<(block 2) = [1]> or <(block 2) = [2]>>> then\n        set [player x v] to ((([ceiling v] of ((player x) - (HALF PLAYER SIZE)) ) + (HALF PLAYER SIZE)) + (0.004))\n        set [x speed v] to [0]\n    end\n    special hit\nend\n\ndefine correct y positon\nset [is grounded v] to [false]\nif <(y speed) < [0]> then\n    2d array read   x ([floor v] of ((player x) + (HALF PLAYER SIZE)) ) y ([floor v] of ((player y) - (HALF PLAYER SIZE)) )\n    set [block 1 v] to (returned value)\n    2d array read   x ([floor v] of ((player x) - (HALF PLAYER SIZE)) ) y ([floor v] of ((player y) - (HALF PLAYER SIZE)) )\n    set [block 2 v] to (returned value)\n    if <<<(block 1) = [1]> or <(block 1) = [2]>> or <<(block 2) = [1]> or <(block 2) = [2]>>> then\n        start sound [Hit v]\n        set [player y v] to ((([ceiling v] of ((player y) - (HALF PLAYER SIZE)) ) + (HALF PLAYER SIZE)) + (0.004))\n        set [y speed v] to [0]\n    end\n    special hit\nelse\n    2d array read   x ([floor v] of ((player x) + (HALF PLAYER SIZE)) ) y ([floor v] of ((player y) + (HALF PLAYER SIZE)) )\n    set [block 1 v] to (returned value)\n    2d array read   x ([floor v] of ((player x) - (HALF PLAYER SIZE)) ) y ([floor v] of ((player y) + (HALF PLAYER SIZE)) )\n    set [block 2 v] to (returned value)\n    if <<<(block 1) = [1]> or <(block 1) = [2]>> or <<(block 2) = [1]> or <(block 2) = [2]>>> then\n        set [player y v] to ((([floor v] of ((player y) + (HALF PLAYER SIZE)) ) - (HALF PLAYER SIZE)) - (0.004))\n        set [is grounded v] to [true]\n        set [y speed v] to [0]\n    end\n    special hit\nend\n\ndefine jump\nif <<(jump pressed) = [true]> and <(is grounded) = [true]>> then\n    start sound [Jump v]\n    set [y speed v] to ((-1) * (JUMP HEIGHT))\nend\n\ndefine special hit\nif <<(block 1) = [3]> or <(block 2) = [3]>> then\n    set [hurt v] to [true]\nend\nif <<(block 1) = [4]> or <(block 2) = [4]>> then\n    set [won v] to [true]\nend\n\ndefine constants\nset [map shape x v] to [100]\nset [map shape y v] to [20]\nset [visible blocks x v] to [11]\nset [visible blocks y v] to ((0.75) * (VISIBLE BLOCKS X))\nset [block size v] to ((480) / (VISIBLE BLOCKS X))\nset [half block size v] to ((BLOCK SIZE) / (2))\nset [scroll x max v] to (((MAP SHAPE X) - (VISIBLE BLOCKS X)) - (1))\nset [scroll y max v] to (((MAP SHAPE Y) - (VISIBLE BLOCKS Y)) - (1))\nset [max x speed v] to [0.16]\nset [speed up x v] to [0.015]\nset [speed up y min v] to [0.03]\nset [speed up y max v] to [0.06]\nset [max y speed v] to [0.9]\nset [jump height v] to [0.45]\nset [jump regulation v] to [0.1]\nset [player size v] to [0.9]\nset [half player size v] to ((PLAYER SIZE) / (2))\nset [player pixel size v] to ((PLAYER SIZE) * (BLOCK SIZE))\nset [pen size v] to ((BLOCK SIZE) / (2))\nset [half pen size v] to ((PEN SIZE) / (2))\nset [grass size v] to ((BLOCK SIZE) / (4))\nset [half grass size v] to ((GRASS SIZE) / (2))\nset [easy v] to [EASY]\nset [medium v] to [MEDIUM]\nset [hard v] to [HARD]\nset [global wins 1 v] to [GLOBAL WINS:]\nset [global wins 2 v] to [GLOBAL WINS:]\nset [global wins 3 v] to [GLOBAL WINS:]\n\ndefine reset level\nset [player x v] to [4]\nset [player y v] to [15]\nset [x speed v] to [0]\nset [y speed v] to [0]\nset [is grounded v] to [false]\nset [up pressed v] to [false]\nset [direction v] to [1]\nset [won v] to [false]\nset [hurt v] to [false]\n\ndefine menu\nshow variable [easy v]\nshow variable [medium v]\nshow variable [hard v]\nshow variable [global wins 1 v]\nshow variable [global wins 2 v]\nshow variable [global wins 3 v]\nshow variable [☁ global wins easy v]\nshow variable [☁ global wins medium v]\nshow variable [☁ global wins hard v]\nset [selected level v] to [0]\nset [mouse pressed last frame v] to [false]\nrepeat until <not <(selected level) = [0]>>\n    set [mouse pressed v] to <mouse down?>\n    draw background\n    level selection\n    draw menu  text\n    set [mouse pressed last frame v] to (mouse pressed)\nend\nload level\nhide variable [easy v]\nhide variable [medium v]\nhide variable [hard v]\nhide variable [global wins 1 v]\nhide variable [global wins 2 v]\nhide variable [global wins 3 v]\nhide variable [☁ global wins easy v]\nhide variable [☁ global wins medium v]\nhide variable [☁ global wins hard v]\nbroadcast (play music v)\n\ndefine draw winning screen\npen up\nset pen color to (#ded500)\nset pen size to (30)\ngo to x: (-160) y: (120)\npen down\npoint in direction (135)\nmove (50) steps\npoint in direction (45)\nmove (50) steps\npen up\nmove (-50) steps\npen down\npoint in direction (90)\nchange y by (-60)\npen up\nchange y by (95)\nchange x by (80)\npen down\nchange x by (71)\nchange y by (-95)\nchange x by (-71)\nchange y by (95)\npen up\nchange x by (116)\npen down\nchange y by (-95)\nchange x by (71)\nchange y by (95)\npen up\ngo to x: (-170) y: (-30)\npen down\nrepeat (2)\n    point in direction (165)\n    move (98) steps\n    point in direction (15)\n    move (98) steps\nend\npen up\nchange x by (45)\npen down\nchange x by (71)\nchange y by (-95)\nchange x by (-71)\nchange y by (95)\npen up\nchange x by (116)\nchange y by (-95)\npen down\nchange y by (95)\npoint in direction (145)\nmove (115) steps\npoint in direction (90)\nchange y by (95)\npen up\n\nwhen I receive [play music v]\nforever\n    play sound [Music v] until done\nend\n\ndefine end level\nif <(won) = [true]> then\n    stop [other scripts in sprite v]\n    stop all sounds\n    start sound [Triumph v]\n    if <(selected level) = [1]> then\n        change [☁ global wins easy v] by (1)\n    end\n    if <(selected level) = [2]> then\n        change [☁ global wins medium v] by (1)\n    end\n    if <(selected level) = [3]> then\n        change [☁ global wins hard v] by (1)\n    end\n    wait (1) seconds\n    draw background\n    draw winning screen\n    wait (3) seconds\n    menu\nelse\n    if <(hurt) = [true]> then\n        start sound [hurt v]\n        wait (0.2) seconds\n    end\nend\nreset level\n\n
This Project is 100% Pen. There are no sprites used.\n\nWalk and jump with the arrow keys or w a s d. You can also jump with space. Hold the jump key to jump higher.You have to walk through the level. Don't touch the red blocks. The pink blocks are your goal.\n\nThis game might be a bit laggy on your computer...\n\nWrite feedback and bugs in the comments.\nIs the game too easy? Or too hard? Is it frustrating?\n\nThanks for playing and have fun! :D\n\nTags:\n#all #games #game #platformer #pen #100 #scroller #scrolling