Snowy Mountain -A Scrolling Platformer-

Instructions: Arrow keys/wad/mobile to move.\nAvoid spikes and saws.\nBounce on bounce pads.\nThe flags are checkpoints.\nWatch out for moving saws!

@Stage\n\nwhen I receive [start v]\nrepeat (10)\n    erase all\nend\nstop all sounds\nset volume to (50) %\nforever\n    play sound [Unlimited v] until done\nend\n\n@Player\n\ndefine Change Player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nTest dying\nBouce?\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\ndefine Change Player x by (sx)\nchange [x v] by (sx)\nBouce?\nPosition\nTest dying\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 <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (20))>>> 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 Tick\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    change [sx v] by (-2.2)\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    change [sx v] by (2.2)\nend\nset [sx v] to ((sx) * (.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    Change Player x by (round (sx))\nend\nif <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (20))>>> then\n    if <[4] > (in air)> then\n        set [sy v] to [18]\n    end\nend\nchange [sy v] by (-2)\nChange Player y by (sy)\nset [scroll x v] to (x)\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\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) < [-150]> then\n    start sound [Crunch v]\n    set [exit v] to [die]\nend\nif <touching (bounce v)?> then\n    start sound [Big Boing v]\n    set [sy v] to [30]\nend\n\nwhen flag clicked\nbroadcast (green flag v) and wait\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\ngo [backward v] (1) layers\n\nwhen I receive [playgame 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) and wait\n    end\n    if <(EXIT) = [win]> then\n        win\n    else\n        die\n    end\nend\n\ndefine Game on\nif <(Check) = [0]> then\n    set [x v] to [0]\n    set [y v] to [0]\nend\nif <(Check) = [1]> then\n    set [x v] to [1750]\n    set [y v] to [0]\nend\nif <(Check) = [2]> then\n    set [x v] to [3660]\n    set [y v] to [100]\nend\nset [sx v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset [scroll y v] to [0]\nset [scroll x v] to [0]\npoint in direction (90)\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\ndefine win\nglide (.3) secs to (portal v)\nrepeat (10)\n    turn right (36) degrees\n    change size by (-10)\n    change [ghost v] effect by (10)\nend\nhide\nchange [level v] by (1)\nwait (1) seconds\n\ndefine die\nset [exit v] to []\nrepeat (10)\n    change size by (-10)\n    change [ghost v] effect by (10)\nend\nhide\nwait (.5) seconds\nset [exit v] to []\n\ndefine Test dying\nif <<touching (danger v)?> or <touching (danger2 v)?>> then\n    start sound [Crunch v]\n    set [exit v] to [die]\nend\n\ndefine Bouce?\n\nwhen I receive [start v]\nset [check v] to [0]\nbroadcast (playgame v) and wait\n\nbroadcast (green flag v)\n\nbroadcast (playgame v)\n\n@Platforms\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\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 [green flag v]\nhide\ngo to [back v] layer\ngo [forward v] (2) layers\n\nwhen I receive [reset v]\ndelete this clone\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: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\nend\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@Platforms2\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\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 [green flag v]\nhide\ngo to [back v] layer\n\nwhen I receive [reset v]\ndelete this clone\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: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\nend\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@danger\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nturn right (7) degrees\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 [green flag v]\nhide\ngo to [back v] layer\ngo [forward v] (1) layers\n\nwhen I receive [reset v]\ndelete this clone\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: [450] y: [-70]\n    Clone at x: [450] y: [-70]\n    Clone at x: [450] y: [-70]\n    Clone at x: [450] y: [-70]\n    Clone at x: [450] y: [300]\n    Clone at x: [450] y: [-70]\n    Clone at x: [450] y: [-70]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [300]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [300]\n    Clone at x: [450] y: [300]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [300]\n    Clone at x: [450] y: [0]\nend\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\nwait () seconds\n\nforever\n\n@danger2\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\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 [green flag v]\npoint in direction (90)\nhide\ngo to [back v] layer\ngo [forward v] (1) layers\n\nwhen I receive [reset v]\ndelete this clone\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: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\nend\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\nwait () seconds\n\nforever\n\n@Platforms3\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    set [check v] to [1]\nend\nif <<(Check) = [1]> or <(Check) = [2]>> then\n    set [ghost v] effect to (0)\nelse\n    set [ghost v] effect to (40)\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 [green flag v]\nhide\ngo to [back v] layer\ngo [forward v] (2) layers\n\nwhen I receive [reset v]\ndelete this clone\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: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\nend\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@Bounce\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\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 [green flag v]\nhide\ngo to [back v] layer\ngo [forward v] (2) layers\n\nwhen I receive [reset v]\ndelete this clone\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: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\nend\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@Platforms4\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    set [check v] to [2]\nend\nif <(Check) = [2]> then\n    set [ghost v] effect to (0)\nelse\n    set [ghost v] effect to (40)\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 [green flag v]\nhide\ngo to [back v] layer\ngo [forward v] (2) layers\n\nwhen I receive [reset v]\ndelete this clone\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: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\n    Clone at x: [450] y: [0]\nend\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@Sprite1\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\ngo [forward v] (1) layers\nset [ghost v] effect to (100)\n\n@intro\n\nwhen flag clicked\nset volume to (100) %\nstart sound [Super intro v]\nswitch costume to (screen shot 2020-07-06 at 3 v)\nset size to (100) %\nerase all\nhide\nset [ghost v] effect to (0)\npen up\ngo to x: (-231) y: (-240)\nset pen size to (100)\nset pen color to (#00f307)\npen down\nrepeat (3)\n    point in direction (0)\n    repeat (20)\n        move (20) steps\n    end\n    point in direction (90)\n    repeat (5)\n        move (20) steps\n    end\n    point in direction (180)\n    repeat (20)\n        move (20) steps\n    end\n    point in direction (90)\n    repeat (5)\n        move (20) steps\n    end\nend\npen up\nshow\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nset size to (200) %\npoint in direction (90)\nshow\nrepeat (20)\n    change size by (-10)\n    turn right (10) degrees\nend\nrepeat (10)\n    change size by (20)\n    turn right (10) degrees\nend\npoint in direction (90)\nrepeat (10)\n    change size by (-10)\nend\nwait (.5) seconds\nrepeat (20)\n    turn right (18) degrees\n    create clone of (_myself_ v)\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\nerase all\nbroadcast (start v)\nerase all\ndelete this clone\n\nwhen flag clicked\nforever\n    set pen color to (#00f307)\n    wait (.5) seconds\n    repeat (17)\n        change pen (color v) by (-1)\n    end\n    set pen color to (#ffe900)\n    wait (.5) seconds\n    repeat (14)\n        change pen (color v) by (-1)\n    end\n    set pen color to (#ff0000)\n    wait (.5) seconds\n    repeat (32)\n        change pen (color v) by (1)\n    end\nend\n\nwhen I start as a clone\nswitch costume to (costume1 v)\nset pen size to (100)\nset pen color to (#ffffff)\npen down\nrepeat until <touching (_edge_ v)?>\n    move (15) steps\nend\ndelete this clone\n\n