Land ~ A Scrolling Platformer
@Stage\n\nwhen flag clicked\nswitch backdrop to (sky v)\n\nwhen I receive [begin  v]\nset volume to (82) %\nwait (0) seconds\nforever\n    play sound [TheFatRat & JJD - Prelude \(VIP Edit\) v] until done\n    wait (0) seconds\nend\n\n@Player\n\ndefine Tick\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    switch costume to (right v)\n    change [sx v] by (2)\nend\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    switch costume to (left v)\n    change [sx v] by (-2)\nend\nif <not <<<<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> or <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>>> or <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(y position) < (mouse y)>>>>> then\n    switch costume to (center v)\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 <key (w v) pressed?>> or <<mouse down?> and <(y position) < (mouse y)>>> then\n    if <(In Air) < [4]> then\n        switch costume to (up v)\n        set [speed y v] to [15]\n    end\nend\nchange [speed y v] by (-1.5)\nChange player y by (Speed Y)\nTest - Die\nchange [scroll x v] by (round (((X) - (SCROLL X)) / (15)))\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nchange [scroll y v] by (round (((Y) - (SCROLL Y)) / (2)))\nPosition\nif <(SCROLL Y) < [-150]> then\n    set [exit v] to [Die]\nend\nif <touching (trampoline v)?> then\n    if <(In Air) < [4]> then\n        set [speed y v] to [30]\n    end\nend\n\ndefine Change player x by (sx)\nchange [x v] by (sx)\nPosition\nif <touching (ground v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (ground v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    repeat until <not <touching (ground 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 Change player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (ground 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 [speed y v] to [0]\nend\n\ndefine Position\ngo to x: ((X) - (SCROLL X)) y: ((Y) - (SCROLL Y))\n\nwhen flag clicked\nset [level v] to [0]\n\nwhen I receive [greenflah v]\nhide\ngo to [front v] layer\n\nwhen flag clicked\nhide\n\nwhen I receive [begin  v]\nshow\nbroadcast (Greenflah v) and wait\nbroadcast (Play game v) and wait\n\ndefine Game on\nswitch costume to (idle v)\npoint in direction (90)\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [speed y v] to [0]\nset [sx 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 GameWin\nrepeat (5)\n    point towards (exit v)\n    turn right (100) degrees\n    move ((distance to [exit v]) / (1)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nhide\nset [ghost v] effect to (0)\nset size to (100) %\nchange [level v] by (1)\nwait (1) seconds\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        GameWin\n    else\n        Game - Die\n    end\nend\n\ndefine Test - Die\nif <<touching (danger v)?> or <touching color (#000000)?>> then\n    set [exit v] to [Die \(other way\)]\nend\n\ndefine Game - Die\nset [ghost v] effect to (0)\n\nwhen flag clicked\nswitch costume to (center v)\n\nwhen flag clicked\nforever\n    set [player x v] to (x position)\nend\n\n@Ground\n\ndefine Position x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (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 (lvl 1 1 v)\n    Position x: [0] y: [0]\n    switch costume to (lvl 1 2 v)\n    Position x: [600] y: [0]\n    switch costume to (lvl 1 3 v)\n    Position x: [450] y: [0]\n    switch costume to (lvl 1 4 v)\n    Position x: [0] y: [0]\n    switch costume to (lvl 1 5 v)\n    Position x: [450] y: [0]\n    switch costume to (exit v)\n    Position x: [999999] y: [999]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (lvl 2 1 v)\n        Position x: [0] y: [0]\n        switch costume to (lvl 2 2 v)\n        Position x: [800] y: [0]\n        switch costume to (lvl 2 3 v)\n        Position x: [800] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (lvl 3 1 v)\n            Position x: [450] y: [0]\n            switch costume to (lvl 3 2 v)\n            Position x: [0] y: [0]\n            switch costume to (lvl 3 3 v)\n            Position x: [450] y: [0]\n            switch costume to (lvl 3 4 v)\n            Position x: [450] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 v)\n                Position x: [0] y: [0]\n                switch costume to (level 4 2 v)\n                Position x: [0] y: [0]\n                switch costume to (level 4 3 v)\n                Position x: [500] y: [0]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (level - end for now v)\n                    Position x: [0] y: [0]\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 [tick v]\nPosition ((X) - (SCROLL X)) ((Y) - (SCROLL Y))\n\nwhen I receive [greenflah v]\nshow\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen flag clicked\nwait until <(LEVEL) = [5]>\nbroadcast (Costume v)\n\nswitch costume to (lvl 3 4 v)\nPosition x: [800] y: [0]\n\n@Danger\n\ndefine Position x: (x) y: (y)\nchange [x v] by (x)\nchange [y v] by (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [setup v]\ngo to [back v] layer\nset [y v] to [0]\nset [x v] to [0]\nswitch costume to (lvl 1 1 v)\nif <(LEVEL) = [1]> then\n    Position x: [140] y: [0]\n    switch costume to (lvl 1 2 v)\n    Position x: [450] y: [0]\n    switch costume to (lvl 1 3 v)\n    Position x: [450] y: [0]\n    switch costume to (lvl 1 4 v)\n    Position x: [200] y: [0]\n    switch costume to (lvl 1 5 v)\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (lvl 2 1 v)\n        Position x: [0] y: [0]\n        switch costume to (lvl 2 2 v)\n        Position x: [0] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (lvl 3 2 v)\n            Position x: [450] y: [0]\n            switch costume to (lvl 3 4 v)\n            Position x: [0] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (lvl 4 1 v)\n                Position x: [0] y: [0]\n                switch costume to (lvl 4 2 v)\n                Position x: [0] y: [0]\n                switch costume to (lvl 4 3 v)\n                Position x: [700] y: [0]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to ( level- efn v)\n                else\n                    Position x: [99999] y: [999]\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 [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [greenflah v]\nshow\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I receive [begin  v]\nshow\n\n@Start\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nset [ghost v] effect to (0)\nhide\n\nwhen flag clicked\nforever\n    set y to ((0) + ((20) * ([cos v] of (((timer) - (3)) * (150)) )))\nend\n\nwhen this sprite clicked\nbroadcast (Begin  v)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [button v]\nshow\n\n@Exit\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    set [exit v] to [Win]\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [begin  v]\nset [ghost v] effect to (0)\nshow\n\ndefine Clone x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\n\nwhen I receive [setup v]\ngo to [front v] layer\nswitch costume to (exit v)\nshow\nset [collect coin v] to [0]\nset [y v] to [0]\nset [x v] to [0]\nif <(LEVEL) = [1]> then\n    Clone x: [1750] y: [103]\nelse\n    if <(LEVEL) = [2]> then\n        Clone x: [1480] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            Clone x: [1850] y: [165]\n        else\n            if <(LEVEL) = [4]> then\n                Clone x: [1150] y: [103]\n            else\n                if <(LEVEL) = [5]> then\n                    Clone x: [99999] y: [999]\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\n@Trampoline\n\n@Sprite1\n\nwhen flag clicked\nhide\ngo to [back v] layer\ngo [forward v] (5) layers\n\nwhen I receive [begin  v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [button v]\nshow\n\n@Sprite2\n\nwhen flag clicked\ngo to [front v] layer\nshow\nswitch costume to (pen v)\nset pen color to (#cc3900)\nset pen size to (10)\nsay []\nerase all\ngo to x: (-50) y: (50)\nerase all\npen down\nrepeat (10)\n    change x by (10)\nend\nrepeat (10)\n    change y by (-10)\nend\nrepeat (10)\n    change x by (-10)\nend\nrepeat (10)\n    change y by (10)\nend\nrepeat (10)\n    change x by (1.3)\nend\nrepeat (10)\n    change y by (-4)\nend\nset pen color to (#26ff00)\nrepeat (10)\n    change y by (4)\nend\nrepeat (10)\n    change x by (2)\nend\nrepeat (10)\n    change y by (-2.4)\nend\nrepeat (10)\n    change y by (2.4)\nend\nrepeat (10)\n    change x by (2)\nend\nrepeat (10)\n    change y by (-3)\nend\nrepeat (10)\n    change y by (3)\nend\nrepeat (10)\n    change x by (2)\nend\nrepeat (10)\n    change y by (-4.2)\nend\nrepeat (10)\n    change y by (4.2)\nend\nrepeat (10)\n    change x by (1.2)\nend\nrepeat (10)\n    change y by (-2)\nend\nrepeat (10)\n    change y by (2)\nend\nset pen color to (#cc3900)\nset pen size to (10.7)\nrepeat (10)\n    change x by (-8)\nend\npen up\ngo to x: (4) y: (-100)\nswitch costume to (pen v)\nrepeat (21)\n    next costume\n    wait (0.1) seconds\nend\nwait (0.5) seconds\nerase all\nhide\nbroadcast (Button v)\n\nwhen flag clicked\nset volume to (50) %\n\nwhen flag clicked\nwait (7) seconds\nplay sound [Computer Beep2 v] until done\n\n@Clouds\n\nwhen I start as a clone\nshow\ngo to [back v] layer\ngo [backward v] (1000000000000000000) layers\nswitch costume to (pick random (1) to (10))\nif <(cn) = [1]> then\n    go to x: (240) y: (pick random (30) to (100))\n    repeat until <[240] > (x position)>\n        change x by (-1)\n    end\n    wait (0.5) seconds\n    delete this clone\nend\nif <(cn) = [2]> then\n    go to x: (-240) y: (pick random (30) to (100))\n    repeat until <[240] < (x position)>\n        change x by (1)\n    end\n    wait (0.5) seconds\n    delete this clone\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [begin  v]\nforever\n    set [cn v] to (pick random (1) to (2))\n    create clone of (_myself_ v)\n    wait (pick random (8) to (15)) seconds\nend\n\n@Sprite3\n\nwhen flag clicked\nset drag mode [not draggable v]\nset [my variable v] to [0]\nforever\n    if <touching (mouse-pointer v)?> then\n        broadcast (message1 v)\n        set [my variable v] to [1]\n        wait (0.8) seconds\n        set [no appear v] to [1]\n    else\n        set [my variable v] to [0]\n    end\nend\n\n@Sprite4\n\nwhen I receive [message1 v]\nforever\n    if <<(NO APPEAR) > [0]> and <(my variable) = [0]>> then\n        show\n        wait (0.5) seconds\n        repeat (50)\n            change [ghost v] effect by (5)\n        end\n    else\n        hide\n    end\nend\n\nwhen flag clicked\ngo to x: (0) y: (-140)\nhide\n\n
Arrow Keys If you're on a computer or mobile controls\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nIf you want this project featured then please propose my project to be featured in the comments of this studio:\nhttps://scratch.mit.edu/studios/4228481\n(Only other people than me can do that)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n4 levels.  Here's part 2: https://scratch.mit.edu/projects/393681773/\nhave fun!\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nPress green flag twice. (If you want less lags)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nI worked very hard on this so please ♥, ★, remix, share, \nfollow, and have fun!