ADVENTURE 2 \Up the Mountain/ <a platformer>

Instructions: #2 on all trending!\nPart 1: https://scratch.mit.edu/projects/590261836/\nPart 3:https://scratch.mit.edu/projects/625834167/\nPart 4: https://scratch.mit.edu/projects/627607932/\nPart 5: https://scratch.mit.edu/projects/630352670/\nWASD or arrow keys to move.\nIt is mobile friendly.\nI've added 3 types of enemies\n100 loves for part 3.\nFollow me --@Tao196\n

@Stage\n\nwhen flag clicked\nswitch backdrop to (slopes v)\nforever\n    play sound [song v] until done\nend\n\nwhen I receive [next level v]\nif <(Level) = [7]> then\n    switch backdrop to (cave v)\nend\n\n@Guy\n\nwhen I start as a clone\nswitch costume to (trail1 v)\nclear graphic effects\nrepeat (8)\n    change size by (-4)\n    change [ghost v] effect by (10)\n    change [brightness v] effect by (10)\nend\ndelete this clone\n\nwhen flag clicked\nSetup\nbroadcast (Game Loop v)\n\ngo to x: (-190) y: (-24)\ngo to x: (-201) y: (14)\n\nwhen flag clicked\n\ndefine Fix Collisions in direction (dir)\nset [temporary dir v] to (direction)\nset [distance v] to [1]\npoint in direction (dir)\nrepeat (168)\n    Check Touching Solid\n    if <(touching) < [1]> then\n        point in direction (temporary dir)\n        stop [this script v]\n    end\n    move (distance) steps\n    turn right (180) degrees\n    change [distance v] by (1)\nend\n\ndefine Check Touching Solid\nif <<touching (ground v)?> or <touching (sprite2 v)?>> then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\nhide variable [speed x v]\n\nwhen flag clicked\nforever\n    Check Touching Solid\n    if <(touching) > [0]> then\n        Fix Collisions in direction [0]\n        Fix Collisions in direction [90]\n    end\nend\n\ndefine Setup\ngo to x: (-200) y: (50)\npoint in direction (90)\nshow\ngo to [front v] layer\nclear graphic effects\nset size to (45) %\nswitch costume to (middle v)\nset drag mode [not draggable v]\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [level v] to [1]\n\ndefine Left / Right Movement\nif <<<mouse down?> and <(x position) > (mouse x)>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> then\n    change [speed x v] by (-1)\nend\nif <<<mouse down?> and <(x position) < (mouse x)>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>> then\n    change [speed x v] by (1)\nend\nset [speed x v] to ((speed x) * (0.9))\nchange x by (speed x)\n\nwhen I receive [game loop v]\nset [dead? v] to [0]\nforever\n    create clone of (_myself_ v)\n    Set Costume\n    Left / Right Movement\n    Horizontal Collision and Wall Jump\n    Up / Down Movement\n    Check Death / Win\nend\n\ndefine Horizontal Collision and Wall Jump\nCheck Touching Solid\nif <(touching) = [1]> then\n    change y by (1)\n    Check Touching Solid\n    if <(touching) = [1]> then\n        change y by (1)\n        Check Touching Solid\n        if <(touching) = [1]> then\n            change y by (1)\n            Check Touching Solid\n            if <(touching) = [1]> then\n                change y by (1)\n                Check Touching Solid\n                if <(touching) = [1]> then\n                    change y by (1)\n                    Check Touching Solid\n                    if <(touching) = [1]> then\n                        change x by ((speed x) * (-1))\n                        change y by (-5)\n                        if <<<mouse down?> and <(y position) < (mouse y)>> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n                            if <(speed x) > [0]> then\n                                set [speed x v] to [-7]\n                            else\n                                set [speed x v] to [7]\n                            end\n                            set [speed y v] to [14]\n                        else\n                            set [speed x v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange y by (-3)\n\ndefine Up / Down Movement\nCheck Touching Solid\nif <(touching) = [1]> then\n    if <<<mouse down?> and <(y position) < (mouse y)>> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        set [speed y v] to [14]\n    end\nend\nchange y by (3)\nchange [speed y v] by (-1)\nchange y by (speed y)\nCheck Touching Solid\nif <(touching) = [1]> then\n    change y by ((speed y) * (-1))\n    set [speed y v] to [0]\nend\n\ndefine Check Death / Win\nif <(x position) > [230]> then\n    change [level v] by (1)\n    broadcast (next level v)\nend\nif <(y position) < [-170]> then\n    broadcast (Death v)\nend\nif <touching (spike v)?> then\n    broadcast (Death v)\nend\nif <touching (lava v)?> then\n    broadcast (Death v)\nend\nif <touching (saw v)?> then\n    broadcast (Death v)\nend\n\nwhen I receive [next level v]\nset [speed y v] to [0]\nset [speed x v] to [0]\ngo to x: (-245) y: (y position)\n\nwhen I receive [death v]\nstop [other scripts in sprite v]\nset [dead? v] to [1]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\nclear graphic effects\ngo to x: (-235) y: (-50)\nset [speed y v] to [0]\nset [speed x v] to [0]\nshow\nbroadcast (Game Loop v)\ndelete this clone\n\ndefine Set Costume\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<((mouse y) + (-20)) > (y position)> and <mouse down?>>> and <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<((mouse x) + (15)) > (x position)> and <mouse down?>>>> then\n    switch costume to (right v)\nelse\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<((mouse y) + (-20)) > (y position)> and <mouse down?>>> and <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<((mouse x) - (15)) < (x position)> and <mouse down?>>>> then\n        switch costume to (left v)\n    else\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<((mouse y) + (-20)) > (y position)> and <mouse down?>>> then\n            switch costume to (up v)\n        else\n            if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<((mouse x) - (-20)) > (x position)> and <mouse down?>>> then\n                switch costume to (right v)\n            else\n                if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<((mouse x) + (-20)) < (x position)> and <mouse down?>>> then\n                    switch costume to (left v)\n                else\n                    switch costume to (middle v)\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [death v]\n\nwhen I receive [game loop v]\ndelete this clone\n\nwhen I receive [game loop v]\n\nFix Collisions in direction [0]\nFix Collisions in direction [90]\n\nwhen I receive [next level v]\nwait (0.01) seconds\nFix Collisions in direction [0]\n\nwhen I receive [90 v]\nset [speed y v] to [20]\nchange y by (speed y)\n\nwhen I receive [-90 v]\nset [speed y v] to [-20]\nchange y by (speed y)\n\nstop [this script v]\n\nwhen I receive [180 v]\nset [speed x v] to [25]\n\nwhen I receive [next level v]\nFix Collisions in direction [0]\n\nwhen I receive [game loop v]\nFix Collisions in direction [0]\nforever\n    Check Touching Solid\n    if <(touching) > [0]> then\n        Fix Collisions in direction [0]\n        Fix Collisions in direction [90]\n    end\nend\n\nwhen I receive [bounce v]\nset [speed y v] to [10]\n\n@ground\n\nwhen flag clicked\ngo to x: (0) y: (0)\npoint in direction (90)\nswitch costume to (join [Level] (Level))\n\nwhen I receive [next level v]\nswitch costume to (join [Level] (Level))\n\nforever\n\nswitch costume to (level1 v)\n\nnext costume\n\n@Lava\n\nwhen I receive [next level v]\ngo to [back v] layer\ngo to x: (0) y: (0)\n\nif <(Level) = [4]> then\n    show\n    switch costume to (lava0 v)\n    forever\n        change [frame v] by (0.4)\n        set y to ((5) * ([sin v] of ((timer) * (150)) ))\n        switch costume to (join [lava] (([floor v] of (frame) ) mod (4)))\n    end\nend\nif <(Level) = [5]> then\n    show\n    switch costume to (lava2.0 v)\n    forever\n        change [frame v] by (0.4)\n        set y to ((5) * ([sin v] of ((timer) * (150)) ))\n        switch costume to (join [lava2.] (([floor v] of (frame) ) mod (4)))\n    end\nend\nif <(Level) = [7]> then\n    show\n    switch costume to (costume3 v)\n    forever\n        change [frame v] by (0.4)\n        set y to ((5) * ([sin v] of ((timer) * (150)) ))\n        switch costume to (join [lava3.] (([floor v] of (frame) ) mod (4)))\n    end\nend\nhide\n\nwhen flag clicked\nhide\n\nnext costume\n\n@Spike\n\nwhen flag clicked\nshow\nswitch costume to (1 v)\n\nwhen I receive [next level v]\ngo to [back v] layer\nif <(Level) = [4]> then\n    show\n    switch costume to (4 v)\n    stop [this script v]\nend\nif <(Level) = [8]> then\n    show\n    switch costume to (8 v)\n    stop [this script v]\nend\nif <(Level) = [9]> then\n    show\n    switch costume to (9 v)\n    stop [this script v]\nend\nif <(Level) = [12]> then\n    show\n    switch costume to (12 v)\n    stop [this script v]\nend\nif <(Level) = [14]> then\n    show\n    switch costume to (14 v)\n    stop [this script v]\nend\nhide\n\nif <(Level) = [3]> then\nif <(Level) = [4]> then\n    hide\nend\n\n@Trampoline\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nwait (0) seconds\ngo to [back v] layer\nClone at [-60] [-60] level [9] dir [90]\n\nwhen I start as a clone\nshow\nforever\n    go to [back v] layer\n    if <touching (guy v)?> then\n        switch costume to (costume1 v)\n        broadcast (direction)\n        wait (0.08) seconds\n        switch costume to (spring2 v)\n        wait (0.05) seconds\n    end\nend\n\nwhen I receive [next level v]\ndelete this clone\n\nchange y by (50)\n\ndefine Clone at (x) (y) level (level) dir (dir)\nif <(Level) = (level)> then\n    go to x: (x) y: (y)\n    point in direction (dir)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [next level v]\nwait (0) seconds\n\ngo to x: (-60) y: (-60)\n\n@Saw\n\nwhen I receive [next level v]\ngo to [back v] layer\nwait (0) seconds\nClone at [131] [-57] size [120] level [2]\nClone at [-76] [-118] size [120] level [2]\nClone at [-8] [68] size [120] level [2]\nClone at [-58] [120] size [140] level [9]\n\ngo to x: (30) y: (50)\nset size to (200) %\ncreate clone of (_myself_ v)\ngo to x: (166) y: (-112)\nset size to (100) %\ncreate clone of (_myself_ v)\ngo to x: (-120) y: (-106)\n\nif <(Level) = [10]> then\n    go to x: (-120) y: (-106)\n    set size to (150) %\n    create clone of (_myself_ v)\nend\nif <(Level) = [14]> then\n    set size to (80) %\n    go to x: (-23) y: (123)\n    create clone of (_myself_ v)\nend\nif <(Level) = [16]> then\n    set size to (120) %\n    go to x: (-71) y: (-118)\n    create clone of (_myself_ v)\n    go to x: (131) y: (-57)\n    create clone of (_myself_ v)\nend\nhide\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\nforever\n    turn left (15) degrees\nend\n\nrepeat until <(Level) = [9]>\n\ndelete this clone\n\ngo to x: (26) y: (-33)\n\nwhen I receive [next level v]\ndelete this clone\n\ngo to x: (-23) y: (123)\n\ngo to x: (131) y: (-57)\nset size to (120) %\n\ndefine Clone at (x) (y) size (size) level (level)\nif <(Level) = (level)> then\n    go to x: (x) y: (y)\n    set size to (size) %\n    create clone of (_myself_ v)\nend\n\nset size to (140) %\n\nchange x by (-20)\n\nchange y by (-10)\n\n@Cloud\n\nwhen flag clicked\nhide\nset rotation style [left-right v]\nswitch costume to (big v)\nset x to (280)\nCreate Cloud\n\nwhen I start as a clone\nshow\nswitch costume to (pick random (1) to (5))\nset [costume v] to (costume [number v])\nset [ghost v] effect to (pick random (30) to (70))\nset y to (pick random (80) to (180))\nset [sx v] to (pick random (3.) to (5.))\nrepeat ((600) / (sx))\n    go to [back v] layer\n    switch costume to (big v)\n    change x by ((-1) * (sx))\n    switch costume to (costume)\nend\ndelete this clone\n\nwhen I receive [next level v]\nif <(Level) = [7]> then\n    stop [other scripts in sprite v]\n    delete this clone\nend\n\n\n\nset [ghost v] effect to (20)\nshow\n\ndefine Create Cloud\nforever\n    switch costume to (big v)\n    create clone of (_myself_ v)\n    wait (pick random (1.) to (2.)) seconds\nend\n\nwhen I receive [next level v]\nif <(Level) > [10]> then\n    Create Cloud\nend\n\nforever\nend\n\n@Word\n\nwhen flag clicked\ngo to x: (0) y: (0)\npoint in direction (90)\nswitch costume to (join [Level] (Level))\n\nwhen I receive [next level v]\nswitch costume to (join [Level] (Level))\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\ngo to x: (0) y: (0)\npoint in direction (90)\ngo to [front v] layer\nshow\n\n@Enemy\n\ndefine Spawn (type) at (x) (y) level (level) dir (dir) size (size)\nif <(type) = []> then\n    if <(level) = (Level)> then\n        switch costume to (type)\n        go to x: (x) y: (y)\n        point in direction (dir)\n        set size to (size) %\n        set [type v] to (type)\n        create clone of (_myself_ v)\n        set [type v] to []\n    end\nend\n\nwhen I start as a clone\nshow\nset [frame v] to [0]\nif <(type) = [Slime]> then\n    Spawn Slime\nend\nif <(type) = [Tall]> then\n    Spawn Tall\nend\nif <(type) = [Spiky]> then\n    Spawn Spiky\nend\n\nwhen I receive [next level v]\nwait (0) seconds\nSpawn All Enemies\n\nwhen flag clicked\nset [frame v] to [0]\nset [type v] to []\nset rotation style [left-right v]\nhide\n\ndefine Move - Down\nchange [sy v] by (-1)\nchange y by (sy)\nrepeat until <not <touching (ground v)?>>\n    change y by (1)\n    set [sy v] to [0]\nend\n\ndefine Move - Left or Right\nmove (2) steps\nrepeat (4)\n    if <not <<touching (ground v)?> or <touching (_edge_ v)?>>> then\n        stop [this script v]\n    end\n    change y by (1)\nend\nchange y by (-4)\nmove (-2) steps\nturn right (180) degrees\n\ndefine Touching Player?\nif <touching (guy v)?> then\n    if <(speed y) < [-2]> then\n        switch costume to (join (costume [name v]) [Squish])\n        broadcast (Bounce v)\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        delete this clone\n    else\n        if <(DEAD?) = [0]> then\n            broadcast (Death v)\n        end\n    end\nend\n\ndelete this clone\n\nwhen I receive [game loop v]\nwait (0) seconds\nSpawn All Enemies\n\nwhen I receive [game loop v]\ndelete this clone\n\ndefine Spawn Slime\nforever\n    if <(frame) = [20]> then\n        set [sy v] to [8]\n        set [frame v] to [0]\n    end\n    Move - Down\n    Move - Left or Right\n    Touching Player?\n    change [frame v] by (0.5)\nend\n\ndefine Spawn Tall\nforever\n    Move - Down\n    Move - Left or Right\n    Touching Player?\nend\n\nwhen I receive [next level v]\ndelete this clone\n\ndefine Spawn All Enemies\nSpawn [Slime] at [150] [10] level [3] dir [-90] size [60]\nSpawn [Slime] at [30] [-60] level [3] dir [90] size [60]\nSpawn [Slime] at [180] [20] level [4] dir [-90] size [60]\nSpawn [Slime] at [30] [-40] level [4] dir [-90] size [60]\nSpawn [Slime] at [-50] [-60] level [4] dir [-90] size [60]\nSpawn [Tall] at [140] [0] level [5] dir [90] size [60]\nSpawn [Slime] at [70] [-20] level [5] dir [-90] size [60]\nSpawn [Tall] at [0] [-30] level [5] dir [-90] size [60]\nSpawn [Slime] at [-60] [-60] level [5] dir [90] size [60]\nSpawn [Tall] at [-130] [-80] level [5] dir [90] size [60]\nSpawn [Tall] at [20] [-40] level [11] dir [-90] size [60]\nSpawn [Spiky] at [-60] [-70] level [13] dir [-90] size [60]\nSpawn [Spiky] at [80] [-70] level [13] dir [-90] size [60]\nSpawn [Spiky] at [210] [-70] level [13] dir [-90] size [60]\nSpawn [Spiky] at [170] [0] level [14] dir [-90] size [60]\n\ndefine Spawn Spiky\nforever\n    if <(frame) = [20]> then\n        set [sy v] to [8]\n        set [frame v] to [0]\n    end\n    Move - Down\n    Move - Left or Right\n    if <<touching (guy v)?> and <(DEAD?) = [0]>> then\n        broadcast (Death v)\n    end\n    change [frame v] by (0.5)\nend\n\nTouching Player?\n\nbroadcast (Death v)\n\n@Nothing\n\nwhen I receive [next level v]\nif <(Level) = [6]> then\n    show\n    forever\n        if <touching (guy v)?> then\n            change [ghost v] effect by (5)\n        else\n            set [ghost v] effect to (0)\n        end\n    end\nend\nhide\n\nset [ghost v] effect to (60)\n\nwhen flag clicked\nhide\n\n@Dark\n\nwhen I receive [next level v]\nif <(Level) = [7]> then\n    set [ghost v] effect to (15)\n    show\nend\n\nwhen flag clicked\nhide\nforever\n    go to x: (0) y: (0)\n    go to [front v] layer\nend\n\nwhen I receive [next level v]\nif <(Level) = [11]> then\n    hide\n    switch backdrop to (slopes v)\nend\n\n@Portal\n\nwhen I receive [next level v]\nif <(Level) = [10]> then\n    set [whirl v] effect to (700)\n    go to x: (200) y: (-10)\n    show\n    forever\n        if <touching (guy v)?> then\n            change [level v] by (1)\n            broadcast (next level v)\n            hide\n            stop [this script v]\n        end\n    end\nend\n\nwhen flag clicked\nhide\n\n