Just Some Pen Platformer Code


@Stage\n\n@Main\n\nDraw Line From [185] [30] To [185] [-30]  [1] [0]\nDraw Line From [185] [-30] To [350] [-30]  [1] [0]\n\nwhen flag clicked\nset pen size to (5)\nset pen color to (#000000)\nset [level v] to [1]\nset [player x v] to (item (((Level) * (2)) - (1)) of [spawnpoints v])\nset [player y v] to (item ((Level) * (2)) of [spawnpoints v])\nset [camera x v] to (Player X)\nset [camera y v] to (Player Y)\nset [sx v] to [0]\nset [sy v] to [0]\nset [jumping v] to [1]\ndelete all of [collision list v]\nforever\n    erase all\n    change [sy v] by (-1)\n    if <<key (up arrow v) pressed?> and <<(Jumping) = [0]> and <(SY) > [-2]>>> then\n        set [sy v] to [13]\n        set [jumping v] to [1]\n    end\n    change [player y v] by (SY)\n    Touch Y <>\n    Die Check \n    change [sx v] by ((<key (right arrow v) pressed?> - <key (left arrow v) pressed?>) * (1.5))\n    set [sx v] to ((SX) * (0.8))\n    change [player x v] by (SX)\n    Touch X <>\n    Die Check <>\n    Frame []\n    set [mouse x v] to ((Camera X) + (mouse x))\n    set [mouse y v] to ((Camera Y) + (mouse y))\nend\n\ndefine Draw Line From (x) (y) To (x2) (y2) <add?> (type) (fade)\nset pen size to (5)\nSet Color (type)\nset pen (transparency v) to (fade)\nif <add?> then\n    if <<((Player X) - (240)) < (x2)> and <((Player X) + (240)) > (x)>> then\n        if <<((Player Y) - (180)) < (y2)> and <((Player Y) + (180)) > (y)>> then\n            Add (x) (y) (x2) (y2) (type)\n        end\n    end\nend\npen up\ngo to x: ((x) - (Camera X)) y: ((y) - (Camera Y))\npen down\ngo to x: ((x2) - (Camera X)) y: ((y2) - (Camera Y))\npen up\n\ndefine Render\nif <(Level) = [1]> then\n    Level 1\nelse\n    if <(Level) = [2]> then\n        Level 2\n    end\nend\n\ndefine Player (x) (y) (size) (fade)\nDraw Line From ((x) + (size)) ((y) + (size)) To ((x) + (size)) ((y) - (size)) <> [1] (fade)\nDraw Line From ((x) - (size)) ((y) - (size)) To ((x) + (size)) ((y) - (size)) <> [1] (fade)\nDraw Line From ((x) - (size)) ((y) + (size)) To ((x) - (size)) ((y) - (size)) <> [1] (fade)\nDraw Line From ((x) - (size)) ((y) + (size)) To ((x) + (size)) ((y) + (size)) <> [1] (fade)\n\ndefine Touch Y <colliding dangers?>\nTouching?\nif <<<(Touching?) = [1]> and <not <colliding dangers?>>> or <<colliding dangers?> and <not <(Touching?) = [0]>>>> then\n    if <not <(SY) > [0]>> then\n        set [player y v] to ((item ((Col Save) - (0)) of [collision list v]) + (12))\n    else\n        set [player y v] to ((item ((Col Save) - (2)) of [collision list v]) + (-12))\n    end\n    if <(SY) < [0]> then\n        set [jumping v] to [0]\n    end\n    set [sy v] to [0]\n    Touch Y <>\nend\n\ndefine Touch X <colliding dangers?>\nTouching?\nif <<<(Touching?) = [1]> and <not <colliding dangers?>>> or <<colliding dangers?> and <not <(Touching?) = [0]>>>> then\n    if <(SX) < [0]> then\n        set [player x v] to ((item ((Col Save) - (1)) of [collision list v]) + (12))\n    else\n        set [player x v] to ((item ((Col Save) - (3)) of [collision list v]) + (-12))\n    end\n    set [sx v] to [0]\n    Touch X <>\nend\n\ndefine Touching?\nset [collision counter v] to [0]\nset [touching? v] to [0]\nrepeat until <(length of [collision list v]) = (Collision Counter)>\n    change [collision counter v] by (5)\n    if <((Player X) - (12)) < ((item ((Collision Counter) - (1)) of [collision list v]) - (0))> then\n        if <((Player X) + (12)) > ((item ((Collision Counter) - (3)) of [collision list v]) + (0))> then\n            if <((Player Y) - (12)) < ((item ((Collision Counter) - (0)) of [collision list v]) - (0))> then\n                if <((Player Y) + (12)) > ((item ((Collision Counter) - (2)) of [collision list v]) + (0))> then\n                    if <(item ((Collision Counter) - (4)) of [collision list v]) > (Touching?)> then\n                        set [touching? v] to (item ((Collision Counter) - (4)) of [collision list v])\n                        set [col save v] to (Collision Counter)\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Background\nset pen size to (1000)\nset pen color to (#ffffff)\npen up\ngo to x: (0) y: (0)\npen down\npen up\nset pen color to (#f5f5f5)\nset pen size to (3)\ngo to x: ((-220) - (((Camera X) / (2)) mod (40))) y: (180)\nrepeat (13)\n    pen down\n    change y by (-360)\n    pen up\n    change y by (360)\n    change x by (40)\nend\ngo to x: (-240) y: ((160) + (((Camera Y) / (-2)) mod (40)))\nrepeat (10)\n    pen down\n    change x by (480)\n    pen up\n    change x by (-480)\n    change y by (-40)\nend\n\ndefine Set Camera <stationary?>\nif <not <stationary?>> then\n    change [camera x v] by (((Player X) - (Camera X)) / (4))\n    change [camera y v] by (((Player Y) - (Camera Y)) / (4))\n    if <(Camera Y) < [0]> then\n        set [camera y v] to [0]\n    end\n    if <(Camera X) < [0]> then\n        set [camera x v] to [0]\n    end\nend\n\ndefine Add (x1) (y1) (x2) (y2) (type)\nadd (type) to [collision list v]\nif <<(y1) < (y2)> or <(x1) < (x2)>> then\n    add (x1) to [collision list v]\n    add (y1) to [collision list v]\n    add (x2) to [collision list v]\n    add (y2) to [collision list v]\nelse\n    add (x2) to [collision list v]\n    add (y2) to [collision list v]\n    add (x1) to [collision list v]\n    add (y1) to [collision list v]\nend\n\ndefine Set Color (type)\nif <(type) = [1]> then\n    set pen color to (#66c7ff)\nelse\n    if <(type) = [2]> then\n        set pen color to (#ff4747)\n    end\nend\n\ndefine Respawn <x/y>\nif <x/y> then\n    Touch Y \nelse\n    Touch X \nend\nset [fade v] to [0]\nrepeat (10)\n    Frame (Fade)\n    change [fade v] by (10)\nend\nset [sx v] to [0]\nset [sy v] to [0]\nset [jumping v] to [1]\nrepeat (10)\n    change [player x v] by (((item (((Level) * (2)) - (1)) of [spawnpoints v]) - (Player X)) / (2))\n    change [player y v] by (((item ((Level) * (2)) of [spawnpoints v]) - (Player Y)) / (2))\n    Frame (Fade)\nend\nset [player x v] to (item (((Level) * (2)) - (1)) of [spawnpoints v])\nset [player y v] to (item ((Level) * (2)) of [spawnpoints v])\nrepeat (4)\n    Frame (Fade)\n    change [fade v] by (-25)\nend\n\ndefine Frame (fade)\ndelete all of [collision list v]\nBackground\nPlayer ([floor v] of (Player X) ) (Player Y) [10] (fade)\nRender\nSet Camera <>\n\ndefine Die Check <x/y>\nif <(Touching?) = [2]> then\n    if <x/y> then\n        Respawn \n    else\n        Respawn <>\n    end\nend\n\ndefine Level 1\nDraw Line From [-100] [0] To [100] [0]  [1] [0]\nDraw Line From [-100] [-180] To [-100] [0]  [1] [0]\nDraw Line From [60] [-180] To [60] [-80]  [1] [0]\nDraw Line From [100] [-80] To [100] [0]  [1] [0]\nDraw Line From [60] [-80] To [100] [-80]  [1] [0]\nDraw Line From [0] [0] To [-50] [0]  [2] [0]\nDraw Line From [185] [30] To [260] [30]  [1] [0]\nDraw Line From [185] [30] To [185] [-30]  [1] [0]\nDraw Line From [185] [-30] To [350] [-30]  [1] [0]\nDraw Line From [260] [60] To [260] [30]  [1] [0]\nDraw Line From [260] [60] To [350] [60]  [1] [0]\nDraw Line From [350] [-30] To [350] [60]  [1] [0]\n\ndefine Level 2\n\n@Sprite1\n\nwhen flag clicked\nhide\n\n