Platformer

Instructions: Hi, \nthis is a platformer there are 20 level \nmovement for palyer\nup key:jump\nright key: move right\nleft key: move left\n\navoid toching lava or lava spike as the level go level gets harder and harder.Its not very hard.\n\n\n  

@Stage\n\n@Player\n\nwhen I receive [makeplayerfollowhitbox v]\ngo to (hitbox v)\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset rotation style [left-right v]\npoint in direction (90)\nforever\n    if <key (right arrow v) pressed?> then\n        switch costume to ((costume [number v]) + (1))\n        point in direction (90)\n    else\n        if <key (left arrow v) pressed?> then\n            switch costume to ((costume [number v]) - (1))\n        else\n            switch costume to (costume1 v)\n        end\n    end\n    wait (0.04) seconds\nend\n\nwhen flag clicked\nif <touching color (#9966ff)?> then\n    repeat (16)\n        change y by (10)\n    end\n    repeat (16)\n        change x by (-10)\n    end\nend\n\n@hitbox\n\nwhen flag clicked\nshow\nset size to (50) %\nset [spawnx v] to [-203]\nset [spawny v] to [63]\ngo to x: (spawnX) y: (spawnY)\nset rotation style [left-right v]\nset [xvelocity v] to [0]\nset [yvelocity v] to [0]\nset [ghost v] effect to (100)\nforever\n    broadcast (makeplayerfollowhitbox v)\n    up/down movement [12] [-1]\n    right/left movement [10] [0.6]\n    checknextlevel\nend\n\ndefine up/down movement (jump height) (fall speed)\nchange y by (yvelocity)\nif <touching (level v)?> then\n    repeat ([ceiling v] of ([abs v] of (yvelocity) ) )\n        if <touching (level v)?> then\n            checktouchinglava\n            change y by (((yvelocity) / ([abs v] of (yvelocity) )) * (-1))\n        end\n    end\n    if <<not <(yvelocity) > [50]>> and <key (up arrow v) pressed?>> then\n        set [yvelocity v] to (jump height)\n    else\n        set [yvelocity v] to [0]\n    end\nelse\n    change [yvelocity v] by (fall speed)\nend\n\ndefine right/left movement (move speed) (drag)\nchange x by (xvelocity)\nif <touching (level v)?> then\n    checktouchinglava\n    repeat ([ceiling v] of ([abs v] of (xvelocity) ) )\n        if <touching (level v)?> then\n            checktouchinglava\n            change x by (((xvelocity) / ([abs v] of (xvelocity) )) * (-1))\n        end\n    end\n    set [xvelocity v] to [0]\nend\nif <key (right arrow v) pressed?> then\n    set [xvelocity v] to (move speed)\nelse\n    if <key (left arrow v) pressed?> then\n        set [xvelocity v] to ((move speed) * (-1))\n    end\nend\nset [xvelocity v] to ((xvelocity) * (drag))\n\ndefine checknextlevel\nif <(x position) > [235]> then\n    broadcast (next level v)\n    go to x: (spawnX) y: (spawnY)\nend\n\ndefine checktouchinglava\nif <touching color (#ff0000)?> then\n    go to x: (spawnX) y: (spawnY)\nend\n\ndefine checktouchingspike\nif <touching color (#a9a9a9)?> then\n    go to x: (spawnX) y: (spawnY)\nend\n\nwhen flag clicked\nforever\n    if <touching color (#9966ff)?> then\n        repeat (16)\n            change y by (10)\n        end\n        repeat (16)\n            change y by (-10)\n        end\n    end\nend\n\nwhen flag clicked\n\n\n@Level\n\nwhen flag clicked\nset [level v] to [1]\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\n\nwhen I receive [next level v]\nchange [level v] by (1)\nnext costume\n\n@Sprite1\n\nwhen flag clicked\nforever\n    show\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n