cloned - a platformer

Instructions: - controls -\n[w] = jump\n[s] = stop\n\narrow key equivalents also work\n\n[r] = restart player\n[r] x2 = restart level\n\n[space] = clone\n\n3 clones per level\nclones have to be touching the level to stick\n\nkinda generic but i spent effort on it

@Stage\n\n@player\n\ndefine yay\nif <(y) < [0]> then\n    repeat until <not <touching color (#000000)?>>\n        change y by (1)\n    end\n    set [y v] to [0]\nelse\n    repeat until <not <touching color (#000000)?>>\n        change y by ((y) * (-1))\n    end\n    set [y v] to [0]\nend\n\nwhen I receive [reset v]\nset [rightisright? v] to [1]\nshow\nswitch costume to (1 v)\nset [y v] to [0]\nset [x v] to [0]\ngo to x: (-225) y: (-150)\nforever\n    go to [front v] layer\n    set [player x v] to (x position)\n    set [player y v] to (y position)\n    change [y v] by (-1)\n    if <<(rightisright?) = [1]> or <<(rightisright?) = [0]> and <<key (down arrow v) pressed?> or <key (s v) pressed?>>>> then\n        change [x v] by (1)\n    end\n    if <<(rightisright?) = [0]> or <<(rightisright?) = [1]> and <<key (s v) pressed?> or <key (down arrow v) pressed?>>>> then\n        change [x v] by (-1)\n    end\n    set [x v] to ((x) * (0.85))\n    change x by (x)\n    if <touching color (#000000)?> then\n        change y by (1)\n        if <touching color (#000000)?> then\n            change y by (1)\n            if <touching color (#000000)?> then\n                change y by (1)\n                if <touching color (#000000)?> then\n                    change y by (1)\n                    if <touching color (#000000)?> then\n                        change y by (1)\n                        if <touching color (#000000)?> then\n                            change y by (1)\n                            if <touching color (#000000)?> then\n                                if <touching color (#000000)?> then\n                                    change y by (1)\n                                    if <touching color (#000000)?> then\n                                        change y by (1)\n                                        if <touching color (#000000)?> then\n                                            change y by (-8)\n                                            change x by ((x) * (-1))\n                                            set [x v] to [0]\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (y)\n    if <touching color (#000000)?> then\n        yay\n    end\n    change y by (-1)\n    if <<touching color (#000000)?> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        set [y v] to [11]\n    end\n    change y by (1)\n    if <(x position) > [230]> then\n        broadcast (next v)\n        set [deaths per level v] to [0]\n        set [save slot v] to [1]\n        erase all\n        broadcast (reset v)\n    end\n    if <(y position) < [-178]> then\n        change [deaths per level v] by (1)\n        hide\n        wait (0.5) seconds\n        broadcast (reset v)\n    end\nend\n\ngo to x: (-225) y: (-150)\n\nwhen flag clicked\nset [deaths per level v] to [0]\nset [save slot v] to [1]\nerase all\nbroadcast (reset v)\n\nwait (0.5) seconds\n\nwhen [space v] key pressed\nif <not <(level) = [1]>> then\n    if <(save slot) < [4]> then\n        if <[-200] < (x position)> then\n            set [y \(clonedetection\) v] to [-0.8]\n            stop [other scripts in sprite v]\n            set [touching level \(clonedetection\) v] to [0]\n            repeat until <<(touching level \(clonedetection\)) = [1]> or <(y position) < [-163]>>\n                checksizetouching\n                if <(touching level \(clonedetection\)) = [0]> then\n                    change [y \(clonedetection\) v] by ((y \(clonedetection\)) / (3))\n                    change y by ((y \(clonedetection\)) * (0.5))\n                    moving up (clonedetection)\n                end\n            end\n            if <(touching level \(clonedetection\)) = [1]> then\n                change [save slot v] by (1)\n                stamp\n                broadcast (reset v)\n                wait until <not <key (space v) pressed?>>\n                wait (0.2) seconds\n            else\n                broadcast (reset v)\n                wait until <not <key (space v) pressed?>>\n                wait (0.2) seconds\n            end\n        end\n    end\nend\n\nwhen flag clicked\n\nwait (0.5) seconds\n\nwait (0.5) seconds\n\ndefine checksizetouching\nset [touching level \(clonedetection\) v] to [0]\nset size to (105) %\nchange y by (-1)\nif <touching color (#000000)?> then\n    change y by (1)\n    set [touching level \(clonedetection\) v] to [1]\n    stop [this script v]\nend\nchange x by (2)\nif <touching color (#000000)?> then\n    change y by (1)\n    set [touching level \(clonedetection\) v] to [1]\n    stop [this script v]\nend\nchange x by (-2)\nif <touching color (#000000)?> then\n    change y by (1)\n    set [touching level \(clonedetection\) v] to [1]\n    stop [this script v]\nend\nchange x by (-2)\nif <touching color (#000000)?> then\n    change y by (1)\n    set [touching level \(clonedetection\) v] to [1]\nend\nchange x by (2)\nchange y by (1)\nset size to (100) %\n\nwhen I receive [reset v]\nforever\n    if <key (r v) pressed?> then\n        wait until <not <key (r v) pressed?>>\n        reset timer\n        wait until <<key (r v) pressed?> or <[0.1] < (timer)>>\n        if <key (r v) pressed?> then\n            set [deaths per level v] to [0]\n            set [save slot v] to [1]\n            erase all\n            broadcast (reset v)\n            wait until <not <key (r v) pressed?>>\n        else\n            broadcast (reset v)\n        end\n    end\nend\n\ndefine moving up (clonedetection)\nrepeat until <not <touching color (#000000)?>>\n    change y by (0.5)\nend\n\nerase all\n\nwhen I receive [reset v]\nwait (0.1) seconds\nforever\n    if <touching color (#ff0000)?> then\n        if <(rightisright?) = [1]> then\n            set [rightisright? v] to [0]\n        else\n            set [rightisright? v] to [1]\n        end\n        wait until <not <touching color (#ff0000)?>>\n    end\nend\n\nstop [this script v]\n\n\n\n@level\n\nwhen I receive [next v]\nchange [level v] by (1)\nnext costume\n\nwhen flag clicked\nset [level v] to [1]\nswitch costume to (costume1 v)\nforever\n    switch costume to (level)\nend\n\nwhen [0 v] key pressed\nchange [level v] by (1)\n\n@messages\n\nwhen I receive [\[w\] \[a\] \[d\] win v]\nhide\nswitch costume to (wad win v)\nstop [other scripts in sprite v]\ndisplay [1000]\n\nwhen flag clicked\nset [gone through softlock tutorial? v] to [0]\nset [gone through counter tutorial? v] to [0]\nset [gone through clone in midair? v] to [0]\nset [reminder about stop? v] to [0]\nset [ghost v] effect to (100)\nhide\nbroadcast (\[w\] \[a\] \[d\] win v)\n\nwhen I receive [reset v]\nwait (0.1) seconds\nwait until <<<(level) = [2]> and <[-20] < (player x)>> and <(save slot) = [1]>>\nwait (0.5) seconds\nhide\nswitch costume to (space = clone v)\nstop [other scripts in sprite v]\ndisplay [1000]\n\n\n\nwhen I receive [reset v]\nwait (0.1) seconds\nwait until <<<(level) = [2]> and <[20] < (player x)>> and <[1] < (save slot)>>\nswitch costume to (nice job you'll be using v)\nstop [other scripts in sprite v]\ndisplay [0]\n\nwhen I receive [reset v]\nwait until <<(level) < [4]> and <(save slot) = [4]>>\nwait (0.4) seconds\nif <(gone through softlock tutorial?) = [0]> then\n    switch costume to (softlock v)\n    stop [other scripts in sprite v]\n    set [gone through softlock tutorial? v] to [1]\n    display [3]\nend\n\ndefine display (seconds)\nset [ghost v] effect to (100)\nhide\ngo to x: (0) y: (10000)\nshow\nrepeat (30)\n    change [ghost v] effect by (-5)\n    change y by (((0) - (y position)) / (5))\nend\nwait (seconds) seconds\nchange y by (0.5)\nrepeat (20)\n    change [ghost v] effect by (5)\n    change y by (((0) - (y position)) / (-5))\nend\nhide\n\nwhen I receive [reset v]\nwait (0.2) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\n    change y by (((0) - (y position)) / (-5))\nend\nhide\n\nwhen I receive [reset v]\nwait (0.1) seconds\nif <(gone through clone in midair?) = [0]> then\n    wait until <<<(level) = [3]> and <[-128] < (player x)>> and <[-100] < (player y)>>\n    switch costume to (cloning in midair v)\n    stop [other scripts in sprite v]\n    set [gone through clone in midair? v] to [0]\n    display [10]\nend\n\nwhen I receive [reset v]\nwait (0.1) seconds\nif <(reminder about stop?) = [0]> then\n    wait until <<(level) = [4]> and <[-30] < (player x)>>\n    switch costume to (remember \[a\]\[d\] v)\n    stop [other scripts in sprite v]\n    set [reminder about stop? v] to [1]\n    display [0]\nend\n\nwhen I receive [reset v]\nwait (0.1) seconds\nif <(gone through counter tutorial?) = [0]> then\n    wait until <(level) = [4]>\n    go to [front v] layer\n    switch costume to (clone counter v)\n    stop [other scripts in sprite v]\n    set [gone through counter tutorial? v] to [1]\n    display [1000]\nend\n\nwhen I receive [reset v]\nwait (0.1) seconds\nwait until <<<(level) = [4]> and <<[72] < (player x)> and <(player y) < [-10]>>> and <(save slot) = [4]>>\nswitch costume to (i think you ran out of clones v)\nstop [other scripts in sprite v]\ndisplay [2]\n\n@lives\n\nwhen flag clicked\nforever\n    switch costume to (save slot)\nend\n\nwhen flag clicked\ngo to [front v] layer\nset [ghost v] effect to (1000)\ngo to x: (0) y: (10000)\nwait (0.5) seconds\nwait until <(level) = [2]>\nrepeat (50)\n    change [ghost v] effect by (-2)\n    change y by (((0) - (y position)) / (5))\nend\n\n@thumb\n\nwhen flag clicked\nhide\n\ngo to [front v] layer\n\n