Sideways (A 0° platformer)

Instructions: Volcano Escaper!!!\na scrolling platformer without lags!!!\nsee this too https://scratch.mit.edu/projects/237217855/\nvolcano escaper 2 https://scratch.mit.edu/projects/247938747/\n\n<- -> to move\nup arrow key to jump\navoid enemies\nAll levels are possible\nBe sure to love, favourite, follow, and remix if you want more!!!

@Stage\n\nwhen flag clicked\nforever\n    set [pitch v] effect to (0)\n    play sound [Imagine Dragons - Radioactive-\[www_flvto_com\] v] until done\nend\n\n@pen\n\ndefine Draw Rectangle from (x) (y) to (x2) (y2) (type) <filled?>\npen up\nset pen size to (5)\nGo To (x) (y)\npen down\nset [counter v] to [0]\nif <filled?> then\n    repeat ([floor v] of (([abs v] of ((x) - (x2)) ) / (5)) )\n        change [counter v] by (([abs v] of ((x) - (x2)) ) / (([floor v] of ([abs v] of ((x) - (x2)) ) ) / (5)))\n        Go To ((x) + (Counter)) (y)\n        Go To ((x) + (Counter)) (y2)\n    end\nend\npen up\nGo To (x) (y)\npen down\nGo To (x) (y2)\nGo To (x2) (y2)\nGo To (x2) (y)\nGo To (x) (y)\npen up\n\nwhen I receive [message1 v]\nstop [other scripts in sprite v]\nforever\n    Add particle [0] [0] (pick random (-20) to (20)) (pick random (5) to (50)) (pick random (1) to (1000)) [1]\n    erase all\n    set pen color to (#a5ff1f)\n    Render Player [0] (([sin v] of ((timer) * (200)) ) * (20))\n    Update Particles\nend\n\ndefine Render Player (x) (y)\nif <(y) < [-180]> then\n    Render Player (x) [-150]\n    stop [this script v]\nend\npen up\nset pen size to (15)\ngo to x: ((x) - (8)) y: ((y) - (8))\npen down\ngo to x: ((x) + (8)) y: ((y) - (8))\ngo to x: ((x) + (8)) y: ((y) + (8))\ngo to x: ((x) - (8)) y: ((y) + (8))\ngo to x: ((x) - (8)) y: ((y) - (8))\npen up\nset pen size to (7)\npen up\nset pen color to (#000000)\nif <(Direction) = [90]> then\n    set pen color to (#000000)\n    go to x: ((x) - (0)) y: ((y) - (2))\n    pen down\n    change y by (8)\n    set pen size to (7)\n    pen up\n    set pen color to (#000000)\n    go to x: ((x) + (10)) y: ((y) - (2))\n    pen down\n    change y by (8)\nelse\n    go to x: ((x) - (1)) y: ((y) - (2))\n    pen down\n    change y by (8)\n    set pen size to (7)\n    pen up\n    set pen color to (#000000)\n    go to x: ((x) - (10)) y: ((y) - (2))\n    pen down\n    change y by (8)\nend\npen up\nset pen color to (#6eff00)\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    Step Physics <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<key (space v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>> <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(x position) < (mouse x)>>>>\nend\n\ndefine Go To (x) (y)\ngo to x: ((x) + (Scroll X)) y: ((y) + (Scroll Y))\n\ndefine Scrolling\nchange [scroll x v] by (() - (round ((x position) / (Smoothness))))\nchange [x position v] by (() - (round ((x position) / (Smoothness))))\nchange [scroll y v] by (() - (round ((y position) / (Smoothness))))\nchange [y position v] by (() - (round ((y position) / (Smoothness))))\n\nwhen flag clicked\nset [smoothness v] to [20]\nhide variable [lag? v]\nset [lag? v] to [0]\nforever\n    Update\n    if <<(mouse y) > [50]> and <(mouse x) < [-100]>> then\n        show variable [lag? v]\n    else\n        hide variable [lag? v]\n    end\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) (50) (25) (1)\nAdd Rectangle (650) (0) (50) (25) (2)\nAdd Rectangle (650) (200) (50) (25) (1)\nAdd Rectangle (700) (100) (50) (25) (2)\nAdd Rectangle (500) (200) (50) (25) (2)\nAdd Rectangle (400) (350) (25) (25) (1)\nAdd Rectangle (450) (450) (25) (25) (1)\nAdd Rectangle (500) (550) (300) (25) (1)\nAdd Rectangle (850) (550) (300) (25) (1)\nAdd Rectangle (550) (570) (10) (60) (3)\nAdd Rectangle (650) (570) (10) (60) (3)\nAdd Rectangle (750) (570) (10) (60) (3)\nAdd Rectangle (950) (570) (30) (10) (2)\nAdd Rectangle (850) (750) (300) (30) (3)\nAdd Rectangle (1050) (570) (30) (10) (2)\nAdd Rectangle (1150) (0) (300) (25) (1)\nAdd Rectangle (1250) (20) (10) (40) (3)\nAdd Rectangle (1500) (80) (25) (25) (1)\nAdd Rectangle (1600) (160) (25) (25) (1)\nAdd Rectangle (1700) (240) (25) (25) (1)\nAdd Rectangle (1725) (240) (25) (25) (2)\nAdd Rectangle (1950) (425) (30) (5) (3)\nAdd Rectangle (2050) (425) (30) (5) (3)\nAdd Rectangle (1850) (500) (300) (25) (1)\nAdd Rectangle (2250) (400) (25) (300) (3)\nAdd Rectangle (950) (-100) (1700) (25) (2)\nAdd Rectangle (1850) (500) (25) (250) (3)\nAdd Rectangle (1925) (700) (350) (25) (1)\nAdd Rectangle (1850) (400) (400) (25) (1)\nAdd Rectangle (1900) (520) (49) (15) (2)\nAdd Rectangle (1925) (690) (100) (15) (3)\nAdd Rectangle (2325) (800) (50) (50) (4)\nAdd Rectangle (2335) (810) (30) (30) (4)\n\ndefine Draw\nerase all\ngo to x: ((x position) + (10)) y: ((y position) + (10))\nset pen color to (#6eff00)\nset pen size to ((50) + (([sin v] of ((timer) * (200)) ) * (10)))\nset pen (transparency v) to (95)\nrepeat (50)\n    change pen size by (3)\n    pen down\n    pen up\n    change pen (transparency v) by (0.1)\nend\nset pen (transparency v) to (100)\nset pen size to (50)\nrepeat (10)\n    change pen size by (20)\n    change pen (transparency v) by (3)\nend\nset pen size to (10)\nset pen (transparency v) to (0)\nset pen color to (#6eff00)\npen up\nset pen size to (5)\nset pen size to (120)\nset pen (transparency v) to (95)\npen down\npen up\nset pen size to (300)\nUpdate Particles\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))\n        set pen color to (#ff0000)\n        set pen (color v) to ((timer) * (19))\n        if <(item (i) of [level types v]) = [2]> then\n            set pen color to (#fbff30)\n        end\n        if <(item (i) of [level types v]) = [1]> then\n            set pen color to (#000000)\n        end\n        if <(item (i) of [level types v]) = [3]> then\n            set pen color to (#61ff00)\n        end\n        pen up\n        if <(Lag?) = [0]> then\n            Draw Rectangle from ((item (i) of [level xs v]) + (5)) ((item (i) of [level ys v]) + (5)) 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)) [0] \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))\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))\n        Go To ((item (i) of [level xs v]) + (5)) (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (5))\n        Go To ((item (i) of [level xs v]) + (5)) ((item (i) of [level ys v]) + (5))\n        pen up\n    end\nend\ngo to x: ((x position) + (10)) y: ((y position) + (10))\nset pen color to (#6eff00)\nRender Player ((x position) + (10)) ((y position) + (15))\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\nwhen flag clicked\n\ndefine Update Particles\nif <(Lag?) = [0]> then\n    set pen color to (#ff0042)\n    set [i2 v] to [1]\n    set pen size to (8)\n    repeat ((length of [particles v]) / (6))\n        replace item (i2) of [particles v] with ((item (i2) of [particles v]) + ((item ((i2) + (2)) of [particles v]) + ()))\n        replace item ((i2) + (1)) of [particles v] with ((item ((i2) + (1)) of [particles v]) + (item ((i2) + (3)) of [particles v]))\n        if <(item ((i2) + (5)) of [particles v]) = [1]> then\n            replace item ((i2) + (3)) of [particles v] with ((item ((i2) + (3)) of [particles v]) + (-1))\n        end\n        change [i2 v] by (6)\n    end\n    pen up\n    set [i2 v] to [1]\n    repeat ((length of [particles v]) / (6))\n        go to x: (item (i2) of [particles v]) y: (item ((i2) + (1)) of [particles v])\n        set pen (color v) to (item ((i2) + (4)) of [particles v])\n        set pen (transparency v) to (([sqrt v] of ((((x position) - (x position)) * ((x position) - (x position))) + (((y position) - (y position)) * ((y position) - (y position)))) ) / (1))\n        if <(item ((i2) + (5)) of [particles v]) = [1]> then\n            set pen (transparency v) to (([sqrt v] of (((item (i2) of [particles v]) * (item (i2) of [particles v])) + ((item ((i2) + (1)) of [particles v]) * (item ((i2) + (1)) of [particles v]))) ) / (2))\n        end\n        if <(([sqrt v] of (((item (i2) of [particles v]) * (item (i2) of [particles v])) + ((item ((i2) + (1)) of [particles v]) * (item ((i2) + (1)) of [particles v]))) ) / (2)) < [100]> then\n            Render Glow (x position) (y position) [20] [3]\n        end\n        change [i2 v] by (6)\n    end\n    set [i2 v] to [1]\n    repeat ((length of [particles v]) / (6))\n        if <<<(item ((i2) + (1)) of [particles v]) < [-180]> or <(item ((i2) + (1)) of [particles v]) > [180]>> or <<(item (i2) of [particles v]) > [240]> or <(item (i2) of [particles v]) < [-240]>>> then\n            delete ((i2) + (5)) of [particles v]\n            delete ((i2) + (4)) of [particles v]\n            delete ((i2) + (3)) of [particles v]\n            delete ((i2) + (2)) of [particles v]\n            delete ((i2) + (1)) of [particles v]\n            delete (i2) of [particles v]\n        end\n        change [i2 v] by (6)\n    end\nend\nif <(Lag?) = [1]> then\n    delete all of [particles v]\nend\n\npen down\npen up\n\ndefine Add particle (x) (y) (xv) (yv) (color) (type)\nadd (x) to [particles v]\nadd (y) to [particles v]\nadd (xv) to [particles v]\nadd (yv) to [particles v]\nadd (color) to [particles v]\nadd (type) to [particles v]\n\nwhen flag clicked\nforever\n    Add particle [240] (pick random (-180) to (180)) [-5] (pick random (-10) to (10)) (pick random (20) to (30)) [0]\n    Add particle [240] (pick random (-180) to (180)) [-5] (pick random (-10) to (10)) (pick random (20) to (30)) [0]\nend\n\ndefine Step Physics <<> <^> <>>\nDraw\nUpdate\nif <>> then\n    set [direction v] to [90]\n    change [xv v] by (1)\nend\nif <<> then\n    set [direction v] to [-90]\n    change [xv v] by (-1)\nend\nset [xv v] to ((Xv) * (0.9))\nchange [x position v] by (Xv)\nUpdate\nif <[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                        if <^> then\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\nend\nUpdate\nchange [yv v] by (-1)\nchange [y position v] by (Yv)\nUpdate\nif <[touching v] contains [1]?> then\n    change [y position v] by ((Yv) * (-1))\n    set [yv v] to [0]\nend\nUpdate\nchange [y position v] by (-1)\nUpdate\nif <[touching v] contains [1]?> then\n    if <^> then\n        set [yv v] to [15]\n    end\nend\nUpdate\nif <[touching v] contains [2]?> then\n    set [yv v] to [20]\nend\nUpdate\nif <<[touching v] contains [3]?> or <[-100] > (Yv)>> 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    repeat (50)\n        Add particle (x position) (y position) (pick random (-10) to (10)) (pick random (5) to (20)) (pick random (0) to (1000)) [1]\n    end\nend\nUpdate\nchange [y position v] by (1)\nScrolling\nset pen color to (#ffffff)\nif <[touching v] contains [4]?> then\n    broadcast (message1 v)\n    stop [this script v]\nend\nif <<key (a v) pressed?> and <mouse down?>> then\n    set [x position v] to (mouse x)\n    set [y position v] to (mouse y)\nend\nCreate Level\n\ndefine Render Glow (x) (y) (size) (quality)\nset pen size to (1)\nrepeat ((size) / (quality))\n    pen down\n    pen up\n    change pen (transparency v) by ((100) / (size))\n    change pen size by (quality)\nend\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    show\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n