Platformer
@Stage\n\nwhen [m v] key pressed\nset [mouse v] to (join ((mouse x) + (SCROLL X)) (join [, ] ((mouse y) + (SCROLL Y))))\nshow variable [mouse v]\n\nwhen I receive [play game v]\nset [music v] to [0]\nswitch backdrop to (1 v)\nrepeat until <(Music) = [1]>\n    play sound [vexento-masked-heroes-1-AHM56EBq6 \(1\) v] until done\nend\nplay sound [Playng2 v] until done\n\n@Blank\n\nwhen [r v] key pressed\nbroadcast (Reset v)\nbroadcast (Setup v)\n\n@Player\n\nwhen flag clicked\nbroadcast (Green Flag v) and wait\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    wait (0) seconds\n    Game On\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v) and wait\n    end\n    if <(EXIT) = [win]> then\n        start sound [Teleport2 v]\n        Game - Win\n        wait (0.1) seconds\n    else\n        Game - Die\n        wait (0.1) seconds\n    end\nend\n\ndefine Game On\nset [sx v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [sy v] to [0]\nset [moving sprite v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\ndefine Tick\nif <<key (left arrow v) pressed?> or <<(mouse x) < (x position)> and <mouse down?>>> then\n    point in direction (-90)\n    change [sx v] by (-2)\nend\nif <<key (right arrow v) pressed?> or <<(mouse x) > (x position)> and <mouse down?>>> then\n    point in direction (90)\n    change [sx v] by (2)\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 <<(mouse y) > (y position)> and <mouse down?>>> then\n    if <(in air) < [4]> then\n        set [sy v] to [17]\n    end\nend\nif <(sy) > [-17]> then\n    change [sy v] by (-2)\nend\nChange Player Y by (sy)\nTest - Die\nset [scroll x v] to (x)\nif <(SCROLL X) < [-100]> then\n    set [scroll x v] to [-100]\n    set [x v] to [-100]\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 <touching (spring v)?> then\n    change [sy v] by (25)\nend\n\nchange [x v] by (8)\n\ndefine Change Player Y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (platforms 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\nset [sy v] to [16]\n\n\n\n\ndefine Change Player x by (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platforms v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    if <<key (up arrow v) pressed?> or <<(mouse y) > (y position)> 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 (platforms 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\nchange [deaths v] by (1)\nset [exit v] to []\nstart sound [Oops v]\nrepeat (3)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\nhide\nwait (0.2) seconds\n\ndefine Test - Die\nif <<touching (danger v)?> or <touching (gears v)?>> then\n    set [exit v] to [die]\nend\n\nstart sound [Squish Pop v]\n\ndefine Game - Win\nrepeat (50)\n    point towards (exit v)\n    turn right (65) degrees\n    move ((distance to [exit v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nchange [level v] by (1)\nhide\nset [deaths v] to [0]\nif <(LEVEL) = [2]> then\n    broadcast (Reset v)\nend\n\n@Platforms\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\ngo to x: (0) y: (0)\nset [x v] to [0]\nset [y v] to [0]\nset [scroll y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at x: [445] y: [0]\n        Clone at x: [445] y: [0]\n        Clone at x: [445] y: [0]\n        Clone at x: [445] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            switch backdrop to (3 v)\n            Clone at x: [480] y: [0]\n            Clone at x: [480] y: [0]\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                switch backdrop to (4 v)\n                Clone at x: [430] y: [0]\n                Clone at x: [430] y: [0]\n                Clone at x: [0] y: [300]\n                Clone at x: [430] y: [-300]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (level 5 1 v)\n                    Clone at x: [430] y: [0]\n                    Clone at x: [0] y: [200]\n                    Clone at x: [0] y: [200]\n                    Clone at x: [430] y: [-400]\n                    Clone at x: [430] y: [0]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch backdrop to (6 v)\n                        switch costume to (level 6 1 v)\n                        Clone at x: [200] y: [260]\n                        Clone at x: [150] y: [260]\n                        Clone at x: [0] y: [260]\n                        Clone at x: [-100] y: [400]\n                        Clone at x: [0] y: [400]\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch backdrop to (7 v)\n                            set [music v] to [1]\n                            switch costume to (level 7 1 v)\n                            Clone at x: [480] y: [0]\n                        end\n                    end\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@Collectables\n\nwhen I receive [green flag v]\nhide variable [mouse v]\nhide\n\nshow\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    start sound [Coin v]\n    change [collected v] by (1)\n    if <(COLLECTED) = (COLLECTED MAX)> then\n        broadcast (Open Portal v)\n    end\n    delete this clone\nend\n\nwhen I receive [setup v]\nhide\nset [collected v] to [0]\nset [collected max v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (dot v)\n    Clone at x: [52] y: [27]\n    Clone at x: [607] y: [70]\n    Clone at x: [803] y: [60]\n    Clone at x: [921] y: [123]\n    Clone at x: [1042] y: [181]\n    Clone at x: [1130] y: [236]\n    Clone at x: [1960] y: [-22]\n    Clone at x: [2004] y: [5]\n    Clone at x: [2055] y: [-22]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (dot v)\n        Clone at x: [87] y: [-40]\n        Clone at x: [226] y: [-40]\n        Clone at x: [550] y: [-35]\n        Clone at x: [620] y: [-57]\n        Clone at x: [740] y: [-4]\n        Clone at x: [758] y: [32]\n        Clone at x: [790] y: [32]\n        Clone at x: [826] y: [32]\n        Clone at x: [866] y: [25]\n        Clone at x: [909] y: [8]\n        Clone at x: [1341] y: [60]\n        Clone at x: [1359] y: [110]\n        Clone at x: [1396] y: [144]\n        Clone at x: [1451] y: [130]\n        Clone at x: [1479] y: [100]\n        Clone at x: [1495] y: [46]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (dot v)\n            Clone at x: [193] y: [-11]\n            Clone at x: [393] y: [-69]\n            Clone at x: [430] y: [-20]\n            Clone at x: [516] y: [-20]\n            Clone at x: [557] y: [-69]\n            Clone at x: [468] y: [0]\n            Clone at x: [850] y: [19]\n            Clone at x: [991] y: [11]\n            Clone at x: [1130] y: [-61]\n            Clone at x: [1246] y: [-29]\n            Clone at x: [1437] y: [-10]\n            Clone at x: [1737] y: [-10]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (dot v)\n                Clone at x: [225] y: [39]\n                Clone at x: [545] y: [-103]\n                Clone at x: [617] y: [-32]\n                Clone at x: [718] y: [-103]\n                Clone at x: [835] y: [46]\n                Clone at x: [710] y: [81]\n                Clone at x: [595] y: [180]\n                Clone at x: [1326] y: [-98]\n                Clone at x: [1120] y: [172]\n                Clone at x: [951] y: [224]\n                Clone at x: [647] y: [302]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (dot v)\n                    Clone at x: [510] y: [327]\n                    Clone at x: [1372] y: [410]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (dot v)\n                        Clone at x: [344] y: [300]\n                        Clone at x: [49] y: [440]\n                        Clone at x: [410] y: [545]\n                        Clone at x: [185] y: [698]\n                        Clone at x: [469] y: [888]\n                        Clone at x: [319] y: [950]\n                        Clone at x: [221] y: [950]\n                        Clone at x: [63] y: [1237]\n                        Clone at x: [216] y: [1303]\n                        Clone at x: [308] y: [1668]\n                        Clone at x: [170] y: [1670]\n                    end\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@Danger\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\ngo to x: (0) y: (0)\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: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at x: [445] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [360] 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            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: [430] y: [0]\n                Clone at x: [430] y: [0]\n                Clone at x: [430] y: [0]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (level 5 1 v)\n                    Clone at x: [430] y: [0]\n                    Clone at x: [430] y: [0]\n                    Clone at x: [430] y: [0]\n                    Clone at x: [430] y: [0]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (level 6 1 v)\n                        Clone at x: [250] y: [1580]\n                    end\n                end\n            end\n        end\n    end\nend\n\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\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@Exit\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nturn right (4) degrees\nif <<(costume [name v]) = [Open]> and <touching (player v)?>> then\n    set [exit v] to [win]\nend\n\nwhen I receive [setup v]\nhide\nset [collected v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (closed v)\n    Clone at x: [2312] y: [-40]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (closed v)\n        Clone at x: [1986] y: [-75]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (closed v)\n            Clone at x: [1935] y: [-28]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (closed v)\n                Clone at x: [385] y: [327]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (closed v)\n                    Clone at x: [980] y: [610]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (closed v)\n                        Clone at x: [713] y: [1702]\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch costume to (closed v)\n                            Clone at x: [999999] y: [999999]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\n\nrepeat (10)\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)\n\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nshow\n\nchange [collected max v] by (1)\n\nset [collected max v] to [0]\n\nwhen I receive [open portal v]\nswitch costume to (open v)\n\nchange [collected v] by (1)\ndelete this clone\n\n@Intro\n\nwhen flag clicked\nwait (0) seconds\nswitch costume to (template v)\nstart sound [TheFatRat - Time Lapse v]\nhide variable [score v]\nhide variable [showing score v]\nhide variable [your best v]\nhide variable [☁ ☁ world best v]\nswitch backdrop to (intro v)\nset [brightness v] effect to (0)\npoint in direction (90)\ngo to x: (0) y: (0)\nset size to (5) %\nshow\ngo to [front v] layer\nrepeat (35)\n    change [color v] effect by (0.1)\n    change size by (((50) - (size)) / (5))\nend\nstart sound [Engine v]\nbroadcast (show v)\n\nwhen I receive [flash v]\nset [brightness v] effect to (-200)\nwait (0.3) seconds\nset [brightness v] effect to (0)\n\nwhen I receive [show v]\nset [thing v] to [1]\nrepeat (30)\n    change size by (((110) - (size)) / (5))\n    change [color v] effect by ((thing) / (15))\nend\nrepeat (60)\n    change [thing v] by ((thing) / (5))\n    turn right (thing) degrees\n    change size by ((thing) / (15))\n    change [ghost v] effect by ((thing) / (15))\n    change [color v] effect by ((thing) / (15))\nend\nstop all sounds\nwait (0.1) seconds\nhide\nbroadcast (Next v)\n\nwhen I receive [next v]\npoint in direction (90)\ngo to x: (0) y: (0)\nset size to (100) %\nclear graphic effects\ngo to [front v] layer\nshow\nswitch backdrop to (1 v)\nswitch costume to (costume1 v)\nstart sound [Teleport2 v]\nrepeat until <(costume [number v]) = [10]>\n    next costume\nend\nrepeat until <(costume [number v]) = [34]>\n    next costume\nend\nswitch costume to (costume36 v)\nplay sound [Dun Dun Dunnn v] until done\nwait (0.15) seconds\nswitch costume to (costume35 v)\nplay sound [Dun Dun Dunnn2 v] until done\nwait (0.15) seconds\nswitch costume to (costume37 v)\nplay sound [Dun Dun Dunnn3 v] until done\nwait (0.15) seconds\nhide\nbroadcast (Play Game v)\nbroadcast (Sprite Move Right v)\n\nrepeat (10)\n    repeat (10)\n        change x by (pick random (-10) to (10))\n        change y by (pick random (-10) to (10))\n        change [color v] effect by (0.4)\n    end\n    go to x: (0) y: (0)\nend\nset [brightness v] effect to (0)\nhide\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\nset size to (700) %\n\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\n\n@Sprite1\n\nwhen I receive [play game v]\nset [deaths v] to [0]\n\nwhen this sprite clicked\nset [exit v] to [win]\n\nchange [level v] by (1)\nset [deaths v] to [0]\nbroadcast (Reset v)\nbroadcast (Setup v)\n\nwhen flag clicked\nhide\n\nwhen I receive [tick v]\nswitch backdrop to (LEVEL)\nif <(DEATHS) > [4]> then\n    show\nelse\n    hide\nend\n\n@Gears\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nturn right (5) degrees\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: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at x: [445] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [360] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [480] y: [-120]\n            Clone at x: [480] y: [0]\n            Clone at x: [480] y: [0]\n            Clone at x: [300] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at x: [430] y: [0]\n                Clone at x: [200] y: [-150]\n                Clone at x: [430] y: [0]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (level 5 1 v)\n                    Clone at x: [430] y: [0]\n                    Clone at x: [550] y: [-160]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (level 6 1 v)\n                    end\n                end\n            end\n        end\n    end\nend\n\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\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@Spring\n\nwhen I receive [green flag v]\nhide variable [mouse v]\nhide\n\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) = [5]> then\n    switch costume to (costume2 v)\n    Clone at x: [520] y: [268]\nelse\n    if <(LEVEL) = [6]> then\n        switch costume to (costume2 v)\n        Clone at x: [118] y: [-85]\n        Clone at x: [215] y: [215]\n        Clone at x: [50] y: [375]\n        Clone at x: [560] y: [600]\n        Clone at x: [160] y: [920]\n        Clone at x: [384] y: [1348]\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)\ncreate clone of (_myself_ v)\n\n
yes part 3 out.\n\nInstructions \narrow keys to move\nPART 1: https://scratch.mit.edu/projects/492378103\nPART 2: https://scratch.mit.edu/projects/500777838\nPART 4: https://scratch.mit.edu/projects/508327517