Slime In Space || Scrolling 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 flag clicked\nswitch backdrop to (space v)\n\nwait (3.9) seconds\nstop all sounds\n\nwhen I receive [play game v]\nrepeat (500)\n    start sound [TheFatRat - Unity v]\nend\n\nswitch backdrop to (cave v)\n\nwhen I receive [setup v]\nif <(LEVEL) = [3]> then\n    switch backdrop to (cave v)\nend\n\n@Blank\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    Game On\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v)\n    end\n    if <(EXIT) = [win]> then\n        start sound [Teleport2 v]\n        Game - Win\n    else\n        Game - Die\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 [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 [16]\n    end\nend\nif <(sy) > [-20]> 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\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.1) seconds\n\ndefine Test - Die\nif <touching (danger v)?> then\n    set [exit v] to [die]\nend\n\nTest - Die\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\nhide\nchange [level v] by (1)\nwait (1) seconds\n\nbroadcast (Play Game v)\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]\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: [3] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [80]\n    Clone at x: [360] y: [0]\n    Clone at x: [-20] y: [310]\n    Clone at x: [-360] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [400] y: [0]\n            Clone at x: [400] y: [0]\n            Clone at x: [400] y: [0]\n            Clone at x: [400] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 v)\n                switch backdrop to (space v)\n                Clone at x: [400] y: [0]\n                Clone at x: [400] y: [0]\n                Clone at x: [400] y: [0]\n                Clone at x: [400] y: [0]\n                Clone at x: [0] y: [200]\n                Clone at x: [0] y: [200]\n                Clone at x: [0] y: [200]\n                Clone at x: [0] y: [300]\n                Clone at x: [500] y: [-200]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (level 5 1 v)\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)\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\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: [119] y: [88]\n    Clone at x: [130] y: [-40]\n    Clone at x: [170] y: [-40]\n    Clone at x: [210] y: [-40]\n    Clone at x: [82] y: [70]\n    Clone at x: [154] y: [70]\n    Clone at x: [1050] y: [318]\n    Clone at x: [1095] y: [346]\n    Clone at x: [1125] y: [322]\n    Clone at x: [1082] y: [453]\n    Clone at x: [916] y: [462]\n    Clone at x: [718] y: [475]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (dot v)\n        Clone at x: [217] y: [23]\n        Clone at x: [248] y: [63]\n        Clone at x: [290] y: [82]\n        Clone at x: [327] y: [59]\n        Clone at x: [338] y: [15]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (dot v)\n            Clone at x: [129] y: [-43]\n            Clone at x: [179] y: [-43]\n            Clone at x: [229] y: [-43]\n            Clone at x: [279] y: [-43]\n            Clone at x: [641] y: [-5]\n            Clone at x: [758] y: [-8]\n            Clone at x: [799] y: [19]\n            Clone at x: [837] y: [-8]\n            Clone at x: [1012] y: [-22]\n            Clone at x: [1012] y: [-22]\n            Clone at x: [1044] y: [8]\n            Clone at x: [1080] y: [8]\n            Clone at x: [1124] y: [-22]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (dot v)\n                Clone at x: [817] y: [130]\n                Clone at x: [255] y: [-41]\n                Clone at x: [377] y: [4]\n                Clone at x: [665] y: [51]\n                Clone at x: [1034] y: [-93]\n                Clone at x: [1134] y: [-93]\n                Clone at x: [1234] y: [-93]\n                Clone at x: [1375] y: [-64]\n                Clone at x: [1450] y: [171]\n                Clone at x: [1450] y: [293]\n                Clone at x: [1450] y: [293]\n                Clone at x: [1450] y: [354]\n                Clone at x: [1450] y: [518]\n                Clone at x: [1506] y: [950]\n                Clone at x: [1883] y: [869]\n            end\n        end\n    end\nend\nset [x v] to [-99999]\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)\nchange [collected max v] by (1)\ncreate clone of (_myself_ v)\n\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\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\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: [150] y: [300]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [400] y: [0]\n            Clone at x: [400] y: [0]\n            Clone at x: [400] y: [0]\n            Clone at x: [400] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at x: [400] y: [0]\n                Clone at x: [400] y: [0]\n                Clone at x: [400] y: [0]\n                Clone at x: [400] y: [0]\n                Clone at x: [0] y: [200]\n                Clone at x: [0] y: [200]\n                Clone at x: [0] y: [200]\n            else\n                if <(LEVEL) = [5]> then\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 (2) 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: [545] y: [445]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (closed v)\n        Clone at x: [328] y: [-107]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (closed v)\n            Clone at x: [1506] y: [-20]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (closed v)\n                Clone at x: [2277] y: [648]\n            else\n                set [x v] to [-9999999]\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\nstart sound [Low Boing v]\nstart sound [TheFatRat - Unity v]\nwait (0) seconds\nhide variable [score v]\nhide variable [showing score v]\nhide variable [your best v]\nhide variable [☁ ☁ world best v]\nswitch backdrop to (backdrop2 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)\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\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\nwait (0.3) seconds\nhide\nbroadcast (Startup Animation v)\nstop all sounds\n\n@Startup Animation\n\nwhen flag clicked\nhide\nforever\n    if <key (s v) pressed?> then\n        stop all sounds\n        hide\n        broadcast (Play Game v)\n    end\nend\n\nwhen I receive [startup animation v]\nset volume to (150) %\nstart sound [Fade v]\nset voice to (tenor v)::tts\nset language to (en v)::tts\ngo to x: (0) y: (-50)\nswitch costume to (costume 1 v)\nset size to (100) %\nclear graphic effects\ngo to [front v] layer\nshow\nspeak [5 Billion years ago, there was life on Mars. ]::tts\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nnext costume\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nspeak [The organism that lived on Mars was SSlime.]::tts\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nnext costume\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nspeak [The Slime on Mars discovered Portals.]::tts\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nnext costume\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nspeak [Then, they discovered gold!]::tts\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nnext costume\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nspeak [They loved GOLD!]::tts\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nnext costume\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nspeak [So much that they would stop at nothing to get it. ]::tts\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nnext costume\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nspeak [They collected every piece they could find.]::tts\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nnext costume\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nspeak [Then, they took a Portal to Teleport somewhere else.]::tts\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nnext costume\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nstop all sounds\nset volume to (200) %\nstart sound [Dun Dun Dunnn v]\nspeak [SLIME IN SPACE!]::tts\nhide\nbroadcast (Play Game v)\n\nif <[] > [0.1]> then\n    broadcast (Play Game v)\nend\n\nwait (5) seconds\nnext costume\n\nstart sound [Fade v]\n\nwhen [s v] key pressed\nstop [other scripts in sprite v]\nstop all sounds\nbroadcast (Play Game v)\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\nset [ghost v] effect to (0)\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\n\n