✌︎︎MOUNTAIN - A 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 I receive [start project v]\nshow variable [collected v]\nshow variable [total coins in level v]\nforever\n    play sound [no-copyright-music-lofi-type-beat-forest-royalty-free-vlog-music-prod-by-lukrembo2 v] until done\nend\n\nwhen flag clicked\nhide variable [total coins in level v]\nhide variable [collected v]\n\nwhen I receive [done v]\n\nwhen I receive [start project v]\nwait (5) seconds\nforever\n    if <(level) = [4]> then\n        hide variable [total coins in level v]\n        hide variable [collected v]\n    end\nend\n\n@Sprite1\n\n@collectibles\n\nchange [x v] by (360)\nchange [y v] by (1)\n\nwhen flag clicked\nhide\n\nwhen I receive [tic v]\nposition ((x) - (scroll x)) ((y) - (scroll y))\nif <touching (player2 v)?> then\n    change [collected v] by (1)\n    if <(Collected) = (Total coins in level)> then\n        broadcast (open portal v)\n    end\n    delete this clone\nend\n\nwhen I receive [setup v]\nset [collected v] to [0]\nset [total coins in level v] to [0]\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: [313] y: [-32]\n    clone at x: [429] y: [-32]\n    clone at x: [728] y: [-95]\nelse\n    if <(level) = [2]> then\n        switch costume to (level 1-1 v)\n        clone at x: [17] y: [176]\n        clone at x: [152] y: [-76]\n        clone at x: [569] y: [31]\n        clone at x: [872] y: [46]\n        clone at x: [-229] y: [-31]\n        clone at x: [243] y: [109]\n        clone at x: [525] y: [-115]\n        clone at x: [1214] y: [-107]\n    else\n        if <(level) = [3]> then\n            switch costume to (level 1-1 v)\n            clone at x: [58] y: [188]\n            clone at x: [108] y: [236]\n            clone at x: [385] y: [274]\n            clone at x: [872] y: [46]\n            clone at x: [243] y: [333]\n            clone at x: [350] y: [67]\n            clone at x: [380] y: [7]\n            clone at x: [1815] y: [-57]\n            clone at x: [1236] y: [57]\n            clone at x: [1543] y: [103]\n            clone at x: [1776] y: [128]\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\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)\nchange [total coins in level v] by (1)\n\nwait (0.00000000000000000000000000000000000001) seconds\n\nnext costume\n\nwhen I receive [done v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [start v]\ngo to [front v] layer\n\n@platforms2\n\nwhen flag clicked\nhide\n\nwhen I receive [tic 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]\nelse\n    if <(level) = [2]> then\n        switch costume to (level 2-1 v)\n        clone at x: [360] y: [0]\n        clone at x: [360] y: [0]\n    end\nend\n\nclone at x: [360] y: [0]\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\nwhen I receive [done v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [start v]\nshow\n\nwhen I receive [start project v]\ngo to [front v] layer\n\n@Sprite2\n\nwhen I receive [done v]\nshow\nswitch costume to (costume1 v)\ngo to [front v] layer\n\nwhen flag clicked\nhide\n\nwhen flag clicked\n\nwhen I receive [start project v]\nwait (5) seconds\nforever\n    if <(level) = [4]> then\n        show\n        switch costume to (costume1 v)\n        go to [front v] layer\n    end\nend\n\n@Intro :P\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nset [clone v] to [2]\nswitch costume to (rainiidays2 v)\ncreate clone of (_myself_ v)\nset [clone v] to [1]\nswitch costume to (rainiidays1 v)\ncreate clone of (_myself_ v)\nset [clone v] to [0]\nswitch costume to (background v)\ncreate clone of (_myself_ v)\nrepeat until <key (k v) pressed?>\n    change x by (pick random (-10) to (10))\n    change y by (pick random (-10) to (10))\n    switch costume to (rain1 v)\n    wait (0.06) seconds\n    switch costume to (rain1 2 v)\n    wait (0.1) seconds\n    switch costume to (rain2 v)\n    wait (0.06) seconds\n    switch costume to (rain2 2 v)\n    wait (0.1) seconds\nend\n\nwhen I start as a clone\nif <(Clone) = [1]> then\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [ghost v] effect to (100)\n    wait (10) seconds\n    repeat (100)\n        change [ghost v] effect by (-1)\n    end\nend\n\nwhen flag clicked\nforever\n    if <<(x position) > [70]> or <(x position) < [-70]>> then\n        set x to (0)\n    end\n    if <<(y position) > [70]> or <(y position) < [-70]>> then\n        set y to (0)\n    end\nend\n\nwhen flag clicked\nset volume to (100) %\nforever\n    play sound [Aesthetic Music for rainy days - Lofi \(NCM\) \(1\) v] until done\nend\n\nwhen flag clicked\nforever\n    play sound [Rain v] until done\nend\n\nwhen I start as a clone\nif <(Clone) = [1]> then\n    set size to (70) %\n    wait (10.5) seconds\n    repeat (50)\n        change size by (1)\n        wait (0.1) seconds\n    end\nend\n\nwhen I start as a clone\nif <(Clone) = [2]> then\n    go to [front v] layer\n    wait (1) seconds\n    repeat (100)\n        change [ghost v] effect by (1)\n    end\n    wait (15) seconds\n    repeat (100)\n        change [ghost v] effect by (-1)\n    end\n    wait (3) seconds\n    broadcast (Start Project v)\nend\n\nwhen I receive [start project v]\nrepeat (50)\n    change volume by (-2)\nend\nstop [other scripts in sprite v]\nhide\n\nwhen [space v] key pressed\nbroadcast (Start Project v)\n\n@platforms\n\nwhen flag clicked\nhide\n\nwhen I receive [tic 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]\nelse\n    if <(level) = [2]> then\n        switch costume to (level 2-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    else\n        if <(level) = [3]> then\n            switch costume to (level 3-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        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\nwhen flag clicked\nforever\n    if <<(level) = [3]> and <<(Total coins in level) = (Collected)> and <touching (portal v)?>>> then\n        broadcast (done v)\n    end\nend\n\nwhen I receive [done v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [start v]\ngo to [front v] layer\n\n@obstacle\n\nwhen flag clicked\nhide\n\nwhen I receive [tic 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)\nelse\n    if <(level) = [2]> then\n        switch costume to (level 2-1 v)\n        clone at x: [360] y: [0]\n        clone at x: [360] y: [0]\n    end\nend\n\nclone at x: [152] y: [-75]\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\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\nshow\n\nwhen I receive [done v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [start v]\ngo to [front v] layer\n\n@portal\n\nwhen flag clicked\nhide\n\nwhen I receive [tic v]\nposition ((x) - (scroll x)) ((y) - (scroll y))\nif <<touching (player2 v)?> and <(costume [number v]) = [2]>> then\n    set [exit v] to [win]\nend\n\nwhen I receive [setup v]\ngo to [front v] layer\nset [collected v] to [0]\nset [total coins in level v] to [0]\nshow\nset [x v] to [0]\nset [y v] to [0]\nif <(level) = [1]> then\n    go to [front v] layer\n    switch costume to (closed v)\n    clone at x: [897] y: [-16]\nelse\n    if <(level) = [2]> then\n        switch costume to (closed v)\n        clone at x: [850] y: [-48]\n        go to [front v] layer\n    else\n        if <(level) = [3]> then\n            go to [front v] layer\n            switch costume to (closed v)\n            clone at x: [850] y: [-48]\n        else\n            clone at x: [240] y: [-44]\n        end\n    end\n    clone at x: [240] y: [-44]\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)\nchange [x v] by (x)\nchange [y v] by (y)\n\nnext costume\n\nwhen I receive [open portal v]\nswitch costume to (open v)\n\ngo to x: (1061) y: (-44)\n\nwhen I receive [done v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [start v]\ngo to [front v] layer\n\n@player2\n\nwhen I receive [start project v]\nshow\nswitch costume to (costume1 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) > [50]>\n        tic\n        broadcast (tic v) and wait\n    end\n    if <(exit) = [win]> then\n        game-win\n    else\n        game-die\n    end\nend\n\nwhen flag clicked\nhide\n\ndefine game on\nclear graphic effects\nset size to (100) %\nset [sy v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [sx v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nshow\n\ndefine tic\nif <key (left arrow v) pressed?> then\n    point in direction (-90)\n    change [sx v] by (-2)\nend\nif <key (right arrow v) pressed?> 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?> then\n    switch costume to (costume2 v)\n    if <(in air) < [4]> then\n        set [sy v] to [16]\n    end\n    switch costume to (costume1 v)\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nchange player y by (sy)\nposition\ntest-die\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) < [-180]> 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 position\ngo to x: ((x) - (scroll x)) y: ((y) - (scroll y))\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?> 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\nchange player x by [8]\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 (obstacle v)?> then\n    set [exit v] to [die]\nend\n\ndefine game-win\nrepeat (50)\n    point towards (portal v)\n    turn right (65) degrees\n    move ((distance to [portal 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\nset [scroll y v] to [0]\n\n@skins\n\nwhen flag clicked\nset [ghost v] effect to (20)\nhide\n\nwhen I receive [open skins v]\nshow\n\nwhen I receive [close skins v]\nhide\n\n@skins2\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset [skins? v] to [0]\nhide\n\nwhen this sprite clicked\nforever\n    if <(skins?) = [0]> then\n        switch costume to (costume2 v)\n        broadcast (open skins v)\n    else\n        switch costume to (costume1 v)\n        broadcast (close skins v)\n    end\nend\n\nwhen I receive [start project v]\n\nshow\n\nshow variable [skins? v]\n\n@red skin\n\nwhen flag clicked\n\nforever\n    go to (sprite2 v)\nend\n\n@platforms3\n\nwhen flag clicked\nhide\n\nwhen I receive [tic v]\nposition ((x) - ((scroll x) / (3))) ((y) - ((scroll y) / (3)))\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]\nelse\n    if <(level) = [2]> then\n        switch costume to (level 2-1 v)\n        clone at x: [360] y: [0]\n        clone at x: [360] y: [0]\n    else\n        if <(level) = [3]> then\n        end\n    end\nend\n\nswitch costume to (level 3-1 v)\n\nclone at x: [360] y: [0]\nclone at x: [360] y: [0]\nclone at x: [360] y: [0]\nclone at x: [360] y: [0]\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\nwhen flag clicked\nforever\n    if <<(level) = [3]> and <<(Total coins in level) = (Collected)> and <touching (portal v)?>>> then\n        broadcast (done v)\n    end\nend\n\nwhen I receive [done v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [start v]\ngo to [front v] layer\n\nclone at x: [360] y: [0]\nclone at x: [360] y: [0]\n\nclone at x: [360] y: [0]\nclone at x: [360] y: [0]\n\n
Hellllooooooo!\nHere’s my very first scrolling platformer! \nCollect every coin to move on to the next level! Arrow keys to move :)\nYeah I’m aware that it’s very buggy, if you can fix it please remix and show me how >-<\nI also need help with mobile friendly controls :c\n-----------------------------------------------------------------------\nP R E V I O U S: -The Pond-\nhttps://scratch.mit.edu/projects/552199040/