100% Pen Platformer v1.2
@Stage\n\nwhen flag clicked\nask [What's your name?] and wait\nset [your name: v] to (answer)\nbroadcast (answered name v) and wait\n\n@Render\n\ndefine Render\ndelete all of [platform-type v]\ndelete all of [platform-height v]\ndelete all of [platform-length v]\ndelete all of [platform-x v]\ndelete all of [platform-y v]\nRender Grid\nPlatforms\nLava\nGravitiy\nBouncy\nWin\nDraw Player // Width: (Player width) X: (Player X) Y: (Player Y) Size: [10]\nbroadcast (tick v)\n\ndefine Draw Player // Width: (width) X: (x) Y: (y) Size: (size)\nset pen color to (#65ff00)\nLine // X: ((x) - (width)) Y: ((y) + (width)) X2: ((x) + (width)) Y2: ((y) + (width)) Size: (size)\nLine // X: ((x) + (width)) Y: ((y) + (width)) X2: ((x) + (width)) Y2: ((y) - (width)) Size: (size)\nLine // X: ((x) + (width)) Y: ((y) - (width)) X2: ((x) - (width)) Y2: ((y) - (width)) Size: (size)\nLine // X: ((x) - (width)) Y: ((y) - (width)) X2: ((x) - (width)) Y2: ((y) + (width)) Size: (size)\n\ndefine Line // X: (x) Y: (y) X2: (x2) Y2: (y2) Size: (size)\nset pen size to (size)\npen up\ngo to x: ((x) - (Cam X)) y: ((y) - (Cam Y))\npen down\ngo to x: ((x2) - (Cam X)) y: ((y2) - (Cam Y))\npen up\n\ndefine Physics // Move Speed: (speed) Jump Height: (jump)\ngo to x: ((Player X) - (Cam X)) y: ((Player Y) - (Cam Y))\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<(mouse x) > ((x position) + (10))> and <mouse down?>>> then\n    change [xvel v] by (speed)\nend\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<(mouse x) < ((x position) - (10))> and <mouse down?>>> then\n    change [xvel v] by ((0) - (speed))\nend\nset [xvel v] to ((xvel) * (0.9))\nif <([abs v] of (xvel) ) > [0.9]> then\n    Change X // Change: (round (xvel))\nend\nchange [yvel v] by (-2)\nif <(in air) < [6]> then\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(mouse y) > (x position)> and <mouse down?>>> then\n        set [yvel v] to (jump)\n    end\nend\nif <[collisions v] contains [b]?> then\n    set [yvel v] to [30]\nend\nChange Y // Change: (yvel)\nif <<<[collisions v] contains [l]?> or <(Player Y) < [-300]>> or <(Player Y) > [800]>> then\n    set [dead v] to [1]\nend\nchange [cam x v] by (((Player X) - (Cam X)) / (5))\nchange [cam y v] by (((Player Y) - (Cam Y)) / (5))\nCollisions // Width: (Collision Width)\nif <[collisions v] contains [w]?> then\n    set [win v] to [1]\nend\n\ndefine Change X // Change: (change)\nchange [player x v] by (change)\nCollisions // Width: (Collision Width)\nif <[collisions v] contains [p]?> then\n    repeat (8)\n        change [player y v] by (1)\n        Collisions // Width: (Collision Width)\n        if <not <[collisions v] contains [p]?>> then\n            stop [this script v]\n        end\n    end\n    change [player y v] by (-8)\n    repeat until <not <[collisions v] contains [p]?>>\n        Collisions // Width: (Collision Width)\n        if <(change) > [0]> then\n            change [player x v] by (-1)\n        else\n            change [player x v] by (1)\n        end\n    end\nend\n\nwhen I receive [reset v]\nReset\n\ndefine Render Grid\nset pen color to (#191919)\nset pen size to (10)\ngo to x: (((-240) - (((Cam X) * (0.5)) mod (Grid Length))) + (() mod (Grid Length))) y: (-180)\nrepeat (13)\n    pen down\n    set y to (180)\n    pen up\n    change x by (40)\n    set y to (-180)\nend\ngo to x: (-240) y: (((-180) - (((Cam Y) * (0.5)) mod (Grid Length))) + (() mod (Grid Length)))\nrepeat (10)\n    pen down\n    set x to (240)\n    pen up\n    change y by (40)\n    set x to (-240)\nend\n\ndefine Draw Platform // X: (x) Y: (y) Length: (length) Height: (height)\nadd (x) to [platform-x v]\nadd (y) to [platform-y v]\nadd ([abs v] of (length) ) to [platform-length v]\nadd ([abs v] of (height) ) to [platform-height v]\nadd [p] to [platform-type v]\nset pen color to (#00a9ff)\nset pen (brightness v) to (60)\nLine // X: ((x) - (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) + (height)) Size: (Size 2)\nLine // X: ((x) + (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) - (height)) Size: (Size 2)\nLine // X: ((x) + (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) - (height)) Size: (Size 2)\nLine // X: ((x) - (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) + (height)) Size: (Size 2)\nset pen color to (#009dff)\nLine // X: ((x) - (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) + (height)) Size: (Size 1)\nLine // X: ((x) + (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) - (height)) Size: (Size 1)\nLine // X: ((x) + (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) - (height)) Size: (Size 1)\nLine // X: ((x) - (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) + (height)) Size: (Size 1)\n\ndefine Platforms\nDraw Platform // X: [2] Y: [-40] Length: ((3) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Platform // X: [394] Y: [-40] Length: ((2) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Platform // X: [660] Y: [-40] Length: ((2) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Platform // X: [1000] Y: [150] Length: ((2) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Platform // X: [1354] Y: [150] Length: ((2) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Platform // X: [1400] Y: [-50] Length: ((4) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Platform // X: [1697] Y: [-50] Length: ((3) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Platform // X: [2074] Y: [-300] Length: ((4) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Platform // X: [2506] Y: [-300] Length: ((3) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Platform // X: [2700] Y: [-200] Length: ((1) * (Grid Length)) Height: ((0.5) * (Grid Length))\nDraw Platform // X: [2600] Y: [-100] Length: ((1) * (Grid Length)) Height: ((0.5) * (Grid Length))\nDraw Platform // X: [2400] Y: [0] Length: ((1) * (Grid Length)) Height: ((0.5) * (Grid Length))\nDraw Platform // X: [2500] Y: [-50] Length: ((1) * (Grid Length)) Height: ((0.5) * (Grid Length))\nDraw Platform // X: [2500] Y: [200] Length: ((1) * (Grid Length)) Height: ((0.5) * (Grid Length))\nDraw Platform // X: [2500] Y: [200] Length: ((1) * (Grid Length)) Height: ((0.5) * (Grid Length))\nDraw Platform // X: [2597] Y: [200] Length: ((1) * (Grid Length)) Height: ((0.5) * (Grid Length))\nDraw Platform // X: [2865] Y: [220] Length: ((1) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Platform // X: [3050] Y: [0] Length: ((3) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Platform // X: [3500] Y: [200] Length: ((2) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Platform // X: [3930] Y: [200] Length: ((2) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Platform // X: [4187] Y: [-200] Length: ((2) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Platform // X: [4620] Y: [-200] Length: ((2) * (Grid Length)) Height: ((1) * (Grid Length))\n\ndefine Change Y // Change: (change)\nif <(Reverse?) = [0]> then\n    change [player y v] by (change)\nelse\n    change [player y v] by ((0) - (change))\nend\nchange [in air v] by (1)\nCollisions // Width: (Collision Width)\nrepeat until <not <[collisions v] contains [p]?>>\n    Collisions // Width: (Collision Width)\n    set [yvel v] to [0]\n    if <(Reverse?) = [1]> then\n        if <((0) - (change)) > [0]> then\n            change [player y v] by (-1)\n            set [in air v] to [0]\n        else\n            change [player y v] by (1)\n        end\n    else\n        if <(change) > [0]> then\n            change [player y v] by (-1)\n        else\n            change [player y v] by (1)\n            set [in air v] to [0]\n        end\n    end\nend\n\ndefine Collisions // Width: (width)\ndelete all of [collisions v]\nset [i v] to [0]\nrepeat (length of [platform-x v])\n    change [i v] by (1)\n    if <not <(Player X) > (((item (i) of [platform-x v]) + (item (i) of [platform-length v])) + (width))>> then\n        if <not <(Player Y) > (((item (i) of [platform-y v]) + (item (i) of [platform-height v])) + (width))>> then\n            if <not <(Player X) < (((item (i) of [platform-x v]) - (item (i) of [platform-length v])) - (width))>> then\n                if <not <(Player Y) < (((item (i) of [platform-y v]) - (item (i) of [platform-height v])) - (width))>> then\n                    add (item (i) of [platform-type v]) to [collisions v]\n                end\n            end\n        end\n    end\nend\n\ndefine Loop\nerase all\nRender\nPhysics // Move Speed: [1.5] Jump Height: [16]\n\ndefine Draw Bounce // X: (x) Y: (y) Length: (length) Height: (height)\nadd (x) to [platform-x v]\nadd (y) to [platform-y v]\nadd ([abs v] of (length) ) to [platform-length v]\nadd ([abs v] of (height) ) to [platform-height v]\nadd [b] to [platform-type v]\nset pen color to (#ff0061)\nset pen (brightness v) to (80)\nLine // X: ((x) - (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) + (height)) Size: (Size 2)\nLine // X: ((x) + (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) - (height)) Size: (Size 2)\nLine // X: ((x) + (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) - (height)) Size: (Size 2)\nLine // X: ((x) - (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) + (height)) Size: (Size 2)\nset pen color to (#ff006e)\nLine // X: ((x) - (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) + (height)) Size: (Size 1)\nLine // X: ((x) + (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) - (height)) Size: (Size 1)\nLine // X: ((x) + (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) - (height)) Size: (Size 1)\nLine // X: ((x) - (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) + (height)) Size: (Size 1)\n\ndefine Draw Lava // X: (x) Y: (y) Length: (length) Height: (height)\nadd (x) to [platform-x v]\nadd (y) to [platform-y v]\nadd ([abs v] of (length) ) to [platform-length v]\nadd (([abs v] of (height) ) + ((0) - (pen tick))) to [platform-height v]\nadd [l] to [platform-type v]\nset pen color to (#ff8800)\nset pen (brightness v) to (60)\nLine // X: ((x) - (length)) Y: ((y) + ((height) + ((0) - (pen tick)))) X2: ((x) + (length)) Y2: ((y) + ((height) + ((0) - (pen tick)))) Size: (Size 2)\nLine // X: ((x) + (length)) Y: ((y) + ((height) + ((0) - (pen tick)))) X2: ((x) + (length)) Y2: ((y) - (height)) Size: (Size 2)\nLine // X: ((x) + (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) - (height)) Size: (Size 2)\nLine // X: ((x) - (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) + ((height) + ((0) - (pen tick)))) Size: (Size 2)\nset pen color to (#ff7b00)\nLine // X: ((x) - (length)) Y: ((y) + ((height) + ((0) - (pen tick)))) X2: ((x) + (length)) Y2: ((y) + ((height) + ((0) - (pen tick)))) Size: (Size 1)\nLine // X: ((x) + (length)) Y: ((y) + ((height) + ((0) - (pen tick)))) X2: ((x) + (length)) Y2: ((y) - (height)) Size: (Size 1)\nLine // X: ((x) + (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) - (height)) Size: (Size 1)\nLine // X: ((x) - (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) + ((height) + ((0) - (pen tick)))) Size: (Size 1)\n\nwhen I receive [scripts v]\nforever\n    change [pen tick v] by (1)\n    if <(pen tick) > [20]> then\n        repeat until <(pen tick) < [1]>\n            change [pen tick v] by (-1)\n        end\n    end\nend\n\nwhen I receive [scripts v]\nforever\n    set [reverse? v] to [0]\n    wait until <not <[collisions v] contains [r]?>>\n    wait until <[collisions v] contains [r]?>\n    set [reverse? v] to [1]\n    wait until <not <[collisions v] contains [r]?>>\n    wait until <[collisions v] contains [r]?>\n    set [reverse? v] to [0]\nend\n\ndefine Draw Gravity Switch // X: (x) Y: (y) Length: (length) Height: (height)\nadd (x) to [platform-x v]\nadd (y) to [platform-y v]\nadd (length) to [platform-length v]\nadd (height) to [platform-height v]\nadd [r] to [platform-type v]\nset pen color to (#2aff00)\nset pen (brightness v) to (60)\nLine // X: ((x) - (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) + (height)) Size: (Size 2)\nLine // X: ((x) + (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) - (height)) Size: (Size 2)\nLine // X: ((x) + (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) - (height)) Size: (Size 2)\nLine // X: ((x) - (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) + (height)) Size: (Size 2)\nset pen color to (#2aff00)\nLine // X: ((x) - (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) + (height)) Size: (Size 1)\nLine // X: ((x) + (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) - (height)) Size: (Size 1)\nLine // X: ((x) + (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) - (height)) Size: (Size 1)\nLine // X: ((x) - (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) + (height)) Size: (Size 1)\n\ndefine Lava\nDraw Lava // X: [218] Y: [-40] Length: ((2) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Lava // X: [1616] Y: [100] Length: ((2) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Lava // X: [1178] Y: [151] Length: ((2) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Lava // X: [1616] Y: [100] Length: ((2) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Lava // X: [2310] Y: [-300] Length: ((1.5) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Lava // X: [2732] Y: [200] Length: ((2) * (Grid Length)) Height: ((0.5) * (Grid Length))\nDraw Lava // X: [3715] Y: [200] Length: ((3) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Lava // X: [4404] Y: [-200] Length: ((3) * (Grid Length)) Height: ((1) * (Grid Length))\n\ndefine Reset\ndelete all of [platform-type v]\ndelete all of [platform-height v]\ndelete all of [platform-length v]\ndelete all of [platform-x v]\ndelete all of [platform-y v]\ndelete all of [collisions v]\nset [reverse? v] to [0]\nset [dead v] to [0]\nset [collision width v] to [23]\nset [grid length v] to [40]\nset [cam x v] to [0]\nset [cam y v] to [0]\nset [player x v] to [0]\nset [player y v] to [50]\nset [xvel v] to [0]\nset [yvel v] to [0]\nset [player width v] to [15]\nset [win v] to [0]\n\ndefine Bouncy\nDraw Bounce // X: [795] Y: [-40] Length: ((1) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Bounce // X: [795] Y: [-40] Length: ((1) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Bounce // X: [2305] Y: [] Length: ((1) * (Grid Length)) Height: ((0.5) * (Grid Length))\nDraw Bounce // X: [3225] Y: [0] Length: ((1) * (Grid Length)) Height: ((1) * (Grid Length))\nDraw Bounce // X: [4050] Y: [-200] Length: ((1) * (Grid Length)) Height: ((1) * (Grid Length))\n\ndefine Win\nDraw Win // X: [4800] Y: [-100] Length: ((0.5) * (Grid Length)) Height: ((0.5) * (Grid Length))\n\ndefine Draw Win // X: (x) Y: (y) Length: (length) Height: (height)\nadd (x) to [platform-x v]\nadd (y) to [platform-y v]\nadd ([abs v] of (length) ) to [platform-length v]\nadd ([abs v] of (height) ) to [platform-height v]\nadd [w] to [platform-type v]\nset pen color to (#ff00e9)\nset pen (brightness v) to (60)\nLine // X: ((x) - (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) + (height)) Size: (Size 2)\nLine // X: ((x) + (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) - (height)) Size: (Size 2)\nLine // X: ((x) + (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) - (height)) Size: (Size 2)\nLine // X: ((x) - (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) + (height)) Size: (Size 2)\nset pen color to (#ff00e7)\nLine // X: ((x) - (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) + (height)) Size: (Size 1)\nLine // X: ((x) + (length)) Y: ((y) + (height)) X2: ((x) + (length)) Y2: ((y) - (height)) Size: (Size 1)\nLine // X: ((x) + (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) - (height)) Size: (Size 1)\nLine // X: ((x) - (length)) Y: ((y) - (height)) X2: ((x) - (length)) Y2: ((y) + (height)) Size: (Size 1)\n\nwhen [timer v] > (0.01)\nerase all\nset [player x v] to [0]\nset [player y v] to [25]\nset [cam x v] to [0]\nset [cam y v] to [40]\nset [player width v] to [15]\nRender Grid\nPlatforms\nLava\nGravitiy\nBouncy\nWin\nDraw Player // Width: (Player width) X: (Player X) Y: (Player Y) Size: [10]\nbroadcast (tn v)\n\nwhen I receive [scripts v]\nforever\n    reset timer\nend\n\ndefine Gravitiy\n\nwhen I receive [scripts v]\nforever\n    play sound [ACDC-Shoot-to-Thrill v] until done\nend\n\nwhen flag clicked\nforever\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<(mouse x) > ((x position) + (10))> and <mouse down?>>>> then\n        play sound [Jump v] until done\n        wait (0.5) seconds\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching color (#ff7b00)?> then\n        broadcast (kill v)\n    end\nend\n\nwhen flag clicked\nshow list [highscores v]\n\nwhen I receive [answered name v]\nwait (0.1) seconds\nbroadcast (Scripts v)\nbroadcast (reset v) and wait\nforever\n    Loop\n    if <(Dead) = [1]> then\n        stop [other scripts in sprite v]\n        broadcast (Scripts v)\n        broadcast (reset v) and wait\n    end\n    if <[1] = (win)> then\n        repeat until <<(round (item (item # of [w] in [platform-type v]) of [platform-x v])) = (round (Player X))> and <(round (item (item # of [w] in [platform-type v]) of [platform-y v])) = (round (Player Y))>>\n            change [player x v] by (((item (item # of [w] in [platform-type v]) of [platform-x v]) - (Player X)) / (5))\n            change [player y v] by (((item (item # of [w] in [platform-type v]) of [platform-y v]) - (Player Y)) / (5))\n            set [cam x v] to (Player X)\n            set [cam y v] to (Player Y)\n            change [player width v] by (-0.3)\n            erase all\n            Render\n        end\n        set [win text v] to [You Win!]\n        broadcast (win v) and wait\n        stop [this script v]\n    end\nend\n\n@Score\n\nwhen I receive [win v]\nhide list [highscores v]\nif <(Your Time:) < (☁ Highscore)> then\n    if <[highscores v] contains (Your Name:)?> then\n        replace item (Your Name:) of [highscores v] with (join (Your Name:) (join [ - ] (Your Time:)))\n    else\n        add (join (Your Name:) (join [ - ] (Your Time:))) to [highscores v]\n    end\nend\nstop [other scripts in sprite v]\n\nwhen flag clicked\nset [your name: v] to []\nset [your time: v] to [0]\nbroadcast (asking name v)\n\nwhen I receive [answered name v]\nforever\n    wait (1) seconds\n    change [your time: v] by (1)\nend\n\nwhen I receive [win v]\nif <(Your Time:) < (☁ Highscore)> then\n    set [☁ highscore v] to (Your Time:)\nend\n\nwhen flag clicked\nshow list [highscores v]\nshow variable [☁ highscore v]\nshow variable [your time: v]\n\n@Screen\n\nwhen flag clicked\nshow\nswitch costume to (kostüm2 v)\nshow list [collisions v]\n\nwhen I receive [win v]\nswitch costume to (kostüm1 v)\nshow\nwait (5) seconds\nhide list [highscores v]\n\nwhen I receive [answered name v]\nhide\n\n@Lag Reducer\n\n
-------------------------------------------------------------------------\nPlease ❤️ and ⭐! And if you want more projects, then don't forget to follow me too.\n-------------------------------------------------------------------------\nInstructions:\n->Move the player with wasd and arrow keys (mobile          \n   friendly)\n->Don't touch the lava (orange)\n->Pink is bouncy\n->Try to beat the high score\n-------------------------------------------------------------------------\nImportant:\n->If you are a new Scratcher and beat the high score, \n   then it won't be changed into your time. Because \n   you don't have cloud variables. When it is so, please \n   write a comment with your time. And please don't lie.\n->This game is not made by myself, I just remixed it \n    from @-zerx-\n    (I changed the colour, added music, make a larger \n    level, added a timer, added high score ...)\n->If it's too laggy try turbowarb: \n   https://turbowarp.org/530638751\n-------------------------------------------------------------------------\nAbout:\n->I remixed this project and made my own level\n-------------------------------------------------------------------------