Rainy Mountain | Scrolling Platformer


@Stage\n\nwhen I receive [setup v]\nif <(LEVEL) = [1]> then\n    switch backdrop to (backdrop1 v)\nelse\n    if <(LEVEL) = [2]> then\n        switch backdrop to (backdrop2 v)\n    else\n        if <(LEVEL) = [3]> then\n            switch backdrop to (backdrop3 v)\n        else\n            if <(LEVEL) = [4]> then\n                switch backdrop to (backdrop1 v)\n            end\n        end\n    end\nend\n\nwhen I receive [game v]\nforever\n    play sound [Darkness_music v] until done\nend\n\nwhen I receive [game v]\nforever\n    play sound [heavy-rain-daniel_simon v] until done\nend\n\n@platforms\n\nwhen I receive [green flag v]\nset [ghost v] effect to (0)\nhide\nswitch costume to (level 3 6 v)\n\nwhen I receive [tick v]\nposition ((x) - (sx)) ((y) - (scy))\n\nwhen I receive [setup v]\nclear graphic effects\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (level 1 1 v)\nif <(LEVEL) = [1]> then\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    Clone at x: [480] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 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) = [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: [480] y: [0]\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\nClone at x: [480] y: []\nClone at x: [450] y: []\nClone at x: [450] y: []\nClone at x: [800] y: []\n\n@Landscape\n\nwhen I receive [green flag v]\nset [ghost v] effect to (0)\nhide\n\nwhen I receive [tick v]\nposition ((x) - (sx)) ((y) - (scy))\n\nwhen I receive [setup v]\nswitch costume to (costume1 v)\nclear graphic effects\nset size to (150) %\nshow\nclear graphic effects\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (scape 1 1 v)\nif <(LEVEL) = [1]> then\n    Clone at x: [480] y: [0]\n    Clone at x: [340] y: [0]\n    Clone at x: [400] y: [0]\n    Clone at x: [400] y: [0]\n    Clone at x: [400] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (1-1 v)\n        Clone at x: [480] y: [0]\n        Clone at x: [480] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (costume6 v)\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 (costume10 v)\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    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\nClone at x: [480] y: []\nClone at x: [450] y: []\nClone at x: [450] y: []\nClone at x: [800] y: []\n\n@Bounce Pads\n\nwhen I receive [green flag v]\nset [ghost v] effect to (0)\nhide\n\nwhen I receive [tick v]\nposition ((x) - (sx)) ((y) - (scy))\n\nwhen I receive [setup v]\nset size to (45) %\nclear graphic effects\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (level 1 1 v)\nif <(LEVEL) = [1]> then\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    Clone at x: [480] y: [0]\nelse\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    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\nClone at x: [480] y: []\nClone at x: [450] y: []\nClone at x: [450] y: []\nClone at x: [800] y: []\n\nwhen flag clicked\nforever\n    set size to (45) %\nend\n\nwhen I start as a clone\nforever\n    set size to (45) %\nend\n\n@Obstacles\n\nwhen I receive [green flag v]\nset [ghost v] effect to (0)\nhide\n\nwhen I receive [tick v]\nposition ((x) - (sx)) ((y) - (scy))\n\nwhen I receive [setup v]\nclear graphic effects\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (1-1 v)\nif <(LEVEL) = [1]> then\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: [340] y: [0]\n    Clone at x: [340] y: [0]\n    Clone at x: [340] y: [0]\n    Clone at x: [750] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (2-1 v)\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) = [3]> then\n            switch costume to (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        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\nClone at x: [480] y: []\nClone at x: [450] y: []\nClone at x: [450] y: []\nClone at x: [800] y: []\n\n@Portal\n\nwhen I receive [green flag v]\nset [ghost v] effect to (0)\nhide\n\nwhen I receive [tick v]\nposition ((x) - (sx)) ((y) - (scy))\n\nwhen I receive [setup v]\nclear graphic effects\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (level 1  v)\nif <(LEVEL) = [1]> then\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: [340] y: [0]\n    Clone at x: [340] y: [0]\n    Clone at x: [340] y: [0]\n    Clone at x: [100] y: [0]\nelse\n    if <<(LEVEL) = [2]> or <(LEVEL) = [3]>> then\n        switch costume to (costume3 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        hide\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\nClone at x: [480] y: []\nClone at x: [450] y: []\nClone at x: [450] y: []\nClone at x: [800] y: []\n\n@Sprite1\n\nwhen I start as a clone\nset [ghost v] effect to (40)\ngo to [front v] layer\nforever\n    go to x: (0) y: (0)\n    switch costume to (costume2 v)\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        start sound [Coin v]\n        broadcast (green flag v)\n    end\nend\n\nwhen I receive [green flag v]\nhide\nstop [other scripts in sprite v]\n\nstop [this script v]\n\nwhen I receive [timer start v]\n\n\n\nif <(LEVEL) = [4]> then\n\nwhen I receive [timer start v]\nforever\n\nif <(LEVEL) = [4]> then\n    stop [this script v]\nend\n\nwhen flag clicked\n\nwhen I receive [game v]\nset size to (110) %\nshow\nswitch costume to (costume1 v)\ncreate clone of (_myself_ v)\nforever\n    change [rotate v] by (5)\n    point in direction ((90) - ([cos v] of (rotate) ))\nend\n\n@player\n\nwhen I receive [tick v]\nTick\n\nwhen flag clicked\nhide\nset volume to (100) %\nbroadcast (start! v) and wait\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\ngo [backward v] (1) layers\n\ndefine game on!\nset [sx v] to ((sx) / (5))\nset [scy v] to ((scy) / (5))\nset [sx v] to (round (sx))\nset [scy v] to (round (scy))\nset [x v] to [0]\nset [y v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nbroadcast (close space v)\nset rotation style [all around v]\npoint in direction (90)\nswitch costume to (base v)\nset [ghost v] effect to (0)\nclear graphic effects\nset size to (45) %\nshow\n\ndefine Tick\nif <touching (bounce v)?> then\n    set [sy v] to [30]\nend\nif <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > [10]>>> then\n    change player x by [8]\nelse\n    if <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < [-10]>>> then\n        change player x by [-8]\n    end\nend\nif <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n    if <(in air) < [4]> then\n        set [sy v] to [15]\n    end\nend\nif <touching (platforms v)?> then\nif <touching (portal v)?> then\n    set [exit v] to [win]\nend\nif <touching (bounce pads v)?> then\n    set [sy v] to [25]\nend\nchange [sy v] by (-2)\nchange player y by (sy)\nPosition\ntest die\nchange [sx v] by (round (((x) - (sx)) / (10)))\nif <(sx) < [0]> then\n    set [sx v] to [0]\nend\nchange [scy v] by (round (((y) - (scy)) / (10)))\nif <(scy) < [0]> then\n    set [scy v] to [0]\nend\nposition\nif <<(y) < [-180]> or <touching (obstacles v)?>> then\n    set [exit v] to [die]\nend\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 change player x by (sx)\nchange [x v] by ((sx) * (1.1))\nposition\nif <touching (platforms v)?> then\n    repeat (10)\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 (-10)\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\nset [exit v] to []\nrepeat (5)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\nhide\nwait (0.5) seconds\n\ndefine test die\nif <touching (danger v)?> then\n    set [exit v] to [die]\nend\n\ndefine game - win\nstart sound [Win v]\nrepeat (50)\n    turn right (55) degrees\n    change size by (-0.5)\n    change [ghost v] effect by (2)\nend\nhide\nchange [level v] by (1)\nwait (1) seconds\n\nwhen I receive [green flag v]\nshow\nset size to (50) %\nset [level v] to [1]\nforever\n    broadcast (reset v) and wait\n    broadcast (setup v)\n    game on!\n    repeat until <(exit) > []>\n        broadcast (tick v)\n        broadcast (attack? v)\n    end\n    if <(exit) = [win]> then\n        game - win\n        set [sx v] to [0]\n        set [scy v] to [0]\n    else\n        game-die\n    end\nend\n\ndefine position\ngo to x: ((x) - (sx)) y: ((y) - (scy))\n\nwhen flag clicked\n\nwhen I start as a clone\nrepeat (50)\n    change x by (-1)\n    change size by (-2)\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\nwhen flag clicked\nset size to (25) %\n\nforever\n    wait (0.03) seconds\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nforever\n    if <touching (bounce pads v)?> then\n        start sound [Big Boing v]\n    end\n    if <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n        if <(in air) < [4]> then\n            play sound [Jump3 v] until done\n        end\n    end\nend\n\nwhen I receive [setup v]\nclear graphic effects\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (level 1 1 v)\n\nhide\n\nwhen flag clicked\nforever\n    if <(LEVEL) = [1]> then\n        switch costume to (1 v)\n    else\n        if <(LEVEL) = [2]> then\n            switch costume to (2 v)\n        else\n            if <(LEVEL) = [3]> then\n                switch costume to (3 v)\n            end\n        end\n    end\nend\n\n@IntroNew\n\nwhen flag clicked\nstart sound [OST-Xenogen v]\nwait (.5) seconds\nset [size v] to [1]\nset [level v] to [1000]\nrepeat (100)\n    point in direction ((LEVEL) * (0.9))\n    set [level v] to ((LEVEL) * (0.9))\nend\n\nwhen flag clicked\nset volume to (100) %\ngo to [front v] layer\nwait (6) seconds\nrepeat (40)\n    change volume by (-2.5)\nend\nstop all sounds\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nhide\nwait (.5) seconds\nshow\nswitch costume to (costume1 v)\ncreate clone of (_myself_ v)\nset [ghost v] effect to (0)\nset [size v] to [1]\nset size to (15) %\nrepeat (20)\n    change size by ((Size) * (0.9))\n    set [size v] to ((Size) * (1.05))\nend\nrepeat (80)\n    change size by ((Size) * (0.9))\n    set [size v] to ((Size) * (0.95))\nend\nwait (3) seconds\nset [size v] to [-1]\nset [level v] to [2]\nrepeat (20)\n    change [ghost v] effect by (5)\n    change size by ((Size) * (0.9))\n    set [size v] to ((Size) * (1.05))\n    set [level v] to ((LEVEL) * (1.3))\nend\nhide\nwait (1) seconds\nbroadcast (Game v)\n\nwhen I start as a clone\nset size to (100) %\nset [loc v] to [200]\nswitch costume to (costume2 v)\nrepeat (100)\n    point in direction ((LEVEL) * (0.9))\n    set y to ((LOC) * (0.9))\n    set [loc v] to ((LOC) * (0.9))\nend\nwait (3) seconds\nrepeat (80)\n    change [ghost v] effect by (5)\n    change size by ((Size) * (0.9))\n    point in direction ((LEVEL) * (1.2))\nend\ndelete this clone\n\n@Sprite2\n\nwhen flag clicked\ngo to [front v] layer\nshow\n\nwhen I receive [game v]\nhide\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n@Rain\n\nwhen flag clicked\nhide\nforever\n    go to [front v] layer\n    next costume\nend\n\nwhen I receive [game v]\nshow\n\n@Mist\n\nwhen flag clicked\nhide\n\nwhen I receive [game v]\nshow\nset [ghost v] effect to (60)\nforever\n    go to [front v] layer\n    glide (.5) secs to x: (pick random (-75) to (75)) y: (pick random (-75) to (75))\nend\n\n@Background\n\nwhen flag clicked\nhide\n\nwhen I receive [setup v]\nset size to (150) %\nshow\nforever\n    set x to (((sx) / (23)) * (-1))\n    set y to (((scy) / (15)) * (-1))\nend\n\n