Desert || Scrolling Platformer 

Instructions: Arrow / WASD / Mobile\nSelect the Costume you want to start the Game\nGet Coins in Order to Unlock the Portal\nThere are 3 Levels to complete, they get progressively more difficult ;)\n\nThis took a lot of effort and it would really help if you loved, favorited, and followed :)

@Stage\n\nwhen I receive [end intro v]\nforever\n    play sound [myinstants.download v] until done\n    play sound [myinstants.download2 v] until done\nend\n\n@Platforms\n\nwhen I receive [green flag v]\nshow\n\nwhen I receive [clock 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]\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        set [scroll x v] to [0]\n        set [scroll y v] to [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]\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            Clone At x: [360] y: [0]\n        end\n    end\nend\n\nClone At x: [360] y: [0]\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 start as a clone\ngo to [front v] layer\n\nClone At x: [360] y: [0]\nClone At x: [360] y: [0]\n\n@Thumbnail\n\nwhen flag clicked\nhide\nforever\n    set [timer2 v] to (timer)\nend\n\nwhen [timer v] > (Timer2)\nswitch backdrop to (backdrop3 v)\ngo to [front v] layer\nshow\n\nwhen flag clicked\nswitch backdrop to (backdrop2 v)\n\n@ Lava \n\nwhen I receive [green flag v]\nshow\n\nwhen I receive [clock 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]\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: [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]\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            Clone At x: [360] 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)\nset [ghost v] effect to (10)\ncreate clone of (_myself_ v)\ngo to [back v] layer\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\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\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\n\nwhen I receive [clock v]\nPosition ((x) - (SCROLL X)) (((y) + ((2) * ([sin v] of (((x) + (TICK)) * (10)) ))) - (SCROLL Y))\n\n@Coins\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [clock v]\nPosition ((x) - (SCROLL X)) (((y) + ((5) * ([sin v] of (((x) + (TICK)) * (10)) ))) - (SCROLL Y))\nif <touching (player v)?> then\n    start sound [mario-coin-sound-effect v]\n    change [collected v] by (1)\n    if <<(Collected) = (Collected Max)> or <(Collected) > (Collected Max)>> then\n        broadcast (open portal v)\n    end\n    delete this clone\nend\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nset [collected max v] to [0]\nif <(Level) = [1]> then\n    switch costume to (coin v)\n    if <<(Checkpoint) = [0]> and <not <<(Collected) = [1]> or <(Collected) > [1]>>>> then\n        Clone At x: [352] y: [34]\n    end\n    if <<(Checkpoint) = [0]> and <not <<(Collected) = [2]> or <(Collected) > [2]>>>> then\n        Clone At x: [683] y: [35]\n    end\n    if <<(Checkpoint) = [0]> and <not <<(Collected) = [3]> or <(Collected) > [3]>>>> then\n        Clone At x: [994] y: [20]\n    end\n    if <<(Checkpoint) = [0]> and <not <<(Collected) = [4]> or <(Collected) > [4]>>>> then\n        Clone At x: [1404] y: [180]\n    end\n    if <<(Checkpoint) = [0]> and <not <<(Collected) = [5]> or <(Collected) > [5]>>>> then\n        Clone At x: [1787] y: [180]\n    end\nelse\n    if <(Level) = [2]> then\n        switch costume to (coin v)\n        set [collected v] to [0]\n        if <not <<(Collected) = [1]> or <(Collected) > [1]>>> then\n            Clone At x: [156] y: [39]\n        end\n        if <not <<(Collected) = [2]> or <(Collected) > [2]>>> then\n            Clone At x: [412] y: [26]\n        end\n        if <not <<(Collected) = [3]> or <(Collected) > [3]>>> then\n            Clone At x: [681] y: [90]\n        end\n        if <not <<(Collected) = [4]> or <(Collected) > [4]>>> then\n            Clone At x: [1181] y: [122]\n        end\n        if <not <<(Collected) = [5]> or <(Collected) > [5]>>> then\n            Clone At x: [1878] y: [3]\n        end\n    else\n        if <(Level) = [3]> then\n            switch costume to (coin v)\n        end\n        set [x v] to [-99999]\n    end\n    set [x v] to [-99999]\nend\nset [x v] to [-99999]\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\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\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\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nchange [collect c. v] by (1)\n\nwhen flag clicked\nset [collected v] to [0]\n\n@Exit\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [clock v]\nPosition ((x) - (SCROLL X)) (((y) + ((5) * ([sin v] of (((x) + (TICK)) * (10)) ))) - (SCROLL Y))\nif <<<(costume [name v]) = [open]> and <touching (player v)?>> and <<(Level) = [1]> or <(Level) = [2]>>> then\n    start sound [modern-checkpoint v]\n    set [exit v] to [win]\nend\nif <<(Collected) = (Collected Max)> or <(Collected) > (Collected Max)>> then\n    switch costume to (open v)\nend\nif <<<(costume [name v]) = [open]> and <touching (player v)?>> and <(Level) = [3]>> then\n    broadcast (END GAME  v) and wait\nend\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 (closed v)\n    Clone At x: [3497] y: [45]\nelse\n    if <(Level) = [2]> then\n        switch costume to (closed v)\n        Clone At x: [2170] y: [30]\n    else\n        if <(Level) = [3]> then\n            switch costume to (closed v)\n            Clone At x: [2100] y: [90]\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)\ncreate clone of (_myself_ v)\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\ncreate clone of (_myself_ v)\nchange [x v] by (360)\nnext costume\n\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I receive [open portal v]\nswitch costume to (open v)\n\nswitch costume to (closed v)\nClone At x: [1400] y: [44]\n\nset [collected v] to [0]\n\n@Border\n\nwhen flag clicked\ngo to [front v] layer\n\n@GAMESTART\n\nwhen flag clicked\n\nwhen I receive [end intro v]\nbroadcast (Game On v) and wait\n\nbroadcast (end of menu v) and wait\n\n@Background\n\nwhen I receive [green flag v]\nshow\n\nwhen I receive [clock 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]\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]\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        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            Clone At x: [360] y: [0]\n            Clone At x: [360] 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\nwhen I start as a clone\nset [ghost v] effect to (50)\ngo to [back v] layer\n\n@LEFT\n\nwhen I receive [green flag v]\nhide\n\nwhen flag clicked\nshow\ngo to [front v] layer\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        broadcast (LEFT v) and wait\n    end\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        start sound [pop v]\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\n    if <touching (mouse-pointer v)?> then\n        change size by (((120) - (size)) / (3))\n        switch costume to (costume3 v)\n    else\n        switch costume to (costume2 v)\n        change size by (((100) - (size)) / (3))\n    end\nend\n\nwait (.1) seconds\n\nbroadcast (START_GAME v) and wait\n\n@RIGHT\n\nwhen I receive [green flag v]\nhide\n\nbroadcast (end intro v) and wait\n\nwhen flag clicked\ngo to [front v] layer\nshow\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        broadcast (Next v) and wait\n    end\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        start sound [pop v]\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\n    if <touching (mouse-pointer v)?> then\n        change size by (((120) - (size)) / (3))\n        switch costume to (costume3 v)\n    else\n        switch costume to (costume2 v)\n        change size by (((100) - (size)) / (3))\n    end\nend\n\nwait (.1) seconds\n\nhide\n\n@Play\n\nwhen flag clicked\nshow\n\nwhen I receive [end intro v]\nhide\n\nwhen flag clicked\nshow\ngo to [front v] layer\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        broadcast (costume v) and wait\n        broadcast (end intro v) and wait\n    end\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        start sound [pop v]\n        hide\n        broadcast (START_GAME v) and wait\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\n    if <touching (mouse-pointer v)?> then\n        change size by (((120) - (size)) / (3))\n        switch costume to (costume3 v)\n    else\n        switch costume to (costume2 v)\n        change size by (((100) - (size)) / (3))\n    end\nend\n\n@Player\n\ndefine Game-Win\nrepeat (50)\n    point towards (exit v)\n    turn right (65) degrees\n    move ((distance to [exit v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\npoint in direction (90)\nhide\nchange [level v] by (1)\nbroadcast (NewLevel v) and wait\nbroadcast (Setup v) and wait\nwait (1) seconds\n\nbroadcast (end intro v) and wait\n\nwhen I receive [blank v]\nswitch costume to (1 v)\n\nwhen I receive [eye v]\nswitch costume to (2 v)\n\nwhen I receive [eye 3 v]\nswitch costume to (3 v)\n\nwhen I receive [red v]\nswitch costume to (red v)\n\nwhen I receive [yellow v]\nswitch costume to (yellow v)\n\nwhen I receive [green v]\nswitch costume to (green v)\n\nwhen I receive [teal v]\nswitch costume to (blue v)\n\nwhen I receive [purple v]\nswitch costume to (purple v)\n\nwhen I receive [magenta v]\nswitch costume to (magenta? v)\n\nwhen flag clicked\nset [x v] to [0]\npoint in direction (90)\nhide\nset size to (100) %\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [game on v]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    set [tick v] to [0]\n    broadcast (Setup v) and wait\n    GameOn\n    repeat until <(EXIT) > []>\n        change [tick v] by (1)\n        Tick\n        broadcast (Clock v) and wait\n    end\n    if <(EXIT) = [win]> then\n        Game-Win\n    else\n        Game-die\n    end\nend\n\ndefine GameOn\nset [in air v] to [0]\nset [sy v] to [0]\nset [sx v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [exit v] to []\nset size to (100) %\nset [ghost v] effect to (0)\nshow\nif <(Level) = [1]> then\n    set [scroll x v] to [0]\n    set [scroll y v] to [0]\nelse\n    if <(Level) = [2]> then\n        set [scroll x v] to [0]\n        set [scroll y v] to [0]\n    else\n        if <(Level) = [3]> then\n            set [scroll x v] to [0]\n            set [scroll y v] to [0]\n        else\n        end\n    end\nend\n\nif <(Checkpoint) = [0]> then\n    set [x v] to [0]\n    set [y v] to [0]\n    set [scroll x v] to [0]\n    set [scroll y v] to [0]\nelse\nend\n\ndefine Tick\nif <not <key (any v) pressed?>> then\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)\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)\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 <(mouse y) > [0]>>> then\n    if <(in air) < [5]> then\n        set [sy v] to [14]\n    end\nend\nchange [sy v] by (-2)\nChange Player Y by: (sy)\nTest-die\nif <key (any v) pressed?> then\n    change [scroll x v] by (round (((x) - (SCROLL X)) / (20)))\nend\nif <not <key (any v) pressed?>> then\n    change [scroll x v] by (round (((x) - (SCROLL X)) / (15)))\nend\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (45)))\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\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> and <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>>> then\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> and <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>>> then\nif <touching (platforms v)?> then\n    point in direction (90)\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?> 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 Game-die\nset [scroll x v] to [0]\nset [exit v] to []\nrepeat (10)\n    change [ghost v] effect by (10)\n    change size by (2)\nend\nhide\nwait (0.5) seconds\n\ndefine Test-die\nif <touching ( lava  v)?> then\n    set [exit v] to [die]\nend\n\ndefine Game-Win\npoint in direction (90)\nhide\n\nwhen I receive [end intro v]\nbroadcast (Green Flag v) and wait\nshow\nbroadcast (Game On v) and wait\n\n@Costume Selection\n\nwhen flag clicked\nshow\nswitch costume to (costume1 v)\n\nwhen I receive [end intro v]\nhide\n\nwhen I receive [next v]\nnext\n\nwhen I receive [costume v]\nif <(costume [number v]) = [1]> then\n    broadcast (blank v) and wait\nend\nif <(costume [number v]) = [2]> then\n    broadcast (eye v) and wait\nend\nif <(costume [number v]) = [3]> then\n    broadcast (eye 3 v) and wait\nend\nif <(costume [number v]) = [4]> then\n    broadcast (red v) and wait\nend\nif <(costume [number v]) = [5]> then\n    broadcast (yellow v) and wait\nend\nif <(costume [number v]) = [6]> then\n    broadcast (green v) and wait\nend\nif <(costume [number v]) = [7]> then\n    broadcast (teal v) and wait\nend\nif <(costume [number v]) = [8]> then\n    broadcast (purple v) and wait\nend\nif <(costume [number v]) = [9]> then\n    broadcast (magenta v) and wait\nend\n\nwhen I receive [left v]\nback\n\nrepeat (9)\nend\n\nnext costume\n\ndefine back\nrepeat (5)\n    change [ghost v] effect by (20)\nend\nrepeat (8)\n    next costume\nend\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\n\nwhen flag clicked\ngo to [front v] layer\n\ndefine next\nrepeat (5)\n    change [ghost v] effect by (20)\nend\nnext costume\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\n\n@Select2\n\nwhen flag clicked\nshow\ngo to [front v] layer\n\nwhen I receive [end intro v]\nhide\n\nwhen flag clicked\nforever\n    point in direction ((([cos v] of ((tic) * (1.4)) ) * (5)) + (90))\n    change y by (([cos v] of ((tic) * (2.1)) ) * (1.4))\n    change size by (([cos v] of ((tic) * (1.4)) ) * (0.3))\n    change [tic v] by (2)\nend\n\n@Menu BG\n\nwhen flag clicked\nshow\n\nwhen I receive [end intro v]\nhide\n\n@Sprite1\n\n@Game End\n\nwhen flag clicked\nhide\n\nwhen I receive [end game  v]\nshow\nforever\n    go to [front v] layer\nend\n\n