Snake - A 100% Pen Platformer
@Stage\n\nwhen flag clicked\nforever\n    play sound [08 Snake Man v] until done\nend\n\n@pen\n\nwhen flag clicked\nCreate Level\nset [xv v] to [0]\nset [yv v] to [0]\nset [x position v] to [0]\nset [y position v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nforever\n    Draw\n    Update\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [xv v] by (1)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [xv v] by (-1)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change [x position v] by (Xv)\n    Update\n    if <[touching v] contains [1]?> then\n        change [y position v] by (1)\n        Update\n        if <[touching v] contains [1]?> then\n            change [y position v] by (1)\n            Update\n            if <[touching v] contains [1]?> then\n                change [y position v] by (1)\n                Update\n                if <[touching v] contains [1]?> then\n                    change [y position v] by (1)\n                    Update\n                    if <[touching v] contains [1]?> then\n                        change [y position v] by (1)\n                        Update\n                        if <[touching v] contains [1]?> then\n                            change [x position v] by ((Xv) * (-1))\n                            change [y position v] by (-5)\n                            \n                                if <(Xv) > [0]> then\n                                    set [xv v] to [-5]\n                                else\n                                    set [xv v] to [5]\n                                end\n                                set [yv v] to [10]\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    Update\n    change [yv v] by (-1)\n    change [y position v] by (Yv)\n    Update\n    if <[touching v] contains [1]?> then\n        change [y position v] by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    Update\n    change [y position v] by (-1)\n    Update\n    if <[touching v] contains [1]?> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [yv v] to [15]\n        end\n    end\n    Update\n    if <[touching v] contains [2]?> then\n        set [yv v] to [20]\n    end\n    Update\n    if <<[touching v] contains [3]?> or <(Scroll Y) > [500]>> then\n        set [xv v] to [0]\n        set [yv v] to [0]\n        set [x position v] to [0]\n        set [y position v] to [0]\n        set [scroll x v] to [0]\n        set [scroll y v] to [0]\n    end\n    Update\n    change [y position v] by (1)\n    Scrolling\nend\n\ndefine Go To (x) (y) with shift\nGo To ((x) + (Scroll X)) ((y) + (Scroll Y)) \n\ndefine Scrolling\nchange [scroll x v] by (() - (x position))\nchange [x position v] by (() - (x position))\nchange [scroll y v] by (() - (y position))\nchange [y position v] by (() - (y position))\n\nwhen flag clicked\nforever\n    Update\nend\n\ndefine Update\ndelete (all) of [touching v]\nset [i v] to [0]\nrepeat (length of [level xs v])\n    change [i v] by (1)\n    if <<<(x position) < (((item (i) of [level xs v]) + (Scroll X)) + (item (i) of [level widths v]))> and <((x position) + (20)) > ((item (i) of [level xs v]) + (Scroll X))>> and <<(y position) < (((item (i) of [level ys v]) + (Scroll Y)) + (item (i) of [level heights v]))> and <((y position) + (20)) > ((item (i) of [level ys v]) + (Scroll Y))>>> then\n        if <not <[touching v] contains (item (i) of [level types v])?>> then\n            add (item (i) of [level types v]) to [touching v]\n        end\n    end\nend\n\ndefine Create Level\ndelete (all) of [level xs v]\ndelete (all) of [level ys v]\ndelete (all) of [level widths v]\ndelete (all) of [level heights v]\ndelete (all) of [level types v]\nAdd Rectangle (-150) (-50) (300) (25) (1)\nAdd Rectangle (150) (-50) (50) (25) (2)\nAdd Rectangle (200) (-50) (25) (150) (1)\nAdd Rectangle (225) (75) (50) (25) (1)\nAdd Rectangle (275) (50) (50) (25) (1)\nAdd Rectangle (325) (25) (50) (25) (1)\nAdd Rectangle (375) (0) (75) (25) (1)\nAdd Rectangle (450) (0) (50) (20) (3)\nAdd Rectangle (500) (0) (50) (25) (1)\nAdd Rectangle (550) (0) (50) (20) (3)\nAdd Rectangle (600) (0) (125) (25) (1)\nAdd Rectangle (725) (0) (25) (75) (3)\nAdd Rectangle (750) (0) (50) (25) (1)\nAdd Rectangle (800) (0) (25) (75) (3)\nAdd Rectangle (825) (0) (50) (25) (1)\nAdd Rectangle (950) (0) (50) (25) (2)\nAdd Rectangle (1000) (0) (100) (100) (3)\nAdd Rectangle (1100) (0) (100) (25) (1)\nAdd Rectangle (1200) (0) (25) (75) (3)\nAdd Rectangle (1275) (50) (25) (150) (3)\nAdd Rectangle (1225) (0) (125) (25) (1)\nAdd Rectangle (1300) (175) (400) (25) (3)\nAdd Rectangle (1350) (0) (100) (25) (2)\nAdd Rectangle (1450) (0) (50) (25) (1)\nAdd Rectangle (1500) (0) (150) (25) (2)\nAdd Rectangle (1650) (0) (150) (25) (1)\nAdd Rectangle (1800) (0) (25) (100) (3)\nAdd Rectangle (1825) (0) (50) (25) (1)\nAdd Rectangle (1875) (0) (25) (100) (3)\nAdd Rectangle (1900) (0) (50) (25) (1)\nAdd Rectangle (1950) (0) (25) (100) (3)\nAdd Rectangle (1975) (0) (25) (25) (1)\nAdd Rectangle (2000) (0) (25) (100) (3)\nAdd Rectangle (2025) (0) (75) (25) (1)\nAdd Rectangle (2100) (0) (50) (25) (2)\nAdd Rectangle (2150) (0) (200) (50) (3)\nAdd Rectangle (2350) (0) (60) (25) (1)\nAdd Rectangle (2410) (0) (25) (100) (3)\nAdd Rectangle (2435) (0) (40) (25) (1)\nAdd Rectangle (2475) (0) (25) (100) (3)\nAdd Rectangle (2500) (0) (150) (25) (1)\nchange [offset v] by (2800)\n\ndefine Draw\npen up\nerase all\nset pen size to (5)\nset [i v] to [0]\nrepeat (length of [level xs v])\n    change [i v] by (1)\n    if <<<((Scroll Y) + (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (5))) > [-180]> and <((Scroll Y) + ((item (i) of [level ys v]) + (5))) < [240]>> and <<((Scroll X) + (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (5))) > [-240]> and <((Scroll X) + ((item (i) of [level xs v]) + (5))) < [240]>>> then\n        Go To ((item (i) of [level xs v]) + (5)) ((item (i) of [level ys v]) + (5)) with shift\n        set pen color to (#000000)\n        if <(item (i) of [level types v]) = [2]> then\n            set pen color to (#2ca5e2)\n        end\n        if <(item (i) of [level types v]) = [1]> then\n            set pen color to (#ffffff)\n        end\n        if <(item (i) of [level types v]) = [3]> then\n            set pen color to (#5cb712)\n        end\n        pen down\n        Go To (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (5)) ((item (i) of [level ys v]) + (5)) with shift\n        Go To (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (5)) (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (5)) with shift\n        Go To ((item (i) of [level xs v]) + (5)) (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (5)) with shift\n        Go To ((item (i) of [level xs v]) + (5)) ((item (i) of [level ys v]) + (5)) with shift\n        pen up\n    end\nend\nset pen color to (#ee7d16)\nGo To (x position) (y position) <>\npen down\nGo To (x position) ((y position) + (20)) <>\nGo To ((x position) + (20)) ((y position) + (20)) <>\nGo To ((x position) + (20)) (y position) <>\nGo To (x position) (y position) <>\npen up\n\ngo to x: (10) y: (10)\ngo to x: (10) y: (10)\ngo to x: (10) y: (10)\ngo to x: (10) y: (10)\n\ndefine Add Rectangle (x) (y) (width) (height) (tyoe)\nadd (x) to [level xs v]\nadd (y) to [level ys v]\nadd (width) to [level widths v]\nadd (height) to [level heights v]\nadd (tyoe) to [level types v]\n\ndefine Go To (x) (y) <ground>\nif <ground> then\n    go to x: ((x) * (1)) y: ((([abs v] of (y) ) + (0)) * (-1))\nelse\n    go to x: ((x) * (1)) y: (y)\nend\n\n@Sprite1\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nshow\nwait (5) seconds\nhide\n\nswitch costume to (screenshot 2019-01-30 at 4 v)\nshow\n\n
Full version is out: https://scratch.mit.edu/projects/283600647/\n\n#283600647