Spray 2 - A Scrolling Platformer

Instructions: Controls:\n----------------------------------------\n• Click/tap and hold to spray water. Water will propel you in the opposite direction that it is sprayed\n• Avoid spikes and fire\n• Spray water on fire to put it out\n• Activate checkpoints by touching them\n• Use the slider at the bottom right of the screen to look \n  ahead or behind you\n• Press the 'R' to restart and the 'S' to skip to the next \n  checkpoint\n\nNotes:\n----------------------------------------\n• I apologize if the game lags, I can't seem to fix it\n• The entire game is possible\n• There may be some platforming glitches considering \n   the fact that I transfered my old engine and made it \n   scrolling\n• You can play the original game here: \n   https://scratch.mit.edu/projects/306411745/\n• This may reduce lag but have some glitches: \n   https://forkphorus.github.io/#331917417\n• Made using my Samsung Galaxy Tab s4\n\nCredits:\n----------------------------------------\n• All programming and art by @Skill_Games\n• Music is called "Yo Picasso" by Verified Picasso\n\nTags:\n----------------------------------------\n#game #games #platformer #scrolling #scrollingplatformer #spray #2 #two #2019 #spray2 #spraytwo #fun #quality #challenge #challenging #difficult #hard

@Stage\n\nwhen flag clicked\nset [sin v] to [0]\nforever\n    change [sin v] by (5)\n    set [trig v] to ([sin v] of (Sin) )\nend\n\nwhen I receive [fire v]\nset [sin v] to [0]\n\nwhen flag clicked\nforever\n    play sound [Yo_Picasso v] until done\nend\n\n@Player\n\nwhen flag clicked\ngo to x: (-200) y: (-85)\nset [sx v] to [0]\nset [offset v] to [0]\nset [level v] to [1]\nbroadcast (playerStart v)\n\ngo to x: (-200) y: (-85)\n\nif <not <(Y vel) < [-6]>> then\n\ndefine Move <upward>\nswitch costume to (hitbox4 v)\nchange y by (Y vel)\nrepeat until <not <touching (stage v)?>>\n    if <upward> then\n        switch costume to (hitbox3 v)\n        if <touching (stage v)?> then\n            change y by (-1)\n            set [y vel v] to [0]\n        end\n    else\n        set [y vel v] to (Y vel)\n        change y by (1)\n    end\nend\nif <not <upward>> then\n    change y by (-1)\nend\nswitch costume to (costume1 v)\n\nsay <upward>\n\n\n\nchange y by (Y vel)\n\nwhen flag clicked\n\nif <touching (checkpoint v)?> then\n\ngo to x: (-200) y: (-85)\n\nif <touching (stage v)?> then\n\n\n\nsay [Hello!]\n\nchange x by (X vel)\nif <touching (stage v)?> then\n    repeat (8)\n        if <touching (stage v)?> then\n            change y by (1)\n        end\n    end\n    if <touching (stage v)?> then\n        change x by ((0) - (X vel))\n    end\nend\nswitch costume to (hitbox2 v)\nchange y by (Y vel)\nif <touching (stage v)?> then\n    if <[.05] < ([abs v] of (X vel) )> then\n        if <[0] < (X vel)> then\n            change [x vel v] by (-.1)\n        else\n            change [x vel v] by (.1)\n        end\n    else\n        set [x vel v] to [0]\n    end\nend\nrepeat until <not <touching (stage v)?>>\n    if <[0] < (Y vel)> then\n        change y by (-1)\n    else\n        set [y vel v] to [0]\n        change y by (1)\n    end\nend\nif <[0] < (Y vel)> then\n    change y by (1)\nelse\n    change y by (-1)\nend\nswitch costume to (costume1 v)\n\nswitch costume to (hitbox v)\nif <<touching (stage v)?> or <touching (_edge_ v)?>> then\n    set [x vel v] to [0]\n    if <[0] < (X vel)> then\n        repeat until <not <touching (stage v)?>>\n            change x by (1)\n        end\n    else\n        repeat until <not <touching (stage v)?>>\n            change x by (-1)\n        end\n        change x by (1)\n    end\nend\nswitch costume to (costume1 v)\n\nchange x by (-1)\n\nsay <(Y vel) < [0]>\n\nif <touching (stage v)?> then\n    switch costume to (hitbox v)\n    if <not <touching (stage v)?>> then\n        switch costume to (hitbox2 v)\n    end\nend\n\nif <touching (stage v)?> then\n\ndefine Move X\nswitch costume to (costume1 v)\nchange y by (1)\nchange x by (X vel)\nset [ycount v] to [0]\nrepeat (8)\n    if <touching (stage v)?> then\n        change y by (1)\n        change [ycount v] by (1)\n    end\nend\nif <touching (stage v)?> then\n    change y by ((0) - (Ycount))\n    set [ycount v] to [0]\n    repeat (8)\n        if <touching (stage v)?> then\n            set [y vel v] to [0]\n            change y by (-1)\n            change [ycount v] by (-1)\n        end\n    end\nend\nif <touching (stage v)?> then\n    change y by ((0) - (Ycount))\n    repeat until <not <touching (stage v)?>>\n        change x by ((0) - (X vel))\n    end\n    set [x vel v] to [0]\nelse\n    change y by (-1)\n    if <touching (stage v)?> then\n        set [x vel v] to ((X vel) / (1.05))\n    end\nend\nswitch costume to (costume1 v)\n\nif <touching (stage v)?> then\n    set [ycount v] to [0]\n    repeat (8)\n        change y by (-1)\n        change [ycount v] by (1)\n    end\nend\n\nif <touching (stage v)?> then\n    repeat until <not <touching (stage v)?>>\n        change x by ((0) - (X vel))\n    end\n    set [x vel v] to [0]\nend\n\nchange y by (Ycount)\n\nif <touching (stage v)?> then\n\n\n    change y by (10)\nend\n\nset [level v] to [9]\n\nchange [edge v] by (1)\n\nwhen flag clicked\n\nwhen I receive [playerstart v]\nset [y vel v] to [0]\nset [x vel v] to [0]\nset [spraying v] to [0]\nforever\n    if <(Looking) = [0]> then\n        if <not <touching (stage v)?>> then\n            if <(Spraying) = [0]> then\n                change [y vel v] by (-.7)\n            end\n        end\n        Move <[0] < (Y vel)>\n        Move X\n        if <(x position) < [-220]> then\n            set x to (-220)\n        end\n    end\n    if <(Y vel) < [-15]> then\n        set [y vel v] to [-15]\n    end\n    if <[15] < (Y vel)> then\n        set [y vel v] to [15]\n    end\n    if <(X vel) < [-15]> then\n        set [x vel v] to [-15]\n    end\n    if <[15] < (X vel)> then\n        set [x vel v] to [15]\n    end\nend\n\nwhen I receive [playerstart v]\nforever\n    if <<touching (spikes v)?> or <<touching (fire v)?> or <<key (r v) pressed?> or <touching (darkspikes v)?>>>> then\n        Die ([sqrt v] of ((((item (Checkpoint) of [cy v]) - (y position)) * ((item (Checkpoint) of [cy v]) - (y position))) + (((item (Checkpoint) of [cx v]) - (Sx)) * ((item (Checkpoint) of [cx v]) - (Sx)))) ) (Sx) (y position)\n        set [y vel v] to [0]\n        set [x vel v] to [0]\n        set [spraying v] to [0]\n        broadcast (Fire v)\n    end\n    if <touching (_edge_ v)?> then\n        set [y vel v] to ([sqrt v] of (Y vel) )\n    end\nend\n\nwhen I receive [playerstart v]\nforever\n    if <(Looking) = [0]> then\n        set [xpos v] to (x position)\n        if <[0] < (x position)> then\n            if <not <[4800] < (Sx)>> then\n                change [sx v] by (x position)\n                set x to (0)\n            end\n        end\n        if <(x position) < [0]> then\n            if <[0] < (Sx)> then\n                change [sx v] by (x position)\n                set x to (0)\n            end\n        end\n    else\n        if <<[480] < (Sx)> or <[0] = (Sx)>> then\n            set x to (((0) - (Offset)) + (Xpos))\n            if <not <(x position) = (((0) - (Offset)) + (Xpos))>> then\n                hide\n            else\n                show\n            end\n        else\n            set x to ((0) - (Offset))\n        end\n    end\nend\n\ndefine Die (dist) (sx) (sy)\nstop [other scripts in sprite v]\nset [distcount v] to [0]\nset [ghost v] effect to (50)\nrepeat ([sqrt v] of (dist) )\n    change [distcount v] by (1)\n    go to [front v] layer\n    change [sx v] by (((item (Checkpoint) of [cx v]) - (sx)) / ([sqrt v] of (dist) ))\n    change y by (((item (Checkpoint) of [cy v]) - (sy)) / ([sqrt v] of (dist) ))\nend\nset [ghost v] effect to (0)\nbroadcast (playerStart v)\n\nchange [distcount v] by (1)\n\nset y to (-77)\n\nset [sx v] to [0]\n\nsay [Hello!]\n\nsay [Hello!]\n\nsay ((((item (Checkpoint) of [cx v]) - (sx)) / ((dist) / (4))) * ((dist) / (4))) for (2) seconds\n\nwhen I receive [playerstart v]\n\nforever\n    if <key (space v) pressed?> then\n        set [looking v] to [1]\n        if <[0] < (mouse x)> then\n            if <(Offset) < (mouse x)> then\n                set [offset v] to (mouse x)\n            end\n        else\n            if <(mouse x) < (Offset)> then\n                set [offset v] to (mouse x)\n            end\n        end\n    else\n        set [offset v] to [0]\n        wait (.05) seconds\n        set [looking v] to [0]\n    end\nend\n\n\n\nchange [offset v] by ([sqrt v] of (() - (Offset)) )\n\nchange [offset v] by ((0) - ([sqrt v] of (() - (Offset)) ))\n\nset [offset v] to [0]\n\nswitch costume to (hitbox4 v)\n\nchange [check v] by (1)\n\nchange x by ((0) - (X vel))\n\nchange y by (1)\n\nwhen I receive [skip v]\nset x to (0)\nchange [checkpoint v] by (1)\nset [sx v] to (item (Checkpoint) of [cx v])\nset y to (item (Checkpoint) of [cy v])\nbroadcast (Fire v)\n\nwhen I receive [restart v]\nset [sx v] to (item (Checkpoint) of [cx v])\nset y to (item (Checkpoint) of [cy v])\nbroadcast (Fire v)\n\nchange [checkpoint v] by (1)\n\nchange x by (X vel)\n\nif  then\nend\nset [y vel v] to [0]\nset [x vel v] to [0]\nset [spraying v] to [0]\nchange [level v] by (1)\nbroadcast (Fire v)\n\nif <[0] < (Y vel)> then\nend\n\nchange x by ((0) - ((X vel) + (1)))\n\nif <[0] < (X vel)> then\n    change x by (-.5)\nelse\n    change x by (.5)\nend\n\nif  then\n\nset [y vel v] to [0]\n\nif <(X vel) < [5]> then\nelse\n    repeat until <not <touching (stage v)?>>\n        change x by (-5)\n        if <[0] < (X vel)> then\n            repeat until <not <touching (stage v)?>>\n                change x by (-5)\n            end\n            set [x vel v] to [0]\n        else\n            repeat until <not <touching (stage v)?>>\n                change x by (5)\n            end\n            set [x vel v] to [0]\n        end\n    end\n    set [x vel v] to [0]\nend\n\nif <[0] < (X vel)> then\nend\n\n@Stage\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\nClone\n\ndefine Clone\nswitch costume to (costume1 v)\nrepeat (11)\n    create clone of (_myself_ v)\n    next costume\nend\n\nset [sid v] to [0]\n\nrepeat (3)\n    change [sid v] by (1)\n    create clone of (_myself_ v)\n    next costume\nend\n\nwhen I start as a clone\nshow\nset [ox v] to [0]\nforever\n    set x to ((((480) * ((costume [number v]) - (1))) - (Sx)) - (Offset))\n    set [ox v] to ((((480) * ((costume [number v]) - (1))) - (Sx)) - (Offset))\n    if <not <(x position) = (Ox)>> then\n        hide\n    else\n        show\n    end\nend\n\nshow\nset [ox v] to [0]\nforever\n    switch costume to (([floor v] of (((Sx) + (240)) / (480)) ) + ((3) - (Sid)))\n    set x to ((((480) * ((costume [number v]) - (1))) - (Sx)) - (Offset))\n    set [ox v] to ((((480) * ((costume [number v]) - (1))) - (Sx)) - (Offset))\n    if <not <(x position) = (Ox)>> then\n        hide\n    else\n        show\n    end\nend\n\n@Sprite1\n\nwhen flag clicked\nshow\nforever\n    go to (player v)\n    point towards (mouse-pointer v)\n    move (30) steps\n    go to [front v] layer\n    if <(Looking) = [0]> then\n        show\n    else\n        hide\n    end\nend\n\nif <(Moving) = [1]> then\n    go to (player v)\n    set [plx v] to (x position)\n    set [ply v] to (y position)\n    point towards (mouse-pointer v)\n    move (30) steps\nelse\n    if <(Moving) = [2]> then\n        go to (player v)\n        set [plx v] to (x position)\n        go to x: (Plx) y: (Ply)\n        point towards (mouse-pointer v)\n        move (30) steps\n    else\n        go to x: (Plx) y: (Ply)\n        point towards (mouse-pointer v)\n        move (30) steps\n    end\nend\n\nwhen flag clicked\n\nforever\n    set [check v] to (Y vel)\n    set [checkx v] to (X vel)\n    wait (.1) seconds\n    if <(Check) = (Y vel)> then\n        if <not <(Checkx) = (X vel)>> then\n            set [moving v] to [2]\n        else\n            set [moving v] to [0]\n        end\n    else\n        set [moving v] to [1]\n    end\nend\n\nset [ply v] to (y position)\n\ngo to (player v)\n\n@Sprite2\n\nwhen flag clicked\nset [edge v] to [0]\nshow\nset [ghost v] effect to (100)\nset [progress v] to [0]\nforever\n    point towards (mouse-pointer v)\n    go to (player v)\n    if <mouse down?> then\n        if <(Looking) = [0]> then\n            Spray\n        end\n    else\n        set [spraying v] to [0]\n        set [progress v] to [0]\n        erase all\n    end\nend\n\ndefine Spray\npen up\nset pen color to (#73dfff)\nset pen size to (3)\nif <(Progress) < [500]> then\n    change [progress v] by (60)\nend\nFind ground\ngo to (player v)\npoint towards (mouse-pointer v)\nerase all\npen down\nmove (Edge) steps\npen up\nClone\n\ndefine Find ground\npoint towards (mouse-pointer v)\ngo to (player v)\nif <touching (_edge_ v)?> then\n    move (10) steps\nend\nset [i v] to [0]\nrepeat until <<touching (_edge_ v)?> or <<<touching (stage v)?> or <<touching (spikes v)?> or <touching (darkspikes v)?>>> or <(Progress) < (i)>>>\n    change [i v] by (20)\n    move (20) steps\nend\nrepeat until <not <<touching (stage v)?> or <touching (spikes v)?>>>\n    move (-1) steps\n    change [i v] by (-1)\nend\nchange [edge v] by (1)\nif <(Progress) < (i)> then\n    set [i v] to (Progress)\nend\nset [edge v] to (i)\nmove (3) steps\nif <<touching (stage v)?> or <<touching (_edge_ v)?> or <touching (spikes v)?>>> then\n    if <((6) * (480)) < (Sx)> then\n        if <touching (darkspikes v)?> then\n            set [spraying v] to [0]\n        else\n            Physics ([x position v] of [player v]) (x position) ([y position v] of [player v]) (y position)\n        end\n    else\n        Physics ([x position v] of [player v]) (x position) ([y position v] of [player v]) (y position)\n    end\nend\n\ndefine Clone\ngo to (player v)\npoint towards (mouse-pointer v)\nrepeat (round ((Edge) / (15)))\n    move (15) steps\n    if <(pick random (1) to (5)) = [1]> then\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I start as a clone\nset [ghost v] effect to (0)\ngo to [back v] layer\nshow\nset size to (pick random (80) to (120)) %\npoint in direction (pick random (-180) to (180))\nrepeat (10)\n    move (1) steps\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\n\nsay [Hello!]\n\ndefine Physics (x1) (x2) (y1) (y2)\nset [xchange v] to ((x1) - (x2))\nset [ychange v] to ((y1) - (y2))\nchange [y vel v] by (((Ychange) / (([abs v] of (Xchange) ) + ([abs v] of (Ychange) ))) * (.5))\nset [spraying v] to [1]\nchange [x vel v] by (((Xchange) / (([abs v] of (Xchange) ) + ([abs v] of (Ychange) ))) * (.3))\n\nset [xchange v] to [Hi]\n\nif  then\n\n@Spikes\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\nClone\n\ndefine Clone\nswitch costume to (xcostume1 v)\nrepeat (10)\n    create clone of (_myself_ v)\n    next costume\nend\n\nwhen I start as a clone\nif <(letter (1) of (costume [name v])) = [X]> then\n    delete this clone\nend\nshow\nset [ox v] to [0]\nforever\n    go to [front v] layer\n    set x to ((((480) * ((costume [number v]) - (1))) - (Sx)) - (Offset))\n    set [ox v] to ((((480) * ((costume [number v]) - (1))) - (Sx)) - (Offset))\n    if <not <(x position) = (Ox)>> then\n        hide\n    else\n        show\n    end\nend\n\n\n\n@Text\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\nClone\n\ndefine Clone\nswitch costume to (costume1 v)\nrepeat (11)\n    create clone of (_myself_ v)\n    next costume\nend\n\n\n\nwhen I start as a clone\nif <(letter (1) of (costume [name v])) = [X]> then\n    delete this clone\nend\nshow\nset [ox v] to [0]\nforever\n    go to [back v] layer\n    set x to ((((480) * ((costume [number v]) - (1))) - (Sx)) - (Offset))\n    set [ox v] to ((((480) * ((costume [number v]) - (1))) - (Sx)) - (Offset))\n    if <not <(x position) = (Ox)>> then\n        hide\n    else\n        show\n    end\nend\n\ngo to [back v] layer\n\n@Checkpoint\n\nforever\n\nnext costume\n\nwhen I start as a clone\n\nwhen flag clicked\nhide\nset [checkpoint v] to [0]\nset [clid v] to [0]\nrepeat (length of [cy v])\n    change [clid v] by (1)\n    create clone of (_myself_ v)\nend\n\ndelete all of [cx v]\ndelete all of [cy v]\n\nadd (Sx) to [cx v]\nadd (([y position v] of [player v]) + (20)) to [cy v]\n\nwhen I start as a clone\nswitch costume to (costume1 v)\nset [ghost v] effect to (30)\nforever\n    set x to (((item (Clid) of [cx v]) - (Sx)) - (Offset))\n    set y to (item (Clid) of [cy v])\n    set [olx v] to (((item (Clid) of [cx v]) - (Sx)) - (Offset))\n    if <(x position) = (Olx)> then\n        show\n    else\n        hide\n    end\nend\n\nswitch costume to (costume12 v)\n\nwhen I start as a clone\nforever\n    if <not <(costume [number v]) = [12]>> then\n        switch costume to (costume1 v)\n        repeat (10)\n            if <not <(costume [number v]) = [12]>> then\n                next costume\n                wait (0) seconds\n            end\n        end\n        switch costume to (costume11 v)\n        wait (0) seconds\n        repeat (10)\n            if <not <(costume [number v]) = [12]>> then\n                switch costume to ((costume [number v]) - (1))\n                wait (0) seconds\n            end\n        end\n    end\nend\n\nset x to (36)\n\nswitch costume to (costume1 v)\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        if <not <(costume [number v]) = [12]>> then\n            if <<(Checkpoint) < (Clid)> or <(Checkpoint) = (Clid)>> then\n                set [checkpoint v] to (Clid)\n                repeat (10)\n                    change [ghost v] effect by (10)\n                end\n                switch costume to (costume12 v)\n                stop [other scripts in sprite v]\n                repeat (10)\n                    change [ghost v] effect by (-10)\n                    set x to (((item (Clid) of [cx v]) - (Sx)) - (Offset))\n                    set y to (item (Clid) of [cy v])\n                    set [olx v] to (((item (Clid) of [cx v]) - (Sx)) - (Offset))\n                    if <(x position) = (Olx)> then\n                        show\n                    else\n                        hide\n                    end\n                end\n                forever\n                    set x to (((item (Clid) of [cx v]) - (Sx)) - (Offset))\n                    set y to (item (Clid) of [cy v])\n                    set [olx v] to (((item (Clid) of [cx v]) - (Sx)) - (Offset))\n                    if <(x position) = (Olx)> then\n                        show\n                    else\n                        hide\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [skip v]\n\n\n\n\n\nstop [other scripts in sprite v]\n\nset x to (((item (Clid) of [cx v]) - (Sx)) - (Offset))\nset y to (item (Clid) of [cy v])\nset [olx v] to (((item (Clid) of [cx v]) - (Sx)) - (Offset))\nif <(x position) = (Olx)> then\n    show\nelse\n    hide\nend\n\nforever\n    say (((item (Clid) of [cx v]) - (Sx)) - (Offset))\n    set x to (((item (Clid) of [cx v]) - (Sx)) - (Offset))\n    set y to (item (Clid) of [cy v])\n    set [olx v] to (((item (Clid) of [cx v]) - (Sx)) - (Offset))\n    if <(x position) = (Olx)> then\n        show\n    else\n        hide\n    end\nend\n\nwait (.02) seconds\nif <not <(costume [number v]) = [12]>> then\n    if <(Checkpoint) = (Clid)> then\n        set [checkpoint v] to (Clid)\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        switch costume to (costume12 v)\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n    end\nend\n\nsay [Hello!]\n\n@Look\n\nwhen flag clicked\nswitch costume to (costume1 v)\ngo to x: (180) y: (-160)\ncreate clone of (_myself_ v)\nswitch costume to (costume2 v)\ngo to [front v] layer\nforever\n    set x to (180)\n    set [offset v] to [0]\n    set [looking v] to [0]\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (20)\n        if <mouse down?> then\n            repeat until <not <mouse down?>>\n                set [looking v] to [1]\n                if <[180] < (mouse x)> then\n                    if <(mouse x) < [210]> then\n                        set x to (mouse x)\n                    else\n                        set x to (210)\n                    end\n                else\n                    if <[145] < (mouse x)> then\n                        set x to (mouse x)\n                    else\n                        set x to (145)\n                    end\n                end\n                if <not <(((((x position) - (180)) / (45)) * (240)) + (Sx)) < [0]>> then\n                    if <not <[4800] < (((((x position) - (180)) / (45)) * (240)) + (Sx))>> then\n                        set [offset v] to ((((x position) - (180)) / (45)) * (240))\n                    else\n                        set [offset v] to ((0) - ((Sx) - (4800)))\n                    end\n                else\n                    set [offset v] to ((0) - (Sx))\n                end\n            end\n            set [offset v] to [0]\n            wait (.05) seconds\n            set [looking v] to [0]\n        end\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nforever\n\nset [offset v] to [0]\nset x to ((180) - (((32) / (240)) * (Sx)))\n\nset x to (180)\n\n@Fire\n\nforever\n\nnext costume\n\nwhen I start as a clone\n\nwhen flag clicked\nhide\nset [checkpoint v] to [0]\nset [clid v] to [0]\nrepeat (length of [fx v])\n    change [clid v] by (1)\n    create clone of (_myself_ v)\nend\nbroadcast (Fire v)\nset [clid v] to [0]\n\nforever\n    if <(Clid) < (length of [fx v])> then\n        change [clid v] by (1)\n        create clone of (_myself_ v)\n        broadcast (Fire v)\n    end\nend\n\ndelete all of [fx v]\ndelete all of [fy v]\n\nadd (Sx) to [fx v]\nadd ([y position v] of [player v]) to [fy v]\n\nwhen I start as a clone\n\ndelete this clone\n\nswitch costume to (costume12 v)\n\nwhen I start as a clone\n\nset x to (36)\n\nswitch costume to (costume1 v)\n\nwhen I start as a clone\n\nforever\n    if <touching (player v)?> then\n        if <not <(costume [number v]) = [12]>> then\n            if <(Checkpoint) < (Clid)> then\n                set [checkpoint v] to (Clid)\n                repeat (10)\n                    change [ghost v] effect by (10)\n                end\n                switch costume to (costume12 v)\n                stop [other scripts in sprite v]\n                repeat (10)\n                    change [ghost v] effect by (-10)\n                    set x to (((item (Clid) of [cx v]) - (Sx)) - (Offset))\n                    set y to (item (Clid) of [cy v])\n                    set [olx v] to (((item (Clid) of [cx v]) - (Sx)) - (Offset))\n                    if <(x position) = (Olx)> then\n                        show\n                    else\n                        hide\n                    end\n                end\n                forever\n                    set x to (((item (Clid) of [cx v]) - (Sx)) - (Offset))\n                    set y to (item (Clid) of [cy v])\n                    set [olx v] to (((item (Clid) of [cx v]) - (Sx)) - (Offset))\n                    if <(x position) = (Olx)> then\n                        show\n                    else\n                        hide\n                    end\n                end\n            end\n        end\n    end\nend\n\nset size to (100) %\n\nwhen I receive [fire v]\nif <not <(Clid) = [0]>> then\n    stop [other scripts in sprite v]\n    set size to (100) %\n    hide\n    set [ghost v] effect to (100)\n    wait (.05) seconds\n    if <(item (Clid) of [cx v]) < (item (Clid) of [fx v])> then\n        show\n        repeat (10)\n            set x to (((item (Clid) of [fx v]) - (Sx)) - (Offset))\n            set y to (item (Clid) of [fy v])\n            set [olx v] to (((item (Clid) of [fx v]) - (Sx)) - (Offset))\n            change [ghost v] effect by (-10)\n            if <(x position) = (Olx)> then\n                show\n                change size by (Trig)\n                if <touching (sprite2 v)?> then\n                    repeat (10)\n                        set x to (((item (Clid) of [fx v]) - (Sx)) - (Offset))\n                        set y to (item (Clid) of [fy v])\n                        set [olx v] to (((item (Clid) of [fx v]) - (Sx)) - (Offset))\n                        change [ghost v] effect by (10)\n                    end\n                    hide\n                    stop [this script v]\n                end\n            else\n                hide\n            end\n        end\n        forever\n            set x to (((item (Clid) of [fx v]) - (Sx)) - (Offset))\n            set y to (item (Clid) of [fy v])\n            set [olx v] to (((item (Clid) of [fx v]) - (Sx)) - (Offset))\n            if <(x position) = (Olx)> then\n                show\n                change size by (Trig)\n                if <touching (sprite2 v)?> then\n                    repeat (10)\n                        set x to (((item (Clid) of [fx v]) - (Sx)) - (Offset))\n                        set y to (item (Clid) of [fy v])\n                        set [olx v] to (((item (Clid) of [fx v]) - (Sx)) - (Offset))\n                        change [ghost v] effect by (10)\n                    end\n                    hide\n                    stop [this script v]\n                end\n            else\n                hide\n            end\n        end\n    end\nend\n\nif <not <(Olx) = (((item (Clid) of [fx v]) - (Sx)) - (Offset))>> then\nend\n\nhide\n\nstop [this script v]\n\n@DarkSpikes\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\nClone\n\ndefine Clone\nswitch costume to (xcostume1 v)\nrepeat (10)\n    create clone of (_myself_ v)\n    next costume\nend\n\nwhen I start as a clone\nif <(letter (1) of (costume [name v])) = [X]> then\n    delete this clone\nend\nshow\nset [ox v] to [0]\nforever\n    go to [front v] layer\n    set x to ((((480) * ((costume [number v]) - (1))) - (Sx)) - (Offset))\n    set [ox v] to ((((480) * ((costume [number v]) - (1))) - (Sx)) - (Offset))\n    if <not <(x position) = (Ox)>> then\n        hide\n    else\n        show\n    end\nend\n\n\n\n@Buttons\n\nwhen flag clicked\nswitch costume to (costume1 v)\ngo to x: (147) y: (-173)\ncreate clone of (_myself_ v)\nchange x by (49)\nswitch costume to (costume2 v)\nforever\n    if <touching (mouse-pointer v)?> then\n        if <(Looking) = [0]> then\n            set [brightness v] effect to (20)\n            if <mouse down?> then\n                if <touching (mouse-pointer v)?> then\n                    broadcast (Restart v)\n                end\n                wait until <not <mouse down?>>\n            end\n        end\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\ngo to x: <not <mouse down?>> y: (28)\n\nwhen I start as a clone\nforever\n    if <touching (mouse-pointer v)?> then\n        if <(Looking) = [0]> then\n            set [brightness v] effect to (20)\n            if <mouse down?> then\n                if <touching (mouse-pointer v)?> then\n                    broadcast (Skip v)\n                end\n                wait until <not <mouse down?>>\n            end\n        end\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nchange y by (-15)\n\nsay (x position)\n\nwhen I receive [skip v]\n\nchange [checkpoint v] by (.5)\nset [sx v] to (item (Checkpoint) of [cx v])\n\nchange y by (item (Checkpoint) of [cy v])\n\nbroadcast (Skip v) and wait\n\nwhen flag clicked\nforever\n    if <key (r v) pressed?> then\n        broadcast (Restart v)\n        wait until <not <key (r v) pressed?>>\n    end\n    if <key (s v) pressed?> then\n        broadcast (Skip v)\n        wait until <not <key (s v) pressed?>>\n    end\n    if <(length of [cx v]) < (Checkpoint)> then\n        set [checkpoint v] to (length of [cx v])\n        broadcast (Restart v)\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\n\n