Vertigo: A Platformer

Instructions: 40k views and 1k loves! I’ve never had a project this successful before!\n\nAstro 2\n--> https://scratch.mit.edu/projects/593641102/ <--\n\nFactory\n--> https://scratch.mit.edu/projects/592619653/ <--\n\n#5 trending for all\n#1 trending for games\nTop Loved\n\nThe thumbnail is glitched, so it's just showing as a Scratch Cat.\n\nIf you like the game, give it a ♡ and ☆. Thanks for playing!\n\nYou are an astronaut traveling through the solar system. You need to avoid obstacles and dangers on each planet.\n\nPress the arrow keys to move. \n\nThis was really fun to make, and probably my best platformer to date!

@Stage\n\nwhen flag clicked\nset [level v] to [1]\nswitch backdrop to (backdrop1 v)\nforever\n    set [brightness v] effect to (0)\n    if <(level) = [8]> then\n        switch backdrop to (backdrop2 v)\n    end\n    if <(level) > [7]> then\n        set [brightness v] effect to (-20)\n    end\n    if <(level) > [11]> then\n        switch backdrop to (backdrop1 v)\n        set [brightness v] effect to (0)\n    end\nend\n\n@reference\n\nwhen flag clicked\nhide\n\n@Ground\n\nwhen flag clicked\nshow\nset [level v] to [1]\nforever\n    switch costume to (level)\n    set [ghost v] effect to (100)\nend\n\n@lego guy\n\nwhen flag clicked\nset [stopping v] to [1]\nforever\n    go to (my friend v)\n    go to [front v] layer\nend\n\nnext costume\nwait (0.04) seconds\n\nwhen I receive [walk! v]\n\nset [stopping v] to [1]\nstop [this script v]\n\nwhen flag clicked\nshow\nset [level v] to [1]\nset rotation style [left-right v]\nforever\n    if <(level) = [16]> then\n        hide\n    end\n    if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n        repeat until <touching (lego ground v)?>\n            switch costume to (jumping v)\n        end\n    end\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        switch costume to (costume1 v)\n        repeat until <<not <<key (a v) pressed?> or <key (left arrow v) pressed?>>> or <<key (w v) pressed?> or <key (up arrow v) pressed?>>>\n            next costume\n            if <(costume [number v]) > [12]> then\n                switch costume to (costume1 v)\n            end\n            wait (0.04) seconds\n        end\n    end\n    switch costume to (standing v)\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        switch costume to (costume1 v)\n        repeat until <<not <<key (right arrow v) pressed?> or <key (d v) pressed?>>> or <<key (w v) pressed?> or <key (up arrow v) pressed?>>>\n            next costume\n            if <(costume [number v]) > [12]> then\n                switch costume to (costume1 v)\n            end\n            wait (0.04) seconds\n        end\n    end\nend\n\nwait (0.04) seconds\n\nwhen I receive [fall apart v]\nhide\n\nwhen I receive [show v]\ngo to (my friend v)\nshow\n\nwhen flag clicked\nforever\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        point in direction (90)\n    end\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        point in direction (-90)\n    end\n    set [x v] to (x position)\n    set [y guy v] to (y position)\nend\n\nwhen I receive [hide now v]\nhide\n\nwhen I receive [show now v]\nshow\n\nwhen I receive [supercalifragilisticexpialodocious v]\nhide\nstop [other scripts in sprite v]\n\n@lego ground\n\nwhen flag clicked\nshow\nset [level v] to [1]\nforever\n    set [brightness v] effect to (0)\n    switch costume to (level)\n    if <(backdrop [number v]) = [2]> then\n        set [brightness v] effect to (-20)\n    end\nend\n\nwhen flag clicked\nforever\n    play sound [chill inspire v] until done\nend\n\n@my friend\n\nwhen flag clicked\n\ndefine starting position\nset [fallspeed v] to [0]\ngo to x: (-220) y: (-70)\nwait (0.5) seconds\nshow\n\nwhen I receive [boing v]\nset [fallspeed v] to [18]\n\nif <(pause) = [1]> then\n    wait (0.1) seconds\nend\n\nset y to (-75)\n\ndefine restart/back/next\nif <key (b v) pressed?> then\n    if <not <(level) = [1]>> then\n        change [level v] by (-1)\n        starting position\n        wait (0.2) seconds\n    end\nend\nif <key (r v) pressed?> then\n    starting position\n    wait (0.2) seconds\n    up\nend\nif <key (n v) pressed?> then\n    if <not <(level) = [26]>> then\n        broadcast (bext v)\n        wait (0.2) seconds\n        change [level v] by (1)\n    end\nend\n\nwhen I receive [coolieu v]\nstarting position\n\nbroadcast (coolieu v)\n\nwhen I receive [end of end v]\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset size to (100) %\nhide\nshow\nset [ghost v] effect to (100)\nset [good v] to [1]\nset [takeoffspeed v] to [12]\nset [runspeed v] to [0]\nset [fallspeed v] to [0]\ngo to x: (0) y: (0)\nforever\n    if <(good) = [1]> then\n        change [fallspeed v] by (-1)\n        if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n            set [runspeed v] to [-5]\n        end\n        if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n            set [runspeed v] to [5]\n        end\n        if <not <<<key (a v) pressed?> or <key (left arrow v) pressed?>> or <<key (d v) pressed?> or <key (right arrow v) pressed?>>>> then\n            set [runspeed v] to [0]\n        end\n        if <touching (water v)?> then\n            change x by ((runspeed) / (3))\n        else\n            change x by (runspeed)\n        end\n        if <touching (ground v)?> then\n            change y by (1)\n        end\n        if <touching (ground v)?> then\n            change y by (1)\n        end\n        if <touching (ground v)?> then\n            change y by (1)\n        end\n        if <touching (ground v)?> then\n            change y by (1)\n        end\n        if <touching (ground v)?> then\n            change y by (-4)\n            change x by ((runspeed) * (-1))\n            if <<<key (w v) pressed?> or <key (w v) pressed?>> or <<key (up arrow v) pressed?> or <key (up arrow v) pressed?>>> then\n                set [fallspeed v] to [12]\n                if <([abs v] of (runspeed) ) = (runspeed)> then\n                    set [runspeed v] to [-4]\n                else\n                    set [runspeed v] to [4]\n                end\n            else\n                set [runspeed v] to [0]\n            end\n        end\n        if <touching (water v)?> then\n            change y by ((fallspeed) / (3))\n        else\n            change y by (fallspeed)\n        end\n        set [y v] to (y position)\n        if <touching (ground v)?> then\n            change y by ((fallspeed) - ((fallspeed) * (2)))\n            set [fallspeed v] to [0]\n        end\n        change y by (-1)\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <touching (ground v)?>> then\n            set [fallspeed v] to [15]\n        end\n        change y by (1)\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <touching (water v)?>> then\n            set [fallspeed v] to [5]\n        end\n        if <(x position) > [220]> then\n            hide\n            broadcast (hide now v)\n            set [good v] to [0]\n            broadcast (bext v)\n            wait (0.5) seconds\n            go to x: (0) y: (0)\n            change [level v] by (1)\n        end\n        if <(y position) < [-180]> then\n            starting position\n        end\n        if <touching (spikes v)?> then\n            broadcast (fall apart v)\n            dead start\n        end\n        restart/back/next\n        if <touching (trampoline v)?> then\n            set [fallspeed v] to [18]\n        end\n        if <touching (chainsaw v)?> then\n            broadcast (fall apart v)\n            dead start\n        end\n        if <touching (badguy v)?> then\n            broadcast (fall apart v)\n            dead start\n        end\n        if <touching (stompers v)?> then\n            broadcast (fall apart v)\n            dead start\n        end\n        if <touching (lavaly lava v)?> then\n            broadcast (fall apart v)\n            dead start\n        end\n        if <(level) = [16]> then\n            broadcast (hide now v)\n            broadcast (supercalifragilisticexpialodocious v)\n            stop [this script v]\n        end\n    end\nend\n\nwait (17) seconds\n\nset [runspeed v] to [0]\n\nwhen I receive [end intro v]\n\nstarting position\n\ndefine dead start\nhide\nwait (1) seconds\nset [fallspeed v] to [0]\ngo to x: (-220) y: (-70)\nshow\nbroadcast (show v)\nup\n\ndefine up\nrepeat until <not <touching (ground v)?>>\n    change y by (1)\nend\nset [good v] to [1]\nbroadcast (show now v)\n\nwhen I receive [up! v]\n\nwhen I receive [up! v]\nstarting position\nwait (0.1) seconds\nup\n\n@clouds\n\nwhen flag clicked\nhide\nforever\n    if <(backdrop [number v]) = [2]> then\n        wait (0.1) seconds\n    else\n        wait (pick random (1) to (3)) seconds\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I start as a clone\nshow\nswitch costume to (pick random (1) to (2))\ngo to x: (216) y: (pick random (100) to (150))\nset [ghost v] effect to (pick random (25) to (75))\nset [cloud x v] to (pick random (-3) to (-5))\nrepeat until <(x position) < [-380]>\n    go to [back v] layer\n    change x by (cloud x)\n    if <(backdrop [number v]) = [2]> then\n        delete this clone\n    end\nend\ndelete this clone\n\nif  then\nend\n\n@spikes\n\nwhen flag clicked\nshow\nset [level v] to [1]\nforever\n    switch costume to (level)\nend\n\n@dead starts\n\nwhen flag clicked\nhide\n\nwhen I receive [fall apart v]\nrepeat (6)\n    create clone of (_myself_ v)\n    next costume\nend\n\nwhen I start as a clone\npoint in direction (pick random (0) to (180))\ngo to (my friend v)\nshow\nset [x vel v] to (pick random (-2) to (2))\nset [y vel v] to (pick random (2) to (5))\nrepeat until <touching (_edge_ v)?>\n    change x by (x vel)\n    turn right (x vel) degrees\n    change y by (y vel)\n    change [y vel v] by (-1)\nend\ndelete this clone\n\n@trampoline\n\nwhen flag clicked\nforever\n    if <(level) = [1]> then\n        hide\n    end\n    if <(level) = [2]> then\n        show\n        go to x: (-105) y: (-112)\n    end\n    if <(level) = [3]> then\n        hide\n    end\n    if <(level) = [4]> then\n        hide\n    end\n    if <(level) = [5]> then\n        hide\n    end\n    if <(level) = [6]> then\n        show\n        go to x: (17) y: (-140)\n    end\n    if <(level) = [7]> then\n        hide\n    end\n    if <(level) = [8]> then\n        hide\n    end\n    if <(level) = [9]> then\n        show\n        go to x: (80) y: (-103)\n    end\n    if <(level) = [10]> then\n        show\n        go to x: (160) y: (-96)\n    end\n    if <(level) = [11]> then\n        hide\n    end\n    if <(level) = [12]> then\n        hide\n    end\n    if <(level) = [13]> then\n        show\n        go to x: (-81) y: (-112)\n    end\n    if <(level) = [14]> then\n        hide\n    end\n    if <(level) = [15]> then\n        hide\n    end\n    if <(level) = [16]> then\n        hide\n    end\nend\n\n@chainsaw\n\nwhen flag clicked\n\nwhen flag clicked\nforever\n    turn right (5) degrees\nend\n\nwhen flag clicked\nforever\n    go to [back v] layer\n    if <(level) = [1]> then\n        hide\n    end\n    if <(level) = [2]> then\n        show\n        go to x: (80) y: (42)\n    end\n    if <(level) = [3]> then\n        hide\n    end\n    if <(level) = [4]> then\n        hide\n    end\n    if <(level) = [5]> then\n        hide\n    end\n    if <(level) = [6]> then\n        show\n        go to x: (-195) y: (52)\n    end\n    if <(level) = [7]> then\n        show\n        go to x: (-12) y: (-113)\n    end\n    if <(level) = [8]> then\n        show\n        go to x: (-12) y: (-113)\n    end\n    if <(level) = [9]> then\n        hide\n    end\n    if <(level) = [10]> then\n        hide\n    end\n    if <(level) = [11]> then\n        hide\n    end\n    if <(level) = [12]> then\n        show\n        go to x: (130) y: (-14)\n    end\n    if <(level) = [13]> then\n        show\n        go to x: (13) y: (-114)\n    end\n    if <(level) = [14]> then\n        hide\n    end\n    if <(level) = [15]> then\n        show\n        go to x: (204) y: (-114)\n    end\n    if <(level) = [16]> then\n        hide\n    end\nend\n\n@badguy\n\ndefine patrol\nset rotation style [left-right v]\nswitch costume to (standing v)\nbroadcast (move v)\nrepeat (12)\n    point in direction (90)\n    next costume\n    wait (0.04) seconds\n    if <<(level) > (this level)> or <(this level) < (level)>> then\n        hide\n        stop [this script v]\n    end\nend\nswitch costume to (standing v)\nwait (1) seconds\nrepeat (12)\n    point in direction (-90)\n    next costume\n    wait (0.04) seconds\n    if <<(level) > (this level)> or <(this level) < (level)>> then\n        hide\n        stop [this script v]\n    end\nend\nswitch costume to (standing v)\nwait (1) seconds\n\nwhen I receive [move v]\nrepeat (30)\n    change x by (2)\nend\nwait (1.3) seconds\nrepeat (30)\n    change x by (-2)\nend\n\nrepeat (50)\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    if <(level) = [1]> then\n        hide\n    end\n    if <(level) = [2]> then\n        hide\n    end\n    if <(level) = [3]> then\n        set [this level v] to (level)\n        wait until <(level) > (this level)>\n    end\n    if <(level) = [4]> then\n        hide\n    end\n    if <(level) = [5]> then\n        hide\n    end\n    if <(level) = [6]> then\n        hide\n    end\n    if <(level) = [7]> then\n        hide\n    end\n    if <(level) = [8]> then\n        set [this level v] to (level)\n        wait until <(level) > (this level)>\n    end\n    if <(level) = [9]> then\n        hide\n    end\n    if <(level) = [10]> then\n        hide\n    end\n    if <(level) = [11]> then\n        hide\n    end\n    if <(level) = [12]> then\n        hide\n    end\n    if <(level) = [13]> then\n        hide\n    end\n    if <(level) = [14]> then\n        hide\n    end\n    if <(level) = [15]> then\n        hide\n    end\n    if <(level) = [16]> then\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    if <(level) = [1]> then\n        hide\n    end\n    if <(level) = [2]> then\n        hide\n    end\n    if <(level) = [3]> then\n        go to x: (0) y: (-65)\n        show\n        patrol\n    end\n    if <(level) = [4]> then\n        hide\n    end\n    if <(level) = [5]> then\n        hide\n    end\n    if <(level) = [6]> then\n        hide\n    end\n    if <(level) = [7]> then\n        hide\n    end\n    if <(level) = [8]> then\n        go to x: (100) y: (-57)\n        show\n        patrol\n    end\n    if <(level) = [9]> then\n        hide\n    end\n    if <(level) = [10]> then\n        hide\n    end\n    if <(level) = [11]> then\n    if <(level) = [12]> then\n    if <(level) = [13]> then\n    if <(level) = [14]> then\n    if <(level) = [15]> then\n    if <(level) = [16]> then\nend\n\n@stompers\n\ndefine smash\nset [y position v] to (y position)\nset [down smash v] to [-1]\nrepeat until <<touching (ground v)?> or <<(smasher level) < (level)> or <(smasher level) > (level)>>>\n    go to [front v] layer\n    change y by (down smash)\n    change [down smash v] by (-1)\nend\nif <<(smasher level) < (level)> or <(smasher level) > (level)>> then\n    hide\nend\nup\nrepeat until <(y position) > (y position)>\n    change y by (5)\n    if <<(smasher level) < (level)> or <(smasher level) > (level)>> then\n        hide\n    end\nend\n\ndefine up\nrepeat until <not <touching (ground v)?>>\n    change y by (1)\nend\n\nwhen flag clicked\nforever\n    if <(level) = [1]> then\n        hide\n    end\n    if <(level) = [2]> then\n        hide\n    end\n    if <(level) = [3]> then\n        hide\n    end\n    if <(level) = [4]> then\n        go to x: (36) y: (290)\n        show\n        smash\n        set [smasher level v] to (level)\n    end\n    if <(level) = [5]> then\n        go to x: (140) y: (290)\n        show\n        smash\n        set [smasher level v] to (level)\n        hide\n        wait (1) seconds\n        show\n    end\n    if <(level) = [6]> then\n        hide\n    end\n    if <(level) = [7]> then\n        hide\n    end\n    if <(level) = [8]> then\n        hide\n    end\n    if <(level) = [9]> then\n        hide\n    end\n    if <(level) = [10]> then\n        go to x: (-69) y: (290)\n        show\n        smash\n        set [smasher level v] to (level)\n    end\n    if <(level) = [11]> then\n        go to x: (10) y: (290)\n        show\n        smash\n        set [smasher level v] to (level)\n        hide\n        wait (1) seconds\n        show\n    end\n    if <(level) = [12]> then\n        hide\n    end\n    if <(level) = [13]> then\n        hide\n    end\n    if <(level) = [14]> then\n        hide\n    end\n    if <(level) = [15]> then\n        hide\n    end\n    if <(level) = [16]> then\n        hide\n    end\nend\n\n@transition\n\nwhen I receive [bext v]\nshow\ngo to x: (465) y: (0)\nrepeat (46)\n    go to [front v] layer\n    change x by (-20.005)\nend\nhide\nbroadcast (up! v)\n\nwhen flag clicked\nhide\n\n@background parrelax\n\nwhen flag clicked\nhide\n\nset size to (100) %\nrepeat (6)\n    create clone of (_myself_ v)\n    next costume\nend\n\nwhen I start as a clone\nif <(costume [number v]) = [1]> then\n    show\n    go to [back v] layer\n    go [forward v] (2) layers\n    forever\n        go to x: ((x) / (20)) y: ((y guy) / (20))\n    end\nend\nif <(costume [number v]) = [2]> then\n    show\n    go to [back v] layer\n    go [forward v] (1) layers\n    forever\n        go to x: ((x) / (15)) y: ((y guy) / (15))\n    end\nend\nif <(costume [number v]) = [3]> then\n    show\n    go to [back v] layer\n    forever\n        go to x: ((x) / (10)) y: ((y guy) / (10))\n    end\nend\nif <(costume [number v]) = [4]> then\n    show\n    go to [back v] layer\n    go [forward v] (2) layers\n    set [ghost v] effect to (90)\n    forever\n        go to x: ((x) / (20)) y: ((y guy) / (20))\n    end\nend\nif <(costume [number v]) = [5]> then\n    show\n    go to [back v] layer\n    go [forward v] (1) layers\n    set [ghost v] effect to (80)\n    forever\n        go to x: ((x) / (15)) y: ((y guy) / (15))\n    end\nend\nif <(costume [number v]) = [6]> then\n    show\n    go to [back v] layer\n    set [ghost v] effect to (75)\n    forever\n        go to x: ((x) / (10)) y: ((y guy) / (10))\n    end\nend\n\n@thumbnail\n\n@decor\n\nwhen flag clicked\nforever\n    switch costume to (level)\n    go to [back v] layer\nend\n\n@lavaly lava\n\nwhen flag clicked\nshow\nforever\n    switch costume to (level)\n    go to [back v] layer\nend\n\n@decor2\n\nwhen flag clicked\nforever\n    switch costume to (level)\n    go to [front v] layer\nend\n\n@thumbnail2\n\nwhen flag clicked\nforever\n    show\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n