!!MOBILE FRIENDLY!! Infinite Platformer

Instructions: BUG FIX 101: Fixed spike spawning, impossible level and other glitches!\nThanks to @TCTC112 for getting me to fix these!\n! Infinite Platformer !\n!!MOBILE FRIENDLY!!\nhi aj\n\nTry to get the high score!\nThe current highscorer: @colorjuice\n\nLeft arrow key/A to move left. Right arrow key/D to move right. Up arrow key/W to jump. M to toggle music. R to restart\n\nLava, mobs and more will be added soon!\nPlatformer engine free to use!

@Stage\n\nwhen flag clicked\nset [press v] to [0]\nset volume to (100) %\nswitch backdrop to (backdrop2 v)\nwait (5) seconds\nswitch backdrop to (backdrop1 v)\nforever\n    play sound [Unlimited v] until done\n    if <<key (m v) pressed?> and <(press) = [0]>> then\n        set volume to (0) %\n        change [press v] by (1)\n    end\n    if <<key (m v) pressed?> and <(press) = [1]>> then\n        set volume to (100) %\n        change [press v] by (-1)\n    end\nend\n\n@Level Generator \n\ndefine Render\nshow\ngo to x: (-232) y: (-172)\nerase all\nset [height v] to (pick random (3) to (4))\nrepeat (30)\n    switch costume to (stone v)\n    repeat (Height)\n        switch costume to (pick random (6) to (pick random (6) to (pick random (6) to (8))))\n        stamp\n        change y by (16)\n    end\n    switch costume to (dirt v)\n    repeat (2)\n        stamp\n        change y by (16)\n    end\n    switch costume to (grass v)\n    stamp\n    change y by (16)\n    if <(pick random (1) to (5)) = [1]> then\n        switch costume to (pick random (1) to (pick random (1) to (2)))\n        stamp\n    end\n    if <(pick random (1) to (8)) = [1]> then\n        switch costume to (spikes v)\n        if <<(costume [number v]) = [3]> and <(x position) = [-216]>> then\n            erase all\n            Render\n        end\n        stamp\n    end\n    change x by (16)\n    set y to (-172)\n    set [height v] to ((Height) + (pick random (-1) to (1)))\nend\nhide\n\nwhen flag clicked\nerase all\nhide\nwait (5) seconds\nRender\n\nwhen I receive [new level v]\nRender\n\n@Player\n\nwhen flag clicked\nhide\nwait (5) seconds\nshow\npoint in direction (90)\ngo to x: (-216) y: (55)\nswitch costume to (costume1 v)\nset [yvel v] to [0]\nset [xvel v] to [0]\nforever\n    change [yvel v] by (-0.5)\n    set [xvel v] to ((Xvel) * (0.9))\n    change x by (Xvel)\n    if <touching color (#94ff8a)?> then\n        change x by ((0) - (Xvel))\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(x position) > (mouse x)>>> then\n        change [xvel v] by (-0.7)\n    end\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(x position) < (mouse x)>>> then\n        change [xvel v] by (0.7)\n    end\n    change y by (Yvel)\n    if <touching color (#94ff8a)?> then\n        change y by ((0) - (Yvel))\n        set [yvel v] to ((-0.0) * (0.8))\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(y position) < (mouse y)>>> then\n            change [yvel v] by (8)\n        end\n    end\n    if <(x position) = [240]> then\n        broadcast (new level v)\n        change [level v] by (1)\n        go to x: (-216) y: (55)\n    end\n    if <key (r v) pressed?> then\n        go to x: (-216) y: (55)\n    end\n    if <touching color (#a3a3a3)?> then\n        go to x: (-216) y: (55)\n    end\nend\n\n@Logo\n\nwhen flag clicked\nhide\n\nshow\nset size to (130) %\ngo to [front v] layer\n\n@Level Counter\n\nwhen flag clicked\nwait (5) seconds\nset size to (450) %\ngo to x: (213) y: (154)\nhide\nset [level v] to [1]\nset [clones v] to [0]\nforever\n    if <(length of (Level)) > (Clones)> then\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I start as a clone\nshow\nchange [clones v] by (1)\nset [id v] to (Clones)\nchange x by (([abs v] of (ID) ) * (-12))\nforever\n    switch costume to (join [n] (letter (((length of (Level)) + (1)) - (ID)) of (Level)))\n    if <(length of (Level)) < (ID)> then\n        change [clones v] by (-1)\n        delete this clone\n    end\nend\n\n@Intro\n\nwhen flag clicked\nset volume to (100) %\nstart sound [Plugged \(post mastering\) v]\nwait (2) seconds\nforever\n    change volume by (-1.1)\nend\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\nset size to (200) %\ngo to [front v] layer\nset [bounce v] to [0]\npoint in direction (90)\ngo to x: (240) y: (0)\nwait (0.5) seconds\nshow\nrepeat (50)\n    change x by ((((x position) * (0.1)) - (((x position) * (0.1)) * (2))) + (0.1))\n    turn right (((((x position) * (0.1)) - (((x position) * (0.1)) * (2))) + (0.1)) * (1.68)) degrees\nend\nwait (0.5) seconds\nrepeat (2)\n    set [bounce v] to [7]\n    repeat (10)\n        change size by (Bounce)\n        change [bounce v] by (-1.5)\n        turn right (Bounce) degrees\n    end\n    set [bounce v] to [5]\n    repeat (10)\n        change size by (Bounce)\n        change [bounce v] by (-1.5)\n        turn left (Bounce) degrees\n    end\nend\nrepeat (10)\n    change size by (Bounce)\n    change [bounce v] by (-1.5)\n    turn left (Bounce) degrees\nend\nhide\nwait (1) seconds\nbroadcast (END v)\n\nwhen flag clicked\nforever\n    next costume\nend\n\n@High Score\n\nwhen I receive [new level v]\nif <(Level) > (☁ High score)> then\n    set [☁ high score v] to (Level)\nend\n\nwhen flag clicked\nhide variable [☁ high score v]\nset [☁ high score v] to (☁ High score)\n\nwhen I start as a clone\nshow\nforever\n    switch costume to (letter (number of digits) of (☁ High score))\n    if <(length of (☁ High score)) < (number of digits)> then\n        delete this clone\n    end\nend\n\nset x to (((40) * (number of digits)) + (-40))\n\nwhen flag clicked\nhide\nwait (5) seconds\nset [☁ high score v] to (☁ High score)\nset [number of digits v] to [0]\ngo to x: (0) y: (154)\nforever\n    if <(number of digits) < (length of (☁ High score))> then\n        change [number of digits v] by (1)\n        change x by (17)\n        create clone of (_myself_ v)\n    end\n    if <(length of (☁ High score)) < (number of digits)> then\n        change [number of digits v] by (-1)\n    end\nend\n\n