Scrolling Platformer Engine v0.4 [100% Pen]
@Stage\n\n@Pen\n\ndefine Draw Ground\nset [x v] to (Player X)\nset [y v] to (Player Y)\nset [loop counter v] to [0]\nrepeat ((length of [dangers v]) / (4))\n    change [loop counter v] by (4)\n    Draw Rectangle at X: ((item ((Loop Counter) - (3)) of [dangers v]) - (X)) Y: ((item ((Loop Counter) - (2)) of [dangers v]) - (Y)) Length: (item ((Loop Counter) - (1)) of [dangers v]) Height: (item ((Loop Counter) - (0)) of [dangers v]) Fill:  Outline? <> Jump Pad? <> Danger? \nend\nset [loop counter v] to [0]\nrepeat ((length of [level 1 v]) / (4))\n    change [loop counter v] by (4)\n    Draw Rectangle at X: ((item ((Loop Counter) - (3)) of [level 1 v]) - (X)) Y: ((item ((Loop Counter) - (2)) of [level 1 v]) - (Y)) Length: (item ((Loop Counter) - (1)) of [level 1 v]) Height: (item ((Loop Counter) - (0)) of [level 1 v]) Fill:  Outline? <> Jump Pad? <> Danger? <>\nend\nset [loop counter v] to [0]\nrepeat ((length of [jump pads v]) / (4))\n    change [loop counter v] by (4)\n    Draw Rectangle at X: ((item ((Loop Counter) - (3)) of [jump pads v]) - (X)) Y: ((item ((Loop Counter) - (2)) of [jump pads v]) - (Y)) Length: (item ((Loop Counter) - (1)) of [jump pads v]) Height: (item ((Loop Counter) - (0)) of [jump pads v]) Fill: <> Outline? <> Jump Pad?  Danger? <>\nend\n\ndefine Draw Rectangle at X: (x) Y: (y) Length: (length) Height: (height) Fill: <filled?> Outline? <true/false> Jump Pad? <yes/no> Danger? <danger?>\nset pen size to (5)\nif <danger?> then\n    set pen color to (#ea0303)\nelse\n    if <yes/no> then\n        set pen color to (#fff849)\n    else\n        if <true/false> then\n            set pen color to (#2167d0)\n        else\n            set pen color to (#3692ff)\n        end\n    end\nend\npen up\nset [counter v] to [5]\nif <filled?> then\n    repeat (([floor v] of ((length) / (5)) ) - (1))\n        go to x: (((x) - ((length) / (2))) + (Counter)) y: (((y) + ((height) / (2))) - (2))\n        pen down\n        go to x: (((x) - ((length) / (2))) + (Counter)) y: (((y) - ((height) / (2))) + (2))\n        change [counter v] by (5)\n    end\nend\nif <danger?> then\n    set pen color to (#ea0303)\nelse\n    if <yes/no> then\n        set pen color to (#fff849)\n    else\n        set pen color to (#3692ff)\n    end\nend\npen up\ngo to x: ((x) + ((length) / (2))) y: ((y) + ((height) / (2)))\npen down\ngo to x: ((x) + ((length) / (2))) y: ((y) - ((height) / (2)))\ngo to x: ((x) - ((length) / (2))) y: ((y) - ((height) / (2)))\ngo to x: ((x) - ((length) / (2))) y: ((y) + ((height) / (2)))\ngo to x: ((x) + ((length) / (2))) y: ((y) + ((height) / (2)))\npen up\n\nDraw Rectangle at X: [0] Y: [-100] Length: [480] Height: [0] Fill:  Outline?  Jump Pad? <> Danger? <>\nDraw Rectangle at X: [0] Y: [-60] Length: [20] Height: [80] Fill:  Outline? <> Jump Pad? <> Danger? <>\nDraw Rectangle at X: [140] Y: [-85] Length: [20] Height: [30] Fill: <> Outline? <> Jump Pad? <> Danger? <>\n\nwhen flag clicked\nset [editor v] to [0]\nif <(Editor) = [0]> then\n    broadcast (Game v)\nelse\n    broadcast (Editor v)\nend\n\ndefine Draw Player (x) (y) (transparency)\nset pen color to (#2167d0)\nset pen (brightness v) to (transparency)\npen up\ngo to x: ((x) + (4)) y: ((y) + (4))\nset pen size to (12)\npen down\ngo to x: ((x) - (4)) y: ((y) + (4))\ngo to x: ((x) - (4)) y: ((y) - (4))\ngo to x: ((x) + (4)) y: ((y) - (4))\ngo to x: ((x) + (4)) y: ((y) + (4))\npen up\nset [counter v] to [2]\nrepeat (2)\n    go to x: (((x) - (4)) + (Counter)) y: ((y) - (4))\n    pen down\n    go to x: (((x) - (4)) + (Counter)) y: ((y) + (4))\n    change [counter v] by (5)\nend\n\ndefine Touching?\nset [touching v] to [0]\nset [touching pad v] to [0]\nset [loop counter v] to [0]\nrepeat ((length of [level 1 v]) / (4))\n    change [loop counter v] by (4)\n    if <((Player X) + (7)) > (((item ((Loop Counter) - (3)) of [level 1 v]) - ((item ((Loop Counter) - (1)) of [level 1 v]) / (2))) - (6))> then\n        if <((Player X) - (7)) < (((item ((Loop Counter) - (3)) of [level 1 v]) + ((item ((Loop Counter) - (1)) of [level 1 v]) / (2))) + (6))> then\n            if <((Player Y) + (7)) > (((item ((Loop Counter) - (2)) of [level 1 v]) - ((item ((Loop Counter) - (0)) of [level 1 v]) / (2))) - (7))> then\n                if <((Player Y) - (7)) < (((item ((Loop Counter) - (2)) of [level 1 v]) + ((item ((Loop Counter) - (0)) of [level 1 v]) / (2))) + (7))> then\n                    set [touching v] to [1]\n                end\n            end\n        end\n    end\nend\nset [loop counter v] to [0]\nrepeat ((length of [jump pads v]) / (4))\n    change [loop counter v] by (4)\n    if <((Player X) + (7)) > (((item ((Loop Counter) - (3)) of [jump pads v]) - ((item ((Loop Counter) - (1)) of [jump pads v]) / (2))) - (6))> then\n        if <((Player X) - (7)) < (((item ((Loop Counter) - (3)) of [jump pads v]) + ((item ((Loop Counter) - (1)) of [jump pads v]) / (2))) + (6))> then\n            if <((Player Y) + (7)) > (((item ((Loop Counter) - (2)) of [jump pads v]) - ((item ((Loop Counter) - (0)) of [jump pads v]) / (2))) - (7))> then\n                if <((Player Y) - (7)) < (((item ((Loop Counter) - (2)) of [jump pads v]) + ((item ((Loop Counter) - (0)) of [jump pads v]) / (2))) + (7))> then\n                    set [touching pad v] to [1]\n                end\n            end\n        end\n    end\nend\nset [loop counter v] to [0]\nset [touching bad v] to [0]\nrepeat ((length of [dangers v]) / (4))\n    change [loop counter v] by (4)\n    if <((Player X) + (7)) > (((item ((Loop Counter) - (3)) of [dangers v]) - ((item ((Loop Counter) - (1)) of [dangers v]) / (2))) - (6))> then\n        if <((Player X) - (7)) < (((item ((Loop Counter) - (3)) of [dangers v]) + ((item ((Loop Counter) - (1)) of [dangers v]) / (2))) + (6))> then\n            if <((Player Y) + (7)) > (((item ((Loop Counter) - (2)) of [dangers v]) - ((item ((Loop Counter) - (0)) of [dangers v]) / (2))) - (7))> then\n                if <((Player Y) - (7)) < (((item ((Loop Counter) - (2)) of [dangers v]) + ((item ((Loop Counter) - (0)) of [dangers v]) / (2))) + (7))> then\n                    set [touching bad v] to [1]\n                end\n            end\n        end\n    end\nend\n\ndefine Touch Y\nTouching?\nif <(Touching) = [1]> then\n    repeat until <(Touching) = [0]>\n        if <(SY) < [0]> then\n            change [player y v] by (1)\n        else\n            change [player y v] by (-1)\n        end\n        Touching?\n    end\n    set [sy v] to [0]\n    set [can jump? v] to [True]\nend\n\ndefine Touch X\nTouching?\nif <(Touching) = [1]> then\n    repeat until <(Touching) = [0]>\n        if <(SX) < [0]> then\n            change [player x v] by (1)\n        else\n            change [player x v] by (-1)\n        end\n        Touching?\n    end\n    if <key (up arrow v) pressed?> then\n        set [can jump? v] to [False]\n        set [sy v] to [8]\n        if <(SX) < [0]> then\n            set [sx v] to [9]\n        else\n            set [sx v] to [-9]\n        end\n    else\n        set [sx v] to [0]\n    end\nend\n\ndefine Player (transparency start)\ninsert (Player Y) at (1) of [character places v] \ninsert (Player X) at (1) of [character places v] \ndelete (length of [character places v]) of [character places v]\ndelete (length of [character places v]) of [character places v]\nset [counter 2 v] to [22]\nset [player transparency v] to (transparency start)\nrepeat (10)\n    change [counter 2 v] by (-2)\n    Draw Player [0] [0] (Player Transparency)\n    change [player transparency v] by (10)\nend\n\ndefine Set up List\ndelete all of [character places v]\nrepeat (10)\n    add (Player X) to [character places v]\n    add (Player Y) to [character places v]\nend\n\nset [loop counter v] to [0]\n\nrepeat ((length of [dangers v]) / (4))\n    change [loop counter v] by (4)\n    Draw Rectangle at X: ((item ((Loop Counter) - (3)) of [dangers v]) - (Player X)) Y: ((item ((Loop Counter) - (2)) of [dangers v]) - (Player Y)) Length: (item ((Loop Counter) - (1)) of [dangers v]) Height: (item ((Loop Counter) - (0)) of [dangers v]) Fill:  Outline? <> Jump Pad?  Danger? \nend\nset [loop counter v] to [0]\nrepeat ((length of [level 1 v]) / (4))\n    change [loop counter v] by (4)\n    Draw Rectangle at X: ((item ((Loop Counter) - (3)) of [level 1 v]) - (Player X)) Y: ((item ((Loop Counter) - (2)) of [level 1 v]) - (Player Y)) Length: (item ((Loop Counter) - (1)) of [level 1 v]) Height: (item ((Loop Counter) - (0)) of [level 1 v]) Fill:  Outline? <> Jump Pad? <> Danger? <>\nend\nset [loop counter v] to [0]\nrepeat ((length of [jump pads v]) / (4))\n    change [loop counter v] by (4)\n    Draw Rectangle at X: ((item ((Loop Counter) - (3)) of [jump pads v]) - (Player X)) Y: ((item ((Loop Counter) - (2)) of [jump pads v]) - (Player Y)) Length: (item ((Loop Counter) - (1)) of [jump pads v]) Height: (item ((Loop Counter) - (0)) of [jump pads v]) Fill:  Outline? <> Jump Pad?  Danger? <>\nend\n\nwhen I receive [game v]\nerase all\nset [sx v] to [0]\nset [sy v] to [0]\nset [player x v] to [-200]\nset [player y v] to [-60]\nSet up List\nset [can jump? v] to [False]\nforever\n    erase all\n    set [counter 3 v] to [0]\n    Player (Counter 3)\n    Draw Ground\n    if <<(Touching Bad) = [1]> or <(Player Y) < [-1500]>> then\n        set [counter 3 v] to [0]\n        repeat (10)\n            erase all\n            Player (Counter 3)\n            Draw Ground\n            change [counter 3 v] by (-10)\n        end\n        set [sx v] to [0]\n        set [sy v] to [0]\n        set [player x v] to [-200]\n        set [player y v] to [-60]\n        Set up List\n        set [can jump? v] to [False]\n    end\n    if <(SY) < [0]> then\n        set [can jump? v] to [False]\n    end\n    if <<key (up arrow v) pressed?> and <(Can Jump?) = [True]>> then\n        set [can jump? v] to [False]\n        set [sy v] to [13]\n    end\n    change [sy v] by (-1)\n    change [player y v] by (SY)\n    Touch Y\n    if <(Touching Pad) = [1]> then\n        set [can jump? v] to [False]\n        set [sy v] to [17]\n    end\n    if <key (right arrow v) pressed?> then\n        change [sx v] by (1.5)\n    end\n    if <key (left arrow v) pressed?> then\n        change [sx v] by (-1.5)\n    end\n    set [sx v] to ((SX) * (0.8))\n    change [player x v] by (round (SX))\n    Touch X\n    Frame\n    set [mouse x v] to ((Player X) + (mouse x))\n    set [mouse y v] to ((Player Y) + (mouse y))\nend\n\ndefine Touching? [Old]\nset [touching v] to [0]\nset [touching pad v] to [0]\nset [loop counter v] to [0]\nrepeat ((length of [level 1 v]) / (4))\n    change [loop counter v] by (4)\n    if <((Player X) + (7)) > (((item ((Loop Counter) - (3)) of [level 1 v]) - ((item ((Loop Counter) - (1)) of [level 1 v]) / (2))) - (6))> then\n        if <((Player X) - (7)) < (((item ((Loop Counter) - (3)) of [level 1 v]) + ((item ((Loop Counter) - (1)) of [level 1 v]) / (2))) + (6))> then\n            if <((Player Y) + (7)) > (((item ((Loop Counter) - (2)) of [level 1 v]) - ((item ((Loop Counter) - (0)) of [level 1 v]) / (2))) - (7))> then\n                if <((Player Y) - (7)) < (((item ((Loop Counter) - (2)) of [level 1 v]) + ((item ((Loop Counter) - (0)) of [level 1 v]) / (2))) + (7))> then\n                    set [touching v] to [1]\n                end\n            end\n        end\n    end\nend\nset [loop counter v] to [0]\nrepeat ((length of [jump pads v]) / (4))\n    change [loop counter v] by (4)\n    if <((Player X) + (7)) > (((item ((Loop Counter) - (3)) of [jump pads v]) - ((item ((Loop Counter) - (1)) of [jump pads v]) / (2))) - (6))> then\n        if <((Player X) - (7)) < (((item ((Loop Counter) - (3)) of [jump pads v]) + ((item ((Loop Counter) - (1)) of [jump pads v]) / (2))) + (6))> then\n            if <((Player Y) + (7)) > (((item ((Loop Counter) - (2)) of [jump pads v]) - ((item ((Loop Counter) - (0)) of [jump pads v]) / (2))) - (7))> then\n                if <((Player Y) - (7)) < (((item ((Loop Counter) - (2)) of [jump pads v]) + ((item ((Loop Counter) - (0)) of [jump pads v]) / (2))) + (7))> then\n                    set [touching pad v] to [1]\n                end\n            end\n        end\n    end\nend\nset [loop counter v] to [0]\nset [touching bad v] to [0]\nrepeat ((length of [dangers v]) / (4))\n    change [loop counter v] by (4)\n    if <((Player X) + (7)) > (((item ((Loop Counter) - (3)) of [dangers v]) - ((item ((Loop Counter) - (1)) of [dangers v]) / (2))) - (6))> then\n        if <((Player X) - (7)) < (((item ((Loop Counter) - (3)) of [dangers v]) + ((item ((Loop Counter) - (1)) of [dangers v]) / (2))) + (6))> then\n            if <((Player Y) + (7)) > (((item ((Loop Counter) - (2)) of [dangers v]) - ((item ((Loop Counter) - (0)) of [dangers v]) / (2))) - (7))> then\n                if <((Player Y) - (7)) < (((item ((Loop Counter) - (2)) of [dangers v]) + ((item ((Loop Counter) - (0)) of [dangers v]) / (2))) + (7))> then\n                    set [touching bad v] to [1]\n                end\n            end\n        end\n    end\nend\n\ndefine Frame\nset pen color to (#000000)\npen up\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)\npen up\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\n
THIS IS NOT A GAME!!! THIS IS A DEMO!!! IF YOU WANT TO PLAY THE GAME, GO HERE: https://scratch.mit.edu/projects/281236293