Hero - A Platformer||Part 2 The Desert

Instructions: Welcome to Hero - A Platformer!\n\nSee the series https://scratch.mit.edu/studios/31384744.\n\nInstructions:\nArrow Keys or WASD to move.\nS or Down Arrow to crouch.\n\nPlease heart and fave because I spent a good deal of time on this. I really want it to get top loved or something.\n\nPart 1: The Grasslands(Shared)\nPart2: The Desert(Shared)\nPart 3: The Cave(Shared)\nPart 4: Winter World(Shared)\nPart 5: Lava Land(WIP)\nPart 6: Hero Unblocked(Shared)\n\n\nCredits:\n@talexat for green flag + mute and skip buttons.\n@twonerds for his amazing intro template.\n@TrentonTNT for love, fave, and follow art.\n@coolcoder1213 for the rest.\n\nThat concludes everything. Now, go win!!!\n\nJust A Couple Of Tags:\n#art\n#music\n#games\n#all\n#coolcoder1213\n#platformer\n#supercoolproject\n#griffpatch\n#trending\n#sus\n#part2\n

@Stage\n\nwhen flag clicked\nbroadcast (\[Intro\] Start Intro v)\n\nwhen flag clicked\nwait (8) seconds\nforever\n    play sound [The Piano Moosic v] until done\nend\n\nwhen flag clicked\nforever\n    if <([costume # v] of [sound v]) = [1]> then\n        set volume to (0) %\n    else\n        set volume to (100) %\n    end\nend\n\n@Player\n\nwhen I receive [reset v]\nset [x vel v] to [0]\nset [y vel v] to [0]\ngo to x: (-200) y: (40)\n\ndefine Engine\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    change [x vel v] by (-1.5)\nend\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    change [x vel v] by (1.5)\nend\nset [x vel v] to ((X Vel) * (.85))\nchange x by (X Vel)\nif <touching (ground v)?> then\n    change y by (1)\nend\nif <touching (ground v)?> then\n    change y by (1)\nend\nif <touching (ground v)?> then\n    change y by (1)\nend\nif <touching (ground v)?> then\n    change y by (1)\nend\nif <touching (ground v)?> then\n    change y by (-4)\n    change x by ((X Vel) * (-1))\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        if <(X Vel) > [0]> then\n            set [x vel v] to [-10]\n        else\n            set [x vel v] to [10]\n        end\n        set [y vel v] to [15]\n    else\n        set [x vel v] to [0]\n    end\nend\nchange [y vel v] by (-1)\nchange y by (Y Vel)\nif <touching (ground v)?> then\n    change y by ((Y Vel) - ((Y Vel) * (2)))\n    set [y vel v] to [0]\n    if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n        switch costume to (crouch v)\n    else\n        switch costume to (player v)\n    end\nend\nchange y by (-1)\nif <<touching (ground v)?> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n    set [y vel v] to [15]\nend\nchange y by (1)\nif <touching (flag v)?> then\n    change [level v] by (1)\n    broadcast (Next v)\n    broadcast (Reset v)\n    start sound [Ding v]\nend\nif <touching (danger v)?> then\n    start sound [Death v]\n    broadcast (Reset v)\nend\n\nwhen I receive [play v]\nset volume to (100) %\nshow\nswitch backdrop to (sunset v)\nbroadcast (Reset v)\nset [level v] to [1]\nforever\n    Engine\nend\n\nwhen flag clicked\nhide variable [cloneid v]\nhide variable [spin v]\nhide variable [level v]\nhide variable [x vel v]\nhide variable [y vel v]\nhide\nbroadcast (Reset v)\n\n@Ground\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\nshow\n\nwhen flag clicked\nswitch costume to (1 v)\ngo to x: (0) y: (0)\nforever\n    go to [back v] layer\n    switch costume to (Level)\nend\n\n@Trail\n\nwhen I start as a clone\nset [ghost v] effect to (0)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\nshow\n\nwhen I receive [play v]\nforever\n    go to (player v)\n    switch costume to ([costume # v] of [player v])\n    create clone of (_myself_ v)\nend\n\n@Background\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\nshow\nswitch costume to (costume1 v)\ngo to x: (0) y: (0)\nforever\n    go to [back v] layer\n    switch costume to (Level)\nend\n\n@Intro \n\nwhen I start as a clone\nif <(Clone ID) = [Box]> then\n    switch costume to (box v)\n    point in direction (180)\n    set [ghost v] effect to (50)\n    set [brightness v] effect to (100)\n    set size to (15) %\n    show\n    go to x: ((Var 1) * (40)) y: (-190)\n    go to [front v] layer\n    repeat until <(y position) > (((Var 2) * (40)) - (1))>\n        change y by (((((Var 2) * (40)) + (2)) - (y position)) / (5))\n    end\n    set y to ((Var 2) * (40))\n    repeat until <(size) > [89]>\n        change size by (((91) - (size)) / (5))\n        turn right (((180) - (direction)) / (5)) degrees\n        change [ghost v] effect by (-5)\n    end\n    set size to (90) %\n    set [ghost v] effect to (0)\n    point in direction (180)\n    wait (1) seconds\n    repeat (30)\n        turn right (7) degrees\n        change [ghost v] effect by (4)\n        change size by (-4)\n    end\n    hide\n    delete this clone\nend\n\nwhen I start as a clone\nif <(Clone ID) = [Arrow]> then\n    set [ghost v] effect to (0)\n    set size to (185) %\n    switch costume to (arrow v)\n    show\n    go to x: (0) y: (-70000000)\n    Smooth Glide x: [0] y: [-250] speed: [9] [0]\n    wait until <(timer) > [3.5]>\n    delete this clone\nend\nif <(Clone ID) = [Letter]> then\n    wait until <(timer) > [2]>\n    if <((Length) / (3)) > (#)> then\n        wait (0.25) seconds\n    else\n        if <(((Length) / (3)) + ((Length) / (3))) > (#)> then\n            wait (0.6) seconds\n        else\n            if <((Length) + (1)) > (#)> then\n                wait (1) seconds\n            end\n        end\n    end\n    go to [front v] layer\n    show\n    set size to (Size) %\n    set [ghost v] effect to (0)\n    go to x: (x position) y: (300)\n    Smooth Glide x: (x position) y: [0] speed: [3] []\n    wait until <(timer) > [3.5]>\n    delete this clone\nend\nif <(Clone ID) = [Logo]> then\n    wait until <(timer) > [3.5]>\n    Clone Particles\n    show\n    switch costume to (logo v)\n    go to x: (0) y: (0)\n    set size to (0) %\n    Bounce with (75) , (10) and (100)\n    wait until <(timer) > [5.7]>\n    Clone Particles\n    point in direction (90)\n    set [var 1 v] to [5]\n    turn right (2) degrees\n    repeat until <(round (direction)) = [90]>\n        go to [front v] layer\n        point in direction ((([tan v] of (Var 1) ) * (10)) + (90))\n        change [var 1 v] by (4)\n    end\n    point in direction (90)\n    Clone Particles\n    set [var 1 v] to [10]\n    repeat (33)\n        change y by ((0) - (Var 1))\n        change size by (((Var 1) - (10)) / (5))\n        change [var 1 v] by (-1)\n    end\n    delete this clone\nend\nif <(Clone ID) = [Letter 1]> then\n    wait until <(timer) > [6]>\n    wait ((#) / (Length)) seconds\n    go to [front v] layer\n    set size to (Size) %\n    show\n    set [var 1 v] to (x position)\n    go to x: (300) y: (-130)\n    Smooth Glide x: (Var 1) y: [-130] speed: [5] [0]\n    wait (0.5) seconds\n    Smooth Glide x: [-230] y: [-130] speed: [5] [5]\nend\n\nwhen I start as a clone\nif <(Clone ID) = [Back]> then\n    set [color v] effect to (0)\n    switch costume to (back v)\n    set size to (2000) %\n    show\n    go to [back v] layer\n    go to x: (0) y: (0)\n    wait until <(timer) > [3]>\n    switch costume to (back 2 v)\n    set [color v] effect to (-60)\n    repeat until <(timer) > [10.3]>\n        repeat (16)\n            change y by (4)\n            change x by (-4)\n        end\n        go to x: (0) y: (0)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(Clone ID) = [Ghost]> then\n    wait until <(timer) > [3]>\n    switch costume to (ghost v)\n    set size to (2000) %\n    show\n    go to [back v] layer\n    go [forward v] (1) layers\n    go to x: (0) y: (0)\n    set [ghost v] effect to (50)\n    wait until <(timer) > [10.3]>\n    delete this clone\nend\n\nwhen I start as a clone\nif <(Clone ID) = [Particle]> then\n    switch costume to (particle v)\n    clear graphic effects\n    set size to (100) %\n    go to x: (0) y: (0)\n    set [color v] effect to (pick random (110) to (130))\n    go to [back v] layer\n    go [forward v] (2) layers\n    set [var 1 v] to (pick random (10) to (15))\n    set [var 2 v] to (pick random (2) to (7))\n    turn right (pick random (-10) to (10)) degrees\n    show\n    repeat until <touching (_edge_ v)?>\n        move (Var 1) steps\n        change y by (Var 2)\n        change [var 2 v] by (-0.4)\n        set [var 1 v] to ((Var 1) * (0.95))\n    end\n    repeat (10)\n        move (Var 1) steps\n        change y by (Var 2)\n        change [var 2 v] by (-0.4)\n        set [var 1 v] to ((Var 1) * (0.95))\n        change [ghost v] effect by (10)\n    end\n    hide\n    delete this clone\nend\n\ndefine Clone Particles\nset [clone id v] to [Particle]\nrepeat (75)\n    create clone of (_myself_ v)\n    turn right (15) degrees\nend\npoint in direction (90)\n\ndefine Clone Row of Boxes\nset [brightness v] effect to (10)\nrepeat (9)\n    create clone of (_myself_ v)\n    change [var 2 v] by (-1)\n    change [brightness v] effect by (-2)\nend\n\ndefine Bounce with (bounciness) , (speed) and (finishing size)\nset [var 1 v] to [0]\nrepeat until <<(finishing size) = (size)> and <(Var 1) = (size)>>\n    set [var 2 v] to (((Var 2) * ((bounciness) / (100))) + (((finishing size) - (size)) * ((speed) / (20))))\n    set [var 1 v] to (size)\n    change size by (Var 2)\nend\nset size to (finishing size) %\n\ndefine Smooth Glide x: (x) y: (y) speed: (speed) (ghost)\nrepeat until <<(round (x position)) = (round (x))> and <(round (y position)) = (round (y))>>\n    change x by (((round (x)) - (round (x position))) / (speed))\n    change y by (((round (y)) - (round (y position))) / (speed))\n    change [ghost v] effect by (ghost)\nend\ngo to x: (x) y: (y)\n\ndefine Type: System (text) (x) (y) (size) (color) (brightness) (speed)\nswitch costume to (master v)\nhide\ngo to x: (x) y: (y)\nset size to (size) %\nset [# v] to [1]\nset [color v] effect to (color)\nset [brightness v] effect to (brightness)\nset [length v] to (length of (text))\nrepeat (length of (text))\n    reset timer\n    if <(letter (#) of (text)) > [ ]> then\n        switch costume to (letter (#) of (text))\n        create clone of (_myself_ v)\n        change x by ((size) * ((item (costume [number v]) of [character widths v]) / (90)))\n        change [# v] by (1)\n    else\n        switch costume to ( v)\n        create clone of (_myself_ v)\n        change x by ((size) * ((item (costume [number v]) of [character widths v]) / (90)))\n        change [# v] by (1)\n    end\n    wait (speed) seconds\nend\n\ndefine Setup Lists\ndelete all of [character widths v]\nadd [thing] to [character widths v]\nadd [29] to [character widths v]\nadd [24] to [character widths v]\nadd [28] to [character widths v]\nadd [27] to [character widths v]\nadd [24] to [character widths v]\nadd [24] to [character widths v]\nadd [28] to [character widths v]\nadd [28] to [character widths v]\nadd [7] to [character widths v]\nadd [21] to [character widths v]\nadd [22] to [character widths v]\nadd [22] to [character widths v]\nadd [34] to [character widths v]\nadd [27] to [character widths v]\nadd [34] to [character widths v]\nadd [22] to [character widths v]\nadd [34] to [character widths v]\nadd [21] to [character widths v]\nadd [23] to [character widths v]\nadd [27] to [character widths v]\nadd [27] to [character widths v]\nadd [29] to [character widths v]\nadd [38] to [character widths v]\nadd [26] to [character widths v]\nadd [27] to [character widths v]\nadd [27] to [character widths v]\nadd [11] to [character widths v]\nadd [20] to [character widths v]\nadd [21] to [character widths v]\nadd [25] to [character widths v]\nadd [21] to [character widths v]\nadd [20] to [character widths v]\nadd [21] to [character widths v]\nadd [20] to [character widths v]\nadd [20] to [character widths v]\nadd [20] to [character widths v]\nadd [14] to [character widths v]\nadd [25] to [character widths v]\nadd [15] to [character widths v]\nadd [10] to [character widths v]\nadd [24] to [character widths v]\nadd [24] to [character widths v]\nadd [20] to [character widths v]\nadd [24] to [character widths v]\nadd [22] to [character widths v]\nadd [16] to [character widths v]\nadd [24] to [character widths v]\nadd [22] to [character widths v]\nadd [10] to [character widths v]\nadd [14] to [character widths v]\nadd [18] to [character widths v]\nadd [9] to [character widths v]\nadd [33] to [character widths v]\nadd [22] to [character widths v]\nadd [24] to [character widths v]\nadd [24] to [character widths v]\nadd [24] to [character widths v]\nadd [15] to [character widths v]\nadd [19] to [character widths v]\nadd [16] to [character widths v]\nadd [22] to [character widths v]\nadd [22] to [character widths v]\nadd [30] to [character widths v]\nadd [20] to [character widths v]\nadd [23] to [character widths v]\nadd [20] to [character widths v]\n\ndefine Change Size By: (size)\nchange size by (size)\nchange x by ((size) / (7))\n\ndefine Find Size (text) (size)\nset [size v] to (size)\nset [width v] to [1]\nset [# v] to [1]\nrepeat (length of (text))\n    if <(letter (#) of (text)) > [ ]> then\n        switch costume to (letter (#) of (text))\n        change [width v] by ((Size) * ((item (costume [number v]) of [character widths v]) / (90)))\n        change [# v] by (1)\n    else\n        switch costume to ( v)\n        change [width v] by ((Size) * ((item (costume [number v]) of [character widths v]) / (90)))\n        change [# v] by (1)\n    end\nend\nif <(Width) > [400]> then\n    change [size v] by (-1)\nend\nif <(Width) < [390]> then\n    change [size v] by (1)\nend\nrepeat until <<<(Width) < [400]> and <(Width) > [389]>> or <(Size) > (SizeLimit)>>\n    reset timer\n    set [width v] to [0]\n    set [# v] to [1]\n    repeat (length of (text))\n        if <(letter (#) of (text)) > [ ]> then\n            switch costume to (letter (#) of (text))\n            change [width v] by ((Size) * ((item (costume [number v]) of [character widths v]) / (90)))\n            change [# v] by (1)\n        else\n            switch costume to ( v)\n            change [width v] by ((Size) * ((item (costume [number v]) of [character widths v]) / (90)))\n            change [# v] by (1)\n        end\n    end\n    if <(Width) > [400]> then\n        change [size v] by (-1)\n    end\n    if <(Width) < [390]> then\n        change [size v] by (1)\n    end\n    if <(Size) > ((SizeLimit) + (1))> then\n        set [size v] to ((SizeLimit) - (10))\n    end\nend\nset [x v] to ((0) - ((Width) / (2)))\n\ndefine Type (text) (x) (y) (size) (color) (brightness) (speed)\nFind Size (text) (size)\nType: System (text) (X) (y) (Size) (color) (brightness) (speed)\n\nwhen I receive [\[intro\] start intro v]\nset [username v] to [coolcoder]\nset [clone id v] to [Back]\ncreate clone of (_myself_ v)\nSetup Lists\nset [sizelimit v] to [400]\nset [clone id v] to [Letter]\nType (Username) [0] [0] [0] [0] [100] [0]\nset [sizelimit v] to [150]\nset [clone id v] to [Letter 1]\nType (Username) [0] [-100] [0] [0] [100] [0]\nreset timer\nstart sound [JJD - Velocity v]\nhide\npoint in direction (90)\nclear graphic effects\nset [clone id v] to [Arrow]\nrepeat (5)\n    set [brightness v] effect to (10)\n    create clone of (_myself_ v)\n    wait (0.1) seconds\n    set [brightness v] effect to (0)\n    create clone of (_myself_ v)\n    wait (0.1) seconds\nend\nset [clone id v] to [Logo]\ncreate clone of (_myself_ v)\nset [clone id v] to [Hider 1]\ncreate clone of (_myself_ v)\nset [clone id v] to [Hider 2]\ncreate clone of (_myself_ v)\nset [clone id v] to [Ghost]\ncreate clone of (_myself_ v)\nwait until <(timer) > [9]>\nset [var 1 v] to [-6]\nhide\nset size to (90) %\nswitch costume to (box v)\ngo to x: (-220) y: (160)\nset [clone id v] to [Box]\nrepeat (13)\n    set [var 2 v] to [4]\n    Clone Row of Boxes\n    change [var 1 v] by (1)\nend\nwait until <(timer) > [10.7]>\nbroadcast (Play v)\n\n@Danger\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\nshow\ngo to x: (36) y: (28)\nset rotation style [don't rotate v]\nforever\n    switch costume to (Level)\nend\n\nchange [level v] by (-1)\n\n@Flag\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\nshow\ngo to x: (36) y: (28)\nforever\n    switch costume to (Level)\n    if <(Level) = [11]> then\n        hide\n    else\n        show\n    end\nend\n\n@Love, Fav, and Follow\n\nwhen I receive [play v]\nhide\ngo to x: (-130) y: (-212)\nforever\n    wait (pick random (8) to (14)) seconds\n    go to x: (130) y: (-200)\n    show\n    repeat (10)\n        change y by (5)\n    end\n    wait (1) seconds\n    turn left (5) degrees\n    repeat (2)\n        repeat (2)\n            turn right (5) degrees\n        end\n        repeat (2)\n            turn right (-5) degrees\n        end\n    end\n    turn left (-5) degrees\n    wait (1) seconds\n    repeat (10)\n        change y by (-5)\n    end\n    hide\nend\n\nwhen flag clicked\nhide\n\n@Sound\n\nwhen this sprite clicked\nif <(costume [number v]) = [1]> then\n    switch costume to (sound v)\nelse\n    switch costume to (no sound v)\nend\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nset size to (100) %\nforever\n    if <touching (mouse-pointer v)?> then\n        set [ghost v] effect to (10)\n        set size to (105) %\n    else\n        set [ghost v] effect to (0)\n        set size to (100) %\n    end\nend\n\nwhen I receive [play v]\nshow\ngo to x: (-115) y: (-150)\nforever\n    go to [front v] layer\nend\n\n@Skip\n\nwhen flag clicked\nhide\n\nwhen this sprite clicked\nchange [level v] by (1)\nbroadcast (Reset v)\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        set [ghost v] effect to (10)\n        set size to (105) %\n    else\n        set [ghost v] effect to (0)\n        set size to (100) %\n    end\nend\n\nwhen I receive [play v]\nset size to (100) %\nshow\ngo to x: (-189) y: (-150)\nforever\n    go to [front v] layer\n    if <(Level) = [11]> then\n        hide\n    else\n        show\n    end\nend\n\n@Flash\n\nwhen flag clicked\nhide\ngo to [front v] layer\n\nwhen I receive [next v]\nset [ghost v] effect to (100)\nshow\nrepeat (4)\n    change [ghost v] effect by (-25)\nend\nwait (.01) seconds\nrepeat (4)\n    change [ghost v] effect by (25)\nend\nhide\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\n\n