Dino Platformer (Mobile Friendly)

Instructions: Controls:\n-Arrow keys to move\n-R to restart\n-Down arrow to crouch\nAll levels are completely possible! (And yes, including 14)\nNo Dinos were hurt in the process of making this game.\nTry this awesome game too! https://scratch.mit.edu/projects/405649735/\n

@Stage\n\nwhen flag clicked\nshow variable [level v]\nswitch backdrop to (backdrop1 v)\nforever\n    if <(Level) < [11]> then\n        switch backdrop to (backdrop1 v)\n    end\n    if <(Level) = [11]> then\n        switch backdrop to (backdrop3 v)\n    end\n    if <(Level) = [12]> then\n        switch backdrop to (backdrop2 v)\n    end\n    if <(Level) = [17]> then\n        switch backdrop to (backdrop4 v)\n    end\n    if <(Level) = [18]> then\n        switch backdrop to (backdrop1 v)\n    end\nend\n\n@Player\n\nwhen I receive [jump high v]\nset [speed y v] to [20]\n\ndefine Walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <<touching (ground v)?> or <touching (moving platforms v)?>>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (10))\n    if <<<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> and <([abs v] of (speed) ) > [3]>> then\n        if <(wall jump) = [0]> then\n            set [speed x v] to ((-1.2) * (speed))\n            set [speed y v] to [11]\n            set [falling? v] to [6]\n            set [wall jump v] to [4]\n        end\n    else\n        set [speed x v] to [0]\n    end\nend\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <<touching (ground v)?> or <touching (moving platforms v)?>>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    set [speed y v] to [0]\nend\n\nwhen flag clicked\ngo to x: (-209) y: (130)\nset [speed y v] to [0]\nforever\n    change [speed y v] by (Speed y by)\n    change y by (Speed y)\n    Touch Ground <(Speed y) > [0]>\n    if <<touching (ground v)?> or <touching (moving platforms v)?>> then\n        set [speed y v] to [0]\n        change y by (1)\n    end\n    if <(wall jump) > [0]> then\n        change [wall jump v] by (-1)\n    else\n        set [speed x v] to ((speed x) * (.7))\n        if <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n            change [speed x v] by (1.5)\n        end\n        if <<key (left arrow v) pressed?> or <<mouse down?> and <(x position) > (mouse x)>>> then\n            change [speed x v] by (-1.5)\n        end\n    end\n    if <<<key (up arrow v) pressed?> and <(Falling?) < [3]>> or <<(mouse y) > (y position)> and <<mouse down?> and <(Falling?) < [3]>>>> then\n        if <not <touching (water v)?>> then\n            set [speed y v] to [12]\n        end\n        if <touching (water v)?> then\n            set [speed y v] to [13]\n        end\n    end\n    if <(speed x) < [-.5]> then\n        Walk (90) (speed x)\n    else\n        if <(speed x) > [.5]> then\n            Walk (-90) (speed x)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <(y position) < [-185]> then\n        broadcast (Restart Level v)\n    end\nend\n\nif <<(Speed y) < [4]> or <key (up arrow v) pressed?>> then\n    change [speed y v] by (-1)\nelse\n    change [speed y v] by (-2)\nend\n\nwhen flag clicked\npoint in direction (-90)\nforever\n    if <(x position) > [246]> then\n        broadcast (Next Level v)\n    end\nend\n\nwhen I receive [next level v]\npoint in direction (-90)\ngo to x: (-209) y: (130)\nset [speed y v] to [0]\n\nwhen flag clicked\nforever\n    if <touching (spikes v)?> then\n        broadcast (Restart Level v)\n    end\n    if <touching (saws v)?> then\n        broadcast (Restart Level v)\n    end\n    if <touching (birds v)?> then\n        broadcast (Restart Level v)\n    end\n    if <touching ( lava/acid v)?> then\n        broadcast (Restart Level v)\n    end\n    if <touching (crab v)?> then\n        broadcast (Restart Level v)\n    end\nend\n\nwhen [r v] key pressed\nbroadcast (Restart Level v)\n\nwhen [s v] key pressed\nif <(username) = [JustJuliannousername]> then\n    broadcast (Next Level v)\nend\n\nwhen flag clicked\nforever\n    if <key (down arrow v) pressed?> then\n        switch costume to (crouch v)\n    end\n    if <not <key (down arrow v) pressed?>> then\n        switch costume to (idle v)\n    end\nend\n\nwhen I receive [restart level v]\ngo to x: (-209) y: (130)\npoint in direction (-90)\nset [speed y v] to [0]\n\nwhen flag clicked\nset [brightness v] effect to (0)\nset [speed y by v] to [-1]\nforever\n    if <not <touching (water v)?>> then\n        set [speed y by v] to [-1]\n    end\n    if <(Level) = [47]> then\n        if <touching (water v)?> then\n            set [speed y by v] to [-.1]\n            if <key (down arrow v) pressed?> then\n                change y by (-2)\n            end\n        end\n        if <not <touching (water v)?>> then\n            set [speed y by v] to [-1]\n        end\n    end\nend\n\nif <not <touching (water v)?>> then\n    set [speed y by v] to [-1]\nend\n\nset [speed y by v] to [-1]\n\n@Ground\n\nwhen flag clicked\nclear graphic effects\nswitch costume to (level 1 v)\ngo to x: (0) y: (0)\nforever\n    set [level v] to (costume [number v])\nend\n\nwhen I receive [next level v]\nnext costume\n\n@Spikes\n\nwhen flag clicked\ngo to [back v] layer\nclear graphic effects\ngo to x: (0) y: (0)\nswitch costume to (level 1 v)\nforever\n    switch costume to (Level)\nend\n\nwhen I receive [next level v]\nnext costume\n\n@Trampoline!\n\nwhen flag clicked\nset [level v] to [1]\nswitch costume to (costume1 v)\ngo to [back v] layer\nforever\n    if <touching (player v)?> then\n        switch costume to (costume1 v)\n        broadcast (Jump HIGH v)\n        repeat (6)\n            next costume\n            wait (.01) seconds\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) < [8]> then\n        hide\n    end\n    if <(Level) = [8]> then\n        go to x: (-33) y: (-83)\n        show\n    end\n    if <(Level) = [9]> then\n        hide\n    end\n    if <(Level) = [10]> then\n        go to x: (-53) y: (-66)\n        show\n    end\n    if <(Level) = [11]> then\n        hide\n    end\n    if <(Level) = [14]> then\n        show\n    end\n    if <(Level) = [15]> then\n        hide\n    end\n    if <(Level) = [31]> then\n        go to x: (-91) y: (-100)\n        show\n    end\n    if <(Level) = [32]> then\n        hide\n    end\nend\n\nshow\n\n\n\n@Saws\n\nwhen flag clicked\nset [saw power v] to [0]\ngo to [back v] layer\nforever\n    repeat (40)\n        change [saw power v] by (1)\n    end\n    repeat (40)\n        change [saw power v] by (-1)\n    end\nend\n\nwhen flag clicked\nhide\nforever\n    turn right (Saw Power) degrees\n    go to [back v] layer\nend\n\nwhen flag clicked\nhide\nset size to (95) %\ngo to x: (84) y: (-85)\nforever\n    if <(Level) < [4]> then\n        hide\n    end\n    if <(Level) = [4]> then\n        go to x: (89) y: (-85)\n        show\n    end\n    if <(Level) = [5]> then\n        hide\n    end\n    if <(Level) = [15]> then\n        go to x: (89) y: (-85)\n        show\n        set size to (90) %\n    end\n    if <(Level) = [16]> then\n        set size to (100) %\n        go to x: (-20) y: (17)\n    end\n    if <(Level) = [17]> then\n        hide\n    end\n    if <(Level) = [23]> then\n        set size to (90) %\n        go to x: (171) y: (-3)\n        show\n    end\n    if <(Level) = [24]> then\n        hide\n    end\n    if <(Level) = [33]> then\n        go to x: (-41) y: (-95)\n        show\n    end\n    if <(Level) = [34]> then\n        hide\n    end\n    if <(Level) = [36]> then\n        go to x: (-41) y: (-95)\n        show\n    end\n    if <(Level) = [37]> then\n        hide\n    end\nend\n\nshow\n\nhide\n\ndelete this clone\n\nset size to (90) %\n\n@Sun\n\nwhen flag clicked\ngo to x: (232) y: (177)\nforever\n    go to [back v] layer\n    change [sun size v] by (5)\n    change size by ([cos v] of (Sun Size) )\nend\n\nwhen flag clicked\nshow\nwait until <(Level) = [12]>\nhide\nwait until <(Level) = [17]>\nshow\n\nwhen flag clicked\nforever\n    if <<(Level) > [12]> and <(Level) < [17]>> then\n        hide\n    end\nend\n\n@Clouds\n\nwhen flag clicked\nhide\nforever\n    wait (pick random (2) to (5)) seconds\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nif <<<(Level) > [16]> and <(Level) < [27]>> or <<(Level) < [12]> or <(Level) > [41]>>> then\n    set [ghost v] effect to (40)\n    switch costume to (pick random (1) to (5))\n    show\n    go to x: (303) y: (pick random (75) to (175))\n    glide (4) secs to x: (-303) y: (y position)\n    delete this clone\nend\n\nset [sun size v] to [0]\n\n@Skip Button\n\nwhen flag clicked\nset size to (100) %\nreset timer\ngo to x: (-175) y: (-162)\nforever\n    if <touching (mouse-pointer v)?> then\n        point in direction (([sin v] of ((timer) * (1000)) ) + (90))\n        if <(size) = [100]> then\n            repeat (2)\n                change size by (5)\n            end\n        end\n    end\n    if <not <touching (mouse-pointer v)?>> then\n        point in direction (90)\n        if <(size) = [110]> then\n            repeat (2)\n                change size by (-5)\n            end\n        end\n    end\nend\n\nwhen this sprite clicked\nbroadcast (Next Level v)\n\nwhen flag clicked\nset [death counter v] to [0]\nhide\nforever\n    if <(Death counter) = [5]> then\n        show\n    end\nend\n\nwhen I receive [next level v]\nhide\nset [death counter v] to [0]\n\nwhen I receive [restart level v]\nchange [death counter v] by (1)\n\n@Thumbnail\n\nwhen flag clicked\nhide variable [level v]\nhide variable [level v]\ngo to [front v] layer\ngo to [front v] layer\ngo to x: (36) y: (28)\nshow\nwait (1) seconds\nhide\nshow variable [level v]\n\nshow\n\nclear graphic effects\n\nwhen flag clicked\nforever\n    next costume\nend\n\n@Restart Button\n\nwhen flag clicked\ngo to x: (-216) y: (-162)\nset size to (100) %\nreset timer\nforever\n    if <touching (mouse-pointer v)?> then\n        point in direction (([sin v] of ((timer) * (1000)) ) + (90))\n        if <(size) = [100]> then\n            repeat (2)\n                change size by (5)\n            end\n        end\n    end\n    if <not <touching (mouse-pointer v)?>> then\n        point in direction (90)\n        if <(size) = [110]> then\n            repeat (2)\n                change size by (-5)\n            end\n        end\n    end\nend\n\nwhen this sprite clicked\nbroadcast (Restart Level v)\n\n@Birds\n\nwhen flag clicked\nhide\nwait until <(Level) = [10]>\nshow\nglide (3) secs to x: (-246) y: (-30)\nhide\nwait until <(Level) = [18]>\ngo to x: (246) y: (-30)\nshow\nglide (3) secs to x: (-246) y: (-30)\nhide\n\nwhen flag clicked\nforever\n    wait (.2) seconds\n    next costume\nend\n\nwhen I receive [restart level v]\nif <(Level) = [10]> then\n    go to x: (246) y: (-30)\n    show\n    glide (3) secs to x: (-246) y: (-30)\n    hide\nend\nif <(Level) = [18]> then\n    go to x: (246) y: (-30)\n    show\n    glide (3) secs to x: (-246) y: (-30)\n    hide\n    go to x: (246) y: (-30)\nend\nif <(Level) = [33]> then\n    show\n    go to x: (246) y: (-30)\n    go to x: (246) y: (-30)\n    glide (3) secs to x: (-246) y: (-30)\n    hide\n    go to x: (246) y: (-30)\nend\n\nwhen flag clicked\nforever\n    if <(Level) < [10]> then\n        hide\n    end\n    if <(Level) = [11]> then\n        hide\n    end\n    if <(Level) = [11]> then\n        hide\n    end\nend\n\nshow\n\ngo to x: (246) y: (-30)\n\nwhen flag clicked\nforever\n    if <(Level) = [10]> then\n        go to x: (246) y: (-30)\n        show\n        glide (3) secs to x: (-246) y: (-30)\n        hide\n    end\n    if <(Level) = [18]> then\n        go to x: (246) y: (-30)\n        show\n        glide (3) secs to x: (-246) y: (-30)\n        hide\n        go to x: (246) y: (-30)\n    end\n    if <(Level) = [33]> then\n        show\n        go to x: (246) y: (-30)\n        go to x: (246) y: (-30)\n        glide (3) secs to x: (-246) y: (-30)\n        hide\n        go to x: (246) y: (-30)\n    end\nend\n\n@Moving Platforms\n\nwhen flag clicked\nhide\nforever\n    glide (1) secs to x: (92) y: (-5)\n    wait (.5) seconds\n    glide (1) secs to x: (-68) y: (-5)\n    wait (.5) seconds\n    if <(Level) = [19]> then\n        show\n        show\n    end\n    if <not <(Level) = [19]>> then\n        hide\n    end\nend\n\ngo to x: (-68) y: (-5)\n\nforever\n\nwhen flag clicked\n\nwhen I receive [next level v]\nhide\n\n@ Lava/Acid\n\nwhen flag clicked\nswitch costume to (lava v)\nhide\ngo to [back v] layer\ngo to x: (36) y: (28)\nforever\n    if <(Level) < [19]> then\n        hide\n    end\n    if <(Level) = [19]> then\n        show\n        change [lava y v] by (9)\n        change y by ([sin v] of (Lava y) )\n    end\n    if <(Level) = [20]> then\n        change [lava y v] by (9)\n        change y by ([sin v] of (Lava y) )\n    end\n    if <(Level) = [21]> then\n        change [lava y v] by (9)\n        change y by ([sin v] of (Lava y) )\n    end\n    if <(Level) = [22]> then\n        change [lava y v] by (9)\n        change y by ([sin v] of (Lava y) )\n    end\n    if <(Level) = [23]> then\n        change [lava y v] by (9)\n        change y by ([sin v] of (Lava y) )\n    end\n    if <(Level) > [23]> then\n        hide\n        switch costume to (acid v)\n    end\nend\n\nshow\n\n@Water\n\nset [lava y v] to [9]\n\nwhen flag clicked\ngo to x: (35) y: (35)\nforever\n    if <(Level) < [47]> then\n        hide\n    end\n    if <(Level) = [47]> then\n        show\n        change [lava y v] by (9)\n        go to [back v] layer\n        change y by ([sin v] of (Lava y) )\n    end\n    if <(Level) = [48]> then\n        show\n        change [lava y v] by (9)\n        go to [back v] layer\n        change y by ([sin v] of (Lava y) )\n    end\n    if <(Level) = [49]> then\n        show\n        change [lava y v] by (9)\n        go to [back v] layer\n        change y by ([sin v] of (Lava y) )\n    end\n    if <(Level) = [50]> then\n        show\n        change [lava y v] by (9)\n        go to [back v] layer\n        change y by ([sin v] of (Lava y) )\n    end\n    if <(Level) > [50]> then\n        hide\n    end\nend\n\ngo to x: (35) y: (80)\n\ngo to x: (35) y: (40)\n\n@Snow\n\nwhen flag clicked\nhide\nforever\n    if <(Level) = [36]> then\n        create clone of (_myself_ v)\n    end\n    if <(Level) = [37]> then\n        create clone of (_myself_ v)\n    end\n    if <(Level) = [38]> then\n        create clone of (_myself_ v)\n    end\n    if <(Level) = [39]> then\n        create clone of (_myself_ v)\n    end\n    if <(Level) = [40]> then\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I start as a clone\nshow\ngo to x: (pick random (235) to (-235)) y: (190)\nrepeat until < or <touching (ground v)?>>\n    change y by (-10)\nend\ndelete this clone\n\n@Crab\n\nwhen flag clicked\nset size to (30) %\nhide\nforever\n    repeat (3)\n        wait (pick random (.1) to (.25)) seconds\n        next costume\n    end\n    switch costume to (pick random (1) to (5))\nend\n\nshow\n\n@Test\n\nwhen flag clicked\nhide\n\n