almost a king (platformer)

Instructions: instruction in game\ntouch the rotating white square thingy to go to next level.\n=========================================\nUPDATE: \nthe game is updated because of multiple comment saying that the game is too hard. \nP to skin a level\nthe movement now are faster but more controllable\n=========================================\nUPDATE: almost a king is a mobile game now making it so that people can enjoy the game wherever they are. the old man will always point towards the finger and move for mobile mode. \n

@Stage\n\nwhen flag clicked\nforever\n    switch backdrop to (level)\n    if <(level) = [11]> then\n        switch backdrop to (backdrop10 v)\n    end\nend\n\nwhen flag clicked\nforever\n    play sound [Kevin MacLeod \[Official\] - Blip Stream - incompetech v] until done\nend\n\nwhen flag clicked\nset volume to (10) %\nrepeat (90)\n    change volume by (1)\nend\n\n@sprite sheet\n\n@player\n\ndefine platformer (speed) (friction) (jump) (gravity)\nswitch costume to (hitbox v)\nif <touching (ladders v)?> then\n    set [x v] to ((x) * (friction))\n    set [y v] to ((<<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> * (2)) + (<<<key (s v) pressed?> or <key (down arrow v) pressed?>> or <<mouse down?> and <(y position) > (mouse y)>>> * (-2)))\n    change y by (y)\n    if <touching (platform v)?> then\n        repeat until <not <touching (platform v)?>>\n            change y by ((([abs v] of (y) ) / (y)) * (-1))\n        end\n    end\nelse\n    change [y v] by (gravity)\n    change y by (y)\n    if <touching (platform v)?> then\n        repeat until <not <touching (platform v)?>>\n            change y by ((([abs v] of (y) ) / (y)) * (-1))\n        end\n        set [y v] to ((jump) * <<<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> and <(([abs v] of (y) ) / (y)) = [-1]>>)\n    end\nend\nset [x v] to ((friction) * ((x) + ((<<<key (d v) pressed?> or <key (right arrow v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> * (speed)) + (<<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(x position) > (mouse x)>>> * ((speed) * (-1))))))\nchange x by (x)\nif <touching (platform v)?> then\n    repeat until <not <touching (platform v)?>>\n        change x by ((([abs v] of (x) ) / (x)) * (-1))\n    end\n    if <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n        if <not <touching (ladders v)?>> then\n            set [x v] to ((([abs v] of (x) ) / (x)) * (-11))\n            set [y v] to (jump)\n        end\n    end\nend\nposition (round (x position)) ((round (y position)) + (50))\nif <touching (next level v)?> then\n    broadcast (next v)\n    stop [this script v]\nend\nif <touching (death v)?> then\n    broadcast (death v)\n    stop [this script v]\nend\nif <touching (spikes v)?> then\n    broadcast (death v)\n    stop [this script v]\nend\nif <touching (ladders v)?> then\n    switch costume to (climb v)\nelse\n    switch costume to (hitbox 2 v)\n    if <touching (platform v)?> then\n        switch costume to (costume)\n    else\n        switch costume to (jump v)\n    end\nend\npoint in direction ((<(x) > [0]> * (90)) + (<[0] > (x)> * (-90)))\n\ndefine position (x) (y)\nchange [scroll x v] by (x)\nchange [scroll y v] by (y)\ngo to x: (0) y: (-50)\nbroadcast (position v)\n\nwhen flag clicked\nforever\n    if <([abs v] of ([floor v] of (x) ) ) > [1]> then\n        change [costume v] by (1)\n        if <(costume) = [8]> then\n            set [costume v] to [4]\n        end\n        wait (0.07) seconds\n    else\n        set [costume v] to [3]\n    end\nend\n\nwhen I receive [refresh v]\nset size to (300) %\nset rotation style [left-right v]\nset [scroll x v] to [-238]\nset [scroll y v] to [-690]\nset [x v] to [0]\nset [y v] to [0]\nforever\n    platformer [1] [0.8] [11] [-0.8]\nend\n\nwhen I receive [next v]\nchange [level v] by (1)\nbroadcast (refresh v)\n\nwhen I receive [death v]\nbroadcast (refresh v)\n\nwhen flag clicked\nshow\nset [level v] to [1]\nbroadcast (refresh v)\n\nwhen I receive [win v]\nhide\nwait (0) seconds\nstop [other scripts in sprite v]\n\nwhen I receive [death v]\nplay sound [Crunch v] until done\n\nwhen I receive [next v]\nplay sound [Coin v] until done\n\nwhen I receive [skip v]\nset [scroll x v] to [-238]\nset [scroll y v] to [-690]\nbroadcast (refresh v)\n\nwhen flag clicked\nforever\n    if <key (p v) pressed?> then\n        change [level v] by (1)\n        broadcast (skip v)\n        wait until <not <key (p v) pressed?>>\n    end\nend\n\n@platform\n\nwhen I receive [position v]\ngo to x: ((scroll x) * (-1)) y: ((scroll y) * (-1))\n\nwhen I receive [refresh v]\nshow\nswitch costume to (hack v)\nset size to (500) %\nswitch costume to ((level) + (1))\n\nwhen I receive [win v]\nhide\nwait (0) seconds\nstop [other scripts in sprite v]\n\n@spikes\n\nwhen I receive [position v]\ngo to x: ((scroll x) * (-1)) y: ((scroll y) * (-1))\n\nwhen I receive [refresh v]\nshow\nswitch costume to (hack v)\nset size to (500) %\nswitch costume to ((level) + (1))\n\nwhen I receive [win v]\nhide\nwait (0) seconds\nstop [other scripts in sprite v]\n\n@ladders\n\nwhen I receive [position v]\ngo to x: ((scroll x) * (-1)) y: ((scroll y) * (-1))\n\nwhen I receive [refresh v]\nshow\nswitch costume to (hack v)\nset size to (500) %\nswitch costume to ((level) + (1))\ngo to [back v] layer\ngo [backward v] (5) layers\n\nwhen I receive [win v]\nhide\nwait (0) seconds\nstop [other scripts in sprite v]\n\n@background\n\nwhen I receive [position v]\ngo to [back v] layer\ngo to x: (((scroll x) * (0.4)) * (-1)) y: (((scroll y) * (0.4)) * (-1))\n\nwhen I receive [refresh v]\nshow\nswitch costume to (hack v)\nset size to (500) %\nswitch costume to ((level) + (1))\n\nwhen I receive [win v]\nhide\nwait (0) seconds\nstop [other scripts in sprite v]\n\n@text\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\ndefine if position is in... up right: (x1) (y1) down left: (x2) (y2) then set text to (#)\nset [text v] to [0]\nif <<<(scroll x) > (x2)> or <(scroll x) = (y2)>> and <<(x1) > (scroll x)> or <(scroll x) = (x1)>>> then\n    if <<<(scroll y) > (y2)> or <(scroll y) = (y2)>> and <<(y1) > (scroll y)> or <(scroll y) = (y1)>>> then\n        set [text v] to (#)\n    end\nend\n\nwhen I receive [refresh v]\nshow\nif <(level) = [1]> then\n    forever\n        if position is in... up right: [196] [-550] down left: [-259] [-734] then set text to [1]\n    end\nend\nif <(level) = [2]> then\n    forever\n        if position is in... up right: [196] [-550] down left: [-259] [-734] then set text to [2]\n    end\nend\nif <(level) = [3]> then\n    forever\n        if position is in... up right: [-328] [-556] down left: [-596] [-771] then set text to [3]\n    end\nend\nif <(level) = [4]> then\n    forever\n        if position is in... up right: [82] [-630] down left: [-406] [-711] then set text to [4]\n    end\nend\nif <(level) = [5]> then\n    forever\n        if position is in... up right: [310] [-630] down left: [-419] [-746] then set text to [5]\n    end\nend\nif <(level) = [6]> then\n    forever\n        if position is in... up right: [293] [-560] down left: [-429] [-774] then set text to [6]\n    end\nend\n\nset [level v] to [4]\n\nwhen I receive [win v]\nhide\nwait (0) seconds\nstop [other scripts in sprite v]\n\nwhen [timer v] > (0.01)\nset [level v] to [1]\nhide\n\nwhen I receive [refresh v]\nset [transitioned yet? v] to [no]\nforever\n    if <not <(level) > [6]>> then\n        show\n        if <not <(text) = [0]>> then\n            if <(transitioned yet?) = [no]> then\n                switch costume to (text)\n                show\n                set [ghost v] effect to (100)\n                repeat (5)\n                    change [ghost v] effect by (-20)\n                end\n                set [transitioned yet? v] to [yes]\n            end\n        else\n            if <(transitioned yet?) = [yes]> then\n                set [ghost v] effect to (0)\n                repeat (5)\n                    change [ghost v] effect by (20)\n                end\n                hide\n                set [transitioned yet? v] to [no]\n            end\n            hide\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <(level) > [6]> then\n        hide\n    end\nend\n\n@next level\n\nwhen I receive [position v]\ngo to x: ((checkpoint x) - (scroll x)) y: ((checkpoint y) - (scroll y))\n\nwhen flag clicked\nforever\n    turn right (5) degrees\n    wait (0) seconds\nend\n\nwhen flag clicked\nforever\n    if <touching (_edge_ v)?> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [refresh v]\nshow\nswitch costume to (costume2 v)\nset rotation style [all around v]\ngo to x: (500) y: (500)\npoint in direction (90)\nset size to (100) %\nif <(level) = [1]> then\n    set [checkpoint x v] to [-12]\n    set [checkpoint y v] to [-175]\nend\nif <(level) = [2]> then\n    set [checkpoint x v] to [818]\n    set [checkpoint y v] to [-520]\nend\nif <(level) = [3]> then\n    set [checkpoint x v] to [-891]\n    set [checkpoint y v] to [-546]\nend\nif <(level) = [4]> then\n    set [checkpoint x v] to [-293]\n    set [checkpoint y v] to [-295]\nend\nif <(level) = [5]> then\n    set [checkpoint x v] to [-126]\n    set [checkpoint y v] to [-215]\nend\nif <(level) = [6]> then\n    set [checkpoint x v] to [-335]\n    set [checkpoint y v] to [390]\nend\nif <(level) = [7]> then\n    set [checkpoint x v] to [207]\n    set [checkpoint y v] to [5]\nend\nif <(level) = [8]> then\n    set [checkpoint x v] to [-524]\n    set [checkpoint y v] to [-256]\nend\nif <(level) = [9]> then\n    set [checkpoint x v] to [328]\n    set [checkpoint y v] to [115]\nend\nif <(level) = [10]> then\n    set [checkpoint x v] to [-635]\n    set [checkpoint y v] to [413]\nend\n\n@death\n\nwhen I receive [position v]\ngo to x: ((scroll x) * (-1)) y: ((scroll y) * (-1))\n\nwhen flag clicked\nshow\nswitch costume to (hack v)\nset size to (500) %\nswitch costume to (costume2 v)\nset [ghost v] effect to (100)\n\nwhen I receive [win v]\nhide\nwait (0) seconds\nstop [other scripts in sprite v]\n\n@effect\n\nwhen flag clicked\nswitch costume to (costume1 v)\nshow\ngo to x: (0) y: (0)\ngo to [front v] layer\nhide\n\nwhen I receive [death v]\nswitch costume to (costume1 v)\nset [brightness v] effect to (0)\nshow\nset [ghost v] effect to (0)\nwait (0.4) seconds\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nhide\n\nwhen I receive [next v]\nswitch costume to (costume1 v)\nset [brightness v] effect to (100)\nshow\nset [ghost v] effect to (0)\nwait (0.4) seconds\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nhide\n\nwhen I receive [win v]\nhide\nwait (0) seconds\nstop [other scripts in sprite v]\n\nwhen flag clicked\nforever\n    if <(level) = [11]> then\n        broadcast (win v)\n    end\nend\n\nwhen flag clicked\nforever\n    reset timer\nend\n\nwhen [timer v] > (0.01)\nset [level v] to [1]\nswitch costume to (thumbnail v)\nshow\n\n@buttons\n\nwhen flag clicked\nhide\n\nwait until <mouse down?>\nwait until <not <mouse down?>>\nswitch costume to (costume1 v)\ngo to x: (150) y: (-80)\ncreate clone of (_myself_ v)\nnext costume\ngo to x: (150) y: (-130)\ncreate clone of (_myself_ v)\nnext costume\ngo to x: (-120) y: (-130)\ncreate clone of (_myself_ v)\nnext costume\ngo to x: (-170) y: (-130)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset size to (200) %\nshow\nforever\n    if <(costume [number v]) = [1]> then\n        if <<mouse down?> and <touching (mouse-pointer v)?>> then\n            set [up v] to [1]\n        else\n            set [up v] to [0]\n        end\n    end\n    if <(costume [number v]) = [2]> then\n        if <<mouse down?> and <touching (mouse-pointer v)?>> then\n            set [down v] to [1]\n        else\n            set [down v] to [0]\n        end\n    end\n    if <(costume [number v]) = [3]> then\n        if <<mouse down?> and <touching (mouse-pointer v)?>> then\n            set [right v] to [1]\n        else\n            set [right v] to [0]\n        end\n    end\n    if <(costume [number v]) = [4]> then\n        if <<mouse down?> and <touching (mouse-pointer v)?>> then\n            set [left v] to [1]\n        else\n            set [left v] to [0]\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    go to [front v] layer\nend\n\nwhen flag clicked\nforever\n    hide\nend\n\n@skip\n\nwhen flag clicked\nset size to (200) %\nhide\nwait until <mouse down?>\ngo to x: (180) y: (150)\nswitch costume to (costume3 v)\nshow\nforever\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        wait until <not <mouse down?>>\n        if <touching (mouse-pointer v)?> then\n            change [level v] by (1)\n            broadcast (refresh v)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\nwhen [timer v] > (0.01)\nhide\n\n