Runner man - platformer

Instructions: WASD, Space, Arrow keys or touch to move the player.\nRed bad\nPurple good, sometimes\nrainbow good

@Stage\n\nwhen flag clicked\nbroadcast (ResetPlayer v)\nset [time v] to [0]\nforever\n    if <[17] > (Level)> then\n        change [time v] by (timer)\n    end\n    if <[17] > (Level)> then\n        hide variable [time v]\n    else\n        show variable [time v]\n    end\n    reset timer\nend\n\nwhen [timer v] > (1)\nbroadcast (Show.Thumbnail v)\nhide variable [time v]\n\nwhen flag clicked\nforever\n    play sound [cherry v] until done\nend\n\n@Hitbox\n\nwhen I receive [resetplayer v]\ngo to x: (-200) y: (-75)\nset [ghost v] effect to (100)\nset size to (75) %\nshow\nset [player.costume v] to [1]\nset [player.direction v] to [r]\nset [player.xv v] to [0]\nset [player.yv v] to [0]\nset [player.jumpforce v] to [12]\nset [player.walljumpxforce v] to [10]\nset [player.walljumpyforce v] to [12]\nforever\n    set [player.ycoll v] to [0]\n    set [player.wall v] to [0]\n    switch costume to (hitbox v)\n    go to [front v] layer\n    ChangeXv\n    change x by (player.xv)\n    CheckForCollosion\n    if <(Collision) = [1]> then\n        set [player.yv v] to ((player.yv) * (0.85))\n        if <(player.xv) > [0]> then\n            set [player.wall v] to [right]\n        else\n            set [player.wall v] to [left]\n        end\n        CheckForWall [5]\n    end\n    ChangYv\n    change y by (player.yv)\n    CheckForCollosion\n    if <(Collision) = [1]> then\n        ChangeY ((player.yv) / ([abs v] of (player.yv) ))\n    end\n    if <<<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> or <mouse down?>> and <not <(player.ycoll) = [ceiling]>>> then\n        JumpCheck\n    end\n    set [player.x v] to (x position)\n    set [player.y v] to (y position)\n    if <(y position) < [-170]> then\n        broadcast (ResetPlayer v)\n        broadcast (Sound.Death v)\n    end\n    if <((round ((player.xv) * (10))) / (10)) = [0]> then\n        set [player.xv v] to [0]\n    end\n    change [player.costume v] by (([abs v] of (player.xv) ) / (6))\n    if <(player.costume) > [16]> then\n        set [player.costume v] to [1]\n    end\n    if <(player.xv) = [0]> then\n        set [player.costume v] to [17]\n    end\n    if <(player.ycoll) = [0]> then\n        set [player.costume v] to [2]\n    end\n    switch costume to (player.direction)\nend\n\ndefine CheckForWall (length)\nrepeat (length)\n    CheckForCollosion\n    if <(Collision) = [1]> then\n        change y by (1)\n    end\nend\nCheckForCollosion\nif <(Collision) = [1]> then\n    change y by (() - (length))\n    if <(player.xv) > [0]> then\n        ChangeX ([ceiling v] of ((player.xv) / ([abs v] of (player.xv) )) )\n    else\n        ChangeX ([floor v] of ((player.xv) / ([abs v] of (player.xv) )) )\n    end\nend\n\ndefine ChangeY (power)\nif <(power) > [0]> then\n    set [player.ycoll v] to [ceiling]\nelse\n    set [player.ycoll v] to [ground]\nend\nrepeat ([abs v] of (player.yv) )\n    CheckForCollosion\n    if <(Collision) = [1]> then\n        change y by (() - (power))\n    end\nend\nset [player.yv v] to [0]\n\ndefine ChangeX (power)\nrepeat ([abs v] of (player.xv) )\n    CheckForCollosion\n    if <(Collision) = [1]> then\n        change x by (() - (power))\n    end\nend\nset [player.xv v] to [0]\n\ndefine ChangeXv\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<(Player.X) > (mouse x)> and <mouse down?>>> then\n    change [player.xv v] by (-1)\n    set [player.direction v] to [l]\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<(mouse x) > (Player.X)> and <mouse down?>>> then\n    change [player.xv v] by (1)\n    set [player.direction v] to [r]\nend\nset [player.xv v] to ((player.xv) * (0.875))\n\ndefine ChangYv\nchange [player.yv v] by (-1)\nif <not <(player.yv) > [-20]>> then\n    set [player.yv v] to [-20]\nend\n\ndefine JumpCheck\nif <(player.ycoll) = [ground]> then\n    broadcast (Jump v)\n    change [player.yv v] by (player.jumpforce)\nelse\n    if <(player.wall) = [right]> then\n        change [player.xv v] by (() - (player.WallJumpXForce))\n        set [player.yv v] to (player.WallJumpYForce)\n    end\n    if <(player.wall) = [left]> then\n        change [player.xv v] by (player.WallJumpXForce)\n        set [player.yv v] to (player.WallJumpYForce)\n    end\nend\n\ndefine CheckForCollosion\nset [collision v] to [0]\nif <touching (level v)?> then\n    set size to (90) %\n    if <touching color (#ff3030)?> then\n        broadcast (ResetPlayer v)\n        broadcast (Sound.Death v)\n    else\n        if <touching color (#8c4fec)?> then\n            set [player.yv v] to ((player.jumpforce) * (1.35))\n            broadcast (Bounce v)\n            if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> or <mouse down?>> then\n                change [player.yv v] by ((player.jumpforce) * (0.2))\n            end\n        else\n            set [collision v] to [1]\n        end\n    end\n    set size to (75) %\nend\n\nwhen I receive [show.thumbnail v]\nhide\n\n@RunnerMan\n\nwhen I receive [show.thumbnail v]\nhide\n\nwhen I receive [resetplayer v]\nshow\nforever\n    go to x: ((Player.X) + (0)) y: ((Player.Y) + (28))\n    set [color v] effect to (100)\n    set [ghost v] effect to (0)\n    if <(clone) = [1]> then\n        switch costume to (costume1 v)\n        set [ghost v] effect to (15)\n        go to [back v] layer\n        set size to (125) %\n        change y by (-10)\n    else\n        switch costume to (join (join [run_] (player.direction)) (round (player.costume)))\n        set [brightness v] effect to (25)\n        go to [front v] layer\n        set size to (75) %\n    end\nend\n\nwhen flag clicked\nset [clone v] to [0]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset [clone v] to [1]\n\n@Level\n\nwhen flag clicked\nset [level v] to [1]\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\nend\n\n@Finish\n\nwhen I receive [show.thumbnail v]\nhide\n\nwhen I receive [resetplayer v]\nshow\nforever\n    go to [back v] layer\n    go [forward v] (1) layers\n    switch costume to (costume2 v)\n    if <touching (hitbox v)?> then\n        broadcast (ResetPlayer v)\n        broadcast (LevelFinish v)\n        switch costume to (costume1 v)\n        if <(Level) < [17]> then\n            change [level v] by (1)\n        end\n        wait until <(Player.X) < [0]>\n    end\n    turn right (2) degrees\n    go to x: (200) y: (-60)\n    change [color v] effect by (0.5)\n    switch costume to (costume1 v)\nend\n\n@Thumbnail\n\nwhen I receive [show.thumbnail v]\nshow\ngo to [front v] layer\nswitch costume to (thumbnail v)\ngo to x: (0) y: (0)\n\nwhen flag clicked\nhide\n\n@Sound\n\nwhen I receive [bounce v]\nstart sound [Boing v]\n\nwhen I receive [jump v]\nstart sound [jump v]\n\nwhen I receive [levelfinish v]\nstart sound [Magic Spell v]\n\nwhen I receive [sound.death v]\nstart sound [Roblox Death Sound - OOF Sound Effect v]\n\n