Time Travel To Dino Land | A Scrolling Platformer (For SDS)

Instructions: My second platformer! \n\nInstructions:\nArrow keys, WASD or mobile controls to move.\nYou can walljump!\nAvoid spikes and lava.\nIf you get stuck, press R to restart the level.\nThere are four levels.\nAll levels are possible.\n\nLog:\n28/09/21: I WOKE UP WITH 74 MESSAGES WOW!\n30/09/21: 1000 views! Thanks you so much for viewing!\n30/09/21: #11 on Trending Tutorials!\n01/10/21: Is this serious?! 3000 views and 14 remixes!\n02/10/21: 100 loves!\n05/10/21: Top Remixed! I came into Scratch and saw that I had 237 messages and 7000 views!\n05/10/21: #64 Trending All!\n08/10/21: OMG 20,000 views, 300 loves and 300 faves!\n11/10/21: 25,000 views, 450 loves and 380 faves!\n\n\nComment: I actually read the description :D

@Stage\n\nwhen I receive [play game v]\nswitch backdrop to (jurassic v)\nforever\n    play sound (pick random (1) to (4)) until done\nend\n\nwhen I receive [tick v]\nif <(LEVEL) = [4]> then\n    switch backdrop to (jurassic with dinosaurs v)\nend\n\n@Blank\n\n@Player\n\nwhen flag clicked\nbroadcast (Green Flag v) and wait\nbroadcast (Play Game v) and wait\n\nwhen I receive [green flag v]\ngo to [front v] layer\nhide\n\nwhen I receive [play game v]\nset [level v] to [1]\nshow variable [level v]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    Game On\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v) and wait\n    end\n    if <(EXIT) = [win]> then\n        Game - Win\n    else\n        Game - Die\n    end\nend\n\ndefine Tick\nif <<<(mouse x) < (x position)> and <mouse down?>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> then\n    change [sx v] by (-2)\n    switch costume to (left v)\nend\nif <<<(x position) < (mouse x)> and <mouse down?>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>> then\n    change [sx v] by (2)\n    switch costume to (right v)\nend\nif <<<(y position) < (mouse y)> and <mouse down?>> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n    switch costume to (up v)\nend\nif <<<<(y position) < (mouse y)> and <mouse down?>> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> and <<<(mouse x) < (x position)> and <mouse down?>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>>> then\n    switch costume to (left up v)\nend\nif <<<<(y position) < (mouse y)> and <mouse down?>> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> and <<<(x position) < (mouse x)> and <mouse down?>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>>> then\n    switch costume to (right up v)\nend\nif <not <key (any v) pressed?>> then\n    switch costume to (normal v)\nend\nset [sx v] to ((sx) * (0.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    Change Player x by (round (sx))\nend\nif <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(y position) < (mouse y)> and <mouse down?>>> then\n    if <(in air) < [4]> then\n        set [sy v] to [16]\n    end\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nChange Player y by (sy)\nTest - Die\nchange [scroll x v] by (round (((x) - (SCROLL X)) / (10)))\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (10)))\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(y) < [-180]> then\n    set [exit v] to [die]\nend\nif <(LEVEL) = [5]> then\n    hide variable [level v]\n    set [scroll x v] to [0]\nend\n\ndefine Change Player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (levels v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\ndefine Change Player x by (sx)\nchange [x v] by (sx)\nPosition\nif <touching (levels v)?> then\n    repeat (20)\n        change [y v] by (1)\n        Position\n        if <not <touching (levels v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-20)\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(y position) < (mouse y)> and <mouse down?>>> then\n        if <(sx) > [0]> then\n            set [sx v] to [-16]\n        else\n            set [sx v] to [16]\n        end\n        set [in air v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <touching (levels v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\ndefine Game - Die\nset [exit v] to []\nrepeat (5)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\nhide\nwait (0.5) seconds\n\ndefine Test - Die\nif <touching (danger v)?> then\n    set [exit v] to [die]\nend\nif <touching (moving enemies v)?> then\n    set [exit v] to [die]\nend\n\ndefine Game On\nset [x v] to [-200]\nset [y v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [sx v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset size to (100) %\nset [ghost v] effect to (0)\nset rotation style [left-right v]\npoint in direction (90)\nshow\n\ndefine Game - Win\nswitch costume to (normal v)\nset rotation style [don't rotate v]\nrepeat (50)\n    point towards (portal v)\n    turn right (65) degrees\n    move ((distance to [portal v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nhide\nchange [level v] by (1)\nwait (1) seconds\n\nwhen [r v] key pressed\nGame On\n\n@Levels\n\nwhen I receive [green flag v]\nshow\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 - 1 v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 - 1 v)\n        Clone at x: [480] y: [0]\n        Clone at x: [480] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 - 1 v)\n            Clone at x: [480] y: [0]\n            Clone at x: [480] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 - 1 v)\n                Clone at x: [480] y: [0]\n                Clone at x: [480] y: [-4]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (win v)\n                end\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@Danger\n\nwhen I receive [green flag v]\nshow\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\ngo to [back v] layer\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 - 1 v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 - 1 v)\n        Clone at x: [480] y: [0]\n        Clone at x: [480] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 - 1 v)\n            Clone at x: [480] y: [0]\n            Clone at x: [480] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 - 1 v)\n                Clone at x: [480] y: [0]\n                Clone at x: [480] y: [0]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (win v)\n                end\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@Text\n\nwhen I receive [green flag v]\nshow\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 - 1 v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 - 1 v)\n        Clone at x: [480] y: [0]\n        Clone at x: [480] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 - 1 v)\n            Clone at x: [480] y: [0]\n            Clone at x: [480] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 - 1 v)\n                Clone at x: [480] y: [0]\n                Clone at x: [480] y: [0]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (win v)\n                end\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@Portal\n\nwhen I receive [green flag v]\nshow\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <<(costume [name v]) = [Open]> and <touching (player v)?>> then\n    set [exit v] to [win]\nend\n\nwhen I receive [setup v]\nset [x v] to [0]\nset [y v] to [0]\nset [eggs collected v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (closed v)\n    Create Portal at x: [1300] y: [-10]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (closed v)\n        Create Portal at x: [1300] y: [-10]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (closed v)\n            Create Portal at x: [1300] y: [-10]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (closed v)\n                Create Portal at x: [1314] y: [152]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (closed v)\n                    Create Portal at x: [99999] y: [0]\n                end\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Create Portal at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\n\nwhen I receive [open portal v]\nswitch costume to (open v)\n\n@Collectables\n\nwhen I receive [green flag v]\nshow\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    change [eggs collected v] by (1)\n    if <(EGGS COLLECTED) = (COLLECTED MAX)> then\n        broadcast (Open Portal v)\n    end\n    delete this clone\nend\n\nwhen I receive [setup v]\ngo to [front v] layer\nset [x v] to [0]\nset [y v] to [0]\nset [eggs collected v] to [0]\nset [collected max v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (egg v)\n    Clone at x: [0] y: [56]\n    Clone at x: [382] y: [75]\n    Clone at x: [587] y: [73]\n    Clone at x: [956] y: [69]\nelse\n    if <(LEVEL) = [2]> then\n        Clone at x: [-70] y: [-19]\n        Clone at x: [51] y: [-19]\n        Clone at x: [445] y: [184]\n        Clone at x: [514] y: [184]\n        Clone at x: [859] y: [62]\n        Clone at x: [1058] y: [218]\n    else\n        if <(LEVEL) = [3]> then\n            Clone at x: [-98] y: [51]\n            Clone at x: [99] y: [51]\n            Clone at x: [390] y: [94]\n            Clone at x: [598] y: [214]\n            Clone at x: [845] y: [38]\n            Clone at x: [1078] y: [38]\n        else\n            if <(LEVEL) = [4]> then\n                Clone at x: [-161] y: [11]\n                Clone at x: [493] y: [-5]\n                Clone at x: [814] y: [22]\n                Clone at x: [1130] y: [117]\n            else\n                if <(LEVEL) = [5]> then\n                    Clone at x: [999] y: [0]\n                end\n            end\n        end\n    end\nend\nset [x v] to [-99999]\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nchange [collected max v] by (1)\ncreate clone of (_myself_ v)\n\n@Thumbnail\n\nwhen I receive [green flag v]\nhide variable [eggs collected v]\nhide variable [level v]\ngo to [front v] layer\nshow\nwait (1) seconds\nhide\nshow variable [eggs collected v]\nshow variable [level v]\n\n