Farm Adventure  ||  Scrolling Platformer

Instructions: WAD or Arrow Keys to Move. Sorry, no mobile.\nS to Skip, R to Restart the Level. \nFollow @TNT-Gaming for his amazing platformers !!! He is very underrated so go check him out !!!\n⛔NO ADVERTISING !!!⛔NO ADVERTISING !!!⛔  ⛔NO ADVERTISING !!!⛔ Please.\n-------------------------------------------------------------------------\n                                  STORY :\nYou are a lonely farmer that lost themselves in the woods. It's your job to find your farm again, but I'm not sure it will be easy.\n-------------------------------------------------------------------------\n\nFeel free to ❤️ and ⭐️if you enjoyed !\nThis is probably my most complicated game I have made, so I hope you enjoy !\nThere may be Lag or Glitch sometimes, so sorry if that happens to you.

@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\nhide variable [mouse v]\n\n@Blank\n\n@Player\n\nwhen flag clicked\nbroadcast (Green Flag v) and wait\nbroadcast (Play Game v) and wait\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\nset [ghost v] effect to (0)\npoint in direction (90)\n\nwhen I receive [play game v]\nset [level v] to [1]\nset [ghost v] effect to (0)\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    Play\n    repeat until <(EXIT) > []>\n        Run\n        broadcast (Tick v) and wait\n    end\n    if <(EXIT) = [win]> then\n        You Win\n    else\n        You Died \n    end\n    if <(EXIT) = [Next Level]> then\n        change [level v] by (1)\n    end\n    if <(EXIT) = [Restart]> then\n        broadcast (Reset v) and wait\n    end\nend\n\ndefine Play\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [sx v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nswitch costume to (costume1 v)\nset [ghost v] effect to (0)\nset size to (55) %\nshow\n\ndefine Run\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    switch costume to (costume2 v)\n    change [sx v] by (-2)\nend\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    switch costume to (costume1 v)\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 <key (w v) pressed?>> 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) < [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 Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\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)\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    if <<key (up arrow v) pressed?> or <key (w 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\ndefine You Died \nset [exit v] to []\nrepeat (10)\n    wait (0.0001) seconds\n    change [ghost v] effect by (10)\nend\nwait (0.1) seconds\n\ndefine Test - Die\nif <touching (danger v)?> then\n    set [exit v] to [die]\nend\n\ndefine You 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\npoint in direction (90)\n\nwhen flag clicked\nforever\n    if <key (s v) pressed?> then\n        set [exit v] to [Next Level]\n    end\n    if <key (r v) pressed?> then\n        set [exit v] to [Restart]\n    end\nend\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]\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: [600] 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: [100] y: [260]\n        Clone at x: [100] y: [260]\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        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 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    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@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\ngo to [front v] layer\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: [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: [-100] 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        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 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    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@Coins\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    change [coins collected v] by (1)\n    if <(COINS COLLECTED) = (COLLECTED MAX)> then\n        broadcast (Open Portal v)\n    end\n    delete this clone\nend\n\nwhen I receive [setup v]\nhide\nset [coins 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 (money v)\n    Clone at x: [100] y: [-100]\n    Clone at x: [175] y: [-100]\n    Clone at x: [347] y: [-34]\n    Clone at x: [347] y: [59]\n    Clone at x: [552] y: [-105]\n    Clone at x: [830] y: [165]\n    Clone at x: [913] y: [-99]\n    Clone at x: [1212] y: [88]\n    Clone at x: [1380] y: [-100]\n    Clone at x: [1583] y: [-35]\n    Clone at x: [1700] y: [26]\n    Clone at x: [1827] y: [79]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (money v)\n        Clone at x: [-224] y: [-100]\n        Clone at x: [224] y: [-102]\n        Clone at x: [404] y: [-107]\n        Clone at x: [470] y: [175]\n        Clone at x: [551] y: [-102]\n        Clone at x: [739] y: [27]\n        Clone at x: [874] y: [-56]\n        Clone at x: [1098] y: [-30]\n        Clone at x: [1201] y: [53]\n        Clone at x: [1100] y: [137]\n        Clone at x: [1202] y: [230]\n        Clone at x: [1078] y: [304]\n        Clone at x: [1199] y: [393]\n        Clone at x: [1301] y: [489]\n        Clone at x: [1177] y: [561]\n        Clone at x: [1300] y: [657]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (money v)\n            Clone at x: [-224] y: [-103]\n            Clone at x: [-214] y: [273]\n            Clone at x: [-33] y: [272]\n            Clone at x: [288] y: [-10]\n            Clone at x: [120] y: [-3]\n            Clone at x: [561] y: [-8]\n            Clone at x: [921] y: [167]\n        end\n    end\nend\nset [x v] to [-999999999]\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\n@Sun\n\nwhen flag clicked\nshow\ngo to [back v] layer\n\n@Portal\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\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 [coins 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: [1987] y: [99]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (closed v)\n        Clone at x: [1299] y: [800]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (closed v)\n            Clone at x: [1182] y: [57]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (closed v)\n                Clone at x: [1182] y: [57]\n            else\n                if <(LEVEL) > [4]> then\n                    switch costume to (closed v)\n                    Clone at x: [1182] y: [57]\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 [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\n\nwhen I receive [open portal v]\nswitch costume to (open v)\n\n@detector\n\nwhen flag clicked\nhide\nset [faved___ v] to [0]\nset [loved__ v] to [0]\nset [clone id v] to [0]\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\nwait until <<(LOVED__) = [1]> and <(FAVED___) = [1]>>\nwait (1) seconds\nshow\ngo to x: (0) y: (50)\nreset timer\nswitch costume to (pick random (1) to (4))\nset [ghost v] effect to (100)\nrepeat until <(timer) > [3.5]>\n    change y by ((y position) / (-15))\n    change [ghost v] effect by (-3)\nend\nreset timer\nrepeat until <(timer) > [3.5]>\n    change y by (((y position) - (-100)) / (-15))\n    change [ghost v] effect by (10)\nend\n\nwhen I start as a clone\nif <(clone id) = [0]> then\n    go to x: (-15) y: (0)\n    set [loved__ v] to [0]\n    switch costume to (love v)\n    forever\n        set [love? v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [loved__ v] to [1]\n        end\n    end\nend\nif <(clone id) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (fave v)\n    set [faved___ v] to [0]\n    forever\n        set [fav v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [faved___ v] to [1]\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\n@Cloud\n\nwhen flag clicked\nshow\nset size to (30) %\nset [ghost v] effect to (25)\ngo to x: (-147) y: (120)\n\n@Cloud2\n\nwhen flag clicked\nshow\nset size to (20) %\nset [ghost v] effect to (18)\ngo to x: (-28) y: (82)\n\n@Cloud3\n\nwhen flag clicked\nshow\nset size to (30) %\nset [ghost v] effect to (25)\ngo to x: (110) y: (143)\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\n@Music\n\nwhen flag clicked\nset volume to (100) %\nplay sound [Music 1 v] until done\n\n    play sound [Music 2 v] until done\nend\n\n