Stars, A Mobile Friendly Platformer

Instructions: Welcome to Plains 2 \n\nLava Plains OUT NOW                        \nhttps://scratch.mit.edu/projects/396651098\n\nPlains 2.5 OUT NOW\nhttps://scratch.mit.edu/projects/392049195\n\nCheck out Plains https://scratch.mit.edu/projects/390272486\n\nInstructions: Arrow keys or on mobile tap around.\nYou can walljump. Try to avoid spikes and lava. \n\nThere are currently 15 levels. \n\nThis is even harder and better version of Plains. \n\nCan we get 1 love!? O:\n\nMusic: Athletic Theme - Super Mario 3D Land OST\n\n### \n#games #h #platformer #mobile

@Stage\n\nwhen flag clicked\nswitch backdrop to (hills and sky3 v)\nclear graphic effects\nhide variable [level.completed v]\nhide variable [level v]\nhide variable [clones v]\nif <(username) = [mathias1706]> then\n    wait (2) seconds\nelse\n    wait (0.5) seconds\nend\nrepeat (50)\n    change [brightness v] effect by (-2)\nend\nswitch backdrop to (1 v)\nrepeat (25)\n    change [brightness v] effect by (4)\nend\nwait (1) seconds\nshow\nforever\n    wait until <(Level.Completed) = [1]>\n    repeat (25)\n        change [brightness v] effect by (-4)\n    end\n    switch backdrop to ((Level) + (1))\n    wait (2) seconds\n    repeat (25)\n        change [brightness v] effect by (4)\n    end\nend\n\n@Player\n\ndefine Controls - Left and Right\nset [x v] to ((X) * (0.7))\nif <key (left arrow v) pressed?> then\n    change [x v] by (-1.5)\nend\nif <key (right arrow v) pressed?> then\n    change [x v] by (1.5)\nend\n\ndefine Walk (direction) (speed) max steep (max steep)\npoint in direction (direction)\nchange x by (speed)\nchange [frame v] by (([abs v] of (speed) ) / (8))\nset [slope v] to [0]\nGet Touching <(In.Platform) = [1]>\nrepeat until <<(Slope) = (max steep)> or <(Touch) = [0]>>\n    change y by (1)\n    change [slope v] by (1)\n    Get Touching <(In.Platform) = [1]>\nend\nif <(Slope) = (max steep)> then\n    change x by ((0) - (speed))\n    change y by ((0) - (Slope))\n    if <<(Touch) = [1]> and <(In.Platform) = [1]>> then\n        set [in.platform v] to [2]\n        Walk (direction) (speed) max steep (max steep)\n        if <(X) = [0]> then\n            set [in.platform v] to [1]\n        end\n    else\n        if <<key (up arrow v) pressed?> and <<([abs v] of (speed) ) > [3.5]> and <(Touch) > [1]>>> then\n            set [x v] to ((-1.2) * (speed))\n            set [y v] to [11]\n            set [falling v] to [6]\n            set [wall.jump v] to [15]\n        else\n            set [x v] to [0]\n        end\n    end\nend\n\ndefine Controls - Jump, Crouch\nif <key (up arrow v) pressed?> then\n    if <<(Jump.Key) = [0]> and <(Falling) < [3]>> then\n        start sound [Jump v]\n        set [y v] to [14]\n        set [falling v] to [6]\n        set [jump.key v] to [1]\n    end\nelse\n    set [jump.key v] to [0]\nend\n\ndefine Check Hit Ceiling / Floor <up?>\nGet Touching \nif <(Touch) = [0]> then\n    set [in.platform v] to [1]\nelse\n    if <<up?> and <(Touch) = [1]>> then\n        set [in.platform v] to [2]\n    end\nend\nrepeat until <(Touch) < (In.Platform)>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling v] to [0]\n    end\n    Get Touching <not <up?>>\n    set [y v] to [0]\nend\n\ndefine Get Touching <check platform?>\nif <<<touching color (#39b54a)?> or <<touching color (#b9b9b9)?> or <touching color (#000000)?>>> or <touching color (#d06454)?>> then\n    set [touch v] to [9]\nelse\n    if <<check platform?> and <touching (platforms v)?>> then\n        set [touch v] to [1]\n    else\n        set [touch v] to [0]\n    end\nend\n\ndefine Gravity\nif <<(y) < [4]> or <key (up arrow v) pressed?>> then\n    change [y v] by (-1)\nelse\n    change [y v] by (-2)\nend\nchange y by (y)\nchange [falling v] by (1)\n\nwhen I start as a clone\nset size to (50) %\nswitch costume to (arrow1-a v)\nset [ghost v] effect to (100)\ngo to x: (225) y: (item (Level) of [y-2 v])\npoint in direction (90)\nshow\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nforever\n    wait until <(Clones) = [1]>\n    set size to (50) %\n    switch costume to (arrow1-a v)\n    go to x: (225) y: (item (Level) of [y-2 v])\n    show\n    repeat (10)\n        go to x: ((x position) - (1)) y: (y position)\n        wait (0) seconds\n        if <(Level) = [21]> then\n            hide\n        end\n    end\n    go to x: (215) y: (item (Level) of [y-2 v])\n    repeat (10)\n        go to x: ((x position) + (1)) y: (y position)\n        wait (0) seconds\n        if <(Level) = [21]> then\n            hide\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    if <<(Level.Completed) = [1]> and <(Clones) = [0]>> then\n        go to x: (0) y: (0)\n    end\n    if <<(Clones) = [1]> and <not <(Level) = [1]>>> then\n        repeat (5)\n            change [brightness v] effect by (20)\n        end\n        if <(Level) = [21]> then\n            set [clones v] to [0]\n            hide\n            stop all sounds\n            play sound [All Level Completed v] until done\n            reset timer\n            play sound [2 v] until done\n            set volume to (100) %\n            delete this clone\n        end\n        wait until <<(Level.Completed) = [1]> and <(Clones) = [0]>>\n    end\nend\n\nwhen I start as a clone\nforever\n    wait until <(Level.Completed) = [1]>\n    hide\n    go to x: (0) y: (0)\n    point in direction (90)\n    go to [front v] layer\n    switch costume to ((Level) + (1))\n    set size to (100) %\n    hide\n    wait (1) seconds\n    show\n    go to x: (0) y: (0)\n    set [brightness v] effect to (-100)\n    repeat (5)\n        change [brightness v] effect by (20)\n    end\n    wait (1.3) seconds\n    repeat (5)\n        change [brightness v] effect by (-20)\n    end\n    hide\n    wait (0.25) seconds\n    set [clones v] to [1]\n    wait (0.75) seconds\nend\n\nwhen flag clicked\nreset timer\nstart sound [1 v]\nset volume to (99) %\nhide\nset [ghost v] effect to (100)\nhide variable [x v]\nhide variable [y v]\nhide variable [falling v]\nhide variable [slope v]\nhide variable [in.platform v]\nhide variable [touch v]\nhide variable [frame v]\nhide variable [jump.key v]\nhide variable [wall.jump v]\nhide variable [speed y v]\nshow list [y v]\ndelete (all) of [y v]\nrepeat (5)\n    insert [-110] at (last) of [y v] \nend\nrepeat (4)\n    insert [150] at (last) of [y v] \nend\nrepeat (2)\n    insert [-110] at (last) of [y v] \nend\nrepeat (2)\n    insert [-150] at (last) of [y v] \nend\nrepeat (2)\n    insert [-110] at (last) of [y v] \nend\nrepeat (6)\n    insert [-150] at (last) of [y v] \nend\nshow list [y-2 v]\ndelete (all) of [y-2 v]\nrepeat (4)\n    insert [-105] at (last) of [y-2 v] \nend\ninsert [154] at (last) of [y-2 v] \ninsert [-90] at (last) of [y-2 v] \nrepeat (2)\n    insert [162] at (last) of [y-2 v] \nend\ninsert [-25] at (last) of [y-2 v] \ninsert [162] at (last) of [y-2 v] \ninsert [-80] at (last) of [y-2 v] \nrepeat (2)\n    insert [150] at (last) of [y-2 v] \nend\ninsert [100] at (last) of [y-2 v] \nrepeat (6)\n    insert [-15] at (last) of [y-2 v] \nend\nwait (3.5) seconds\nset [clones v] to [1]\nset [level v] to [1]\nset [level.completed v] to [0]\ncreate clone of (_myself_ v)\nset size to (50) %\ngo to x: (-217) y: (-110)\npoint in direction (90)\nshow\nswitch costume to (costume1 v)\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nforever\n    switch costume to (costume1 v)\n    go to [front v] layer\n    show\n    Controls - Jump, Crouch\n    Gravity\n    Check Hit Ceiling / Floor <(y) > [0]>\n    if <(Wall.Jump) > [0]> then\n        change [wall.jump v] by (-1)\n    else\n        Controls - Left and Right\n    end\n    if <(X) < [-0.5]> then\n        Walk (-90) (X) max steep (([ceiling v] of ([abs v] of ((X) * (1.3)) ) ) + (1))\n    else\n        if <(X) > [0.5]> then\n            Walk (90) (X) max steep (([ceiling v] of ([abs v] of ((X) * (1.3)) ) ) + (1))\n        else\n            set [frame v] to [0]\n        end\n    end\n    if <<(x position) > [210]> and <touching color (#ee2a7b)?>> then\n        start sound [Level Completed v]\n        wait (0.1) seconds\n        change [level v] by (1)\n        set [level.completed v] to [1]\n        set [clones v] to [0]\n        repeat (25)\n            change [brightness v] effect by (-4)\n        end\n        wait (2) seconds\n        go to x: (-225) y: (item (Level) of [y v])\n        point in direction (90)\n        set [level.completed v] to [0]\n        repeat (25)\n            change [brightness v] effect by (4)\n        end\n    end\n    if <(y position) < [-180]> then\n        start sound [Death v]\n        repeat (5)\n            change [ghost v] effect by (20)\n        end\n        go to x: (-225) y: (item (Level) of [y v])\n        point in direction (90)\n        Check Hit Ceiling / Floor <(y) > [0]>\n        wait (0.2) seconds\n        repeat (5)\n            change [ghost v] effect by (-20)\n        end\n    end\n    if <(X) > [5]> then\n        set [x v] to [5]\n    end\n    if <<(timer) > [81.6]> and <(volume) = [99]>> then\n        stop all sounds\n        start sound [2 v]\n        reset timer\n        set volume to (100) %\n    end\n    if <(timer) > [121.2]> then\n        stop all sounds\n        start sound [2 v]\n        reset timer\n    end\nend\n\n