Frictionless - Platformer

Instructions: New NinjaRun™ game is out!\n4TH] https://scratch.mit.edu/projects/363781866/\nV2Pin] Check this regularly for updates. ↓↓↓↓↓↓↓↓↓↓↓\n1] ↓↓↓↓↓↓↓↓↓↓↓\nNEW] https://scratch.mit.edu/projects/362769436/\n2] ↓↓↓↓↓↓↓↓↓↓↓\n\nNote: This is my platforming engine, I made this from scratch, and used my own.\n3] ↓↓↓↓↓↓↓↓↓↓↓\nNew music on all official NinjaRun™ games!

@Stage\n\nwhen flag clicked\nswitch backdrop to (empty v)\n\nwhen flag clicked\nhide\nforever\n    if <(level) > [31]> then\n        broadcast (THE END :\) v)\n        set [collect coins v] to [0]\n        stop [this script v]\n    end\nend\n\n@Blank\n\n@player\n\nwhen I receive [go v]\nwait (.3) seconds\nif <(already loved/faved?) = [yes]> then\n    switch costume to (cake skin v)\nend\n\nwhen I receive [the end :\) v]\nstop [other scripts in sprite v]\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [the end :\) v]\nstop [other scripts in sprite v]\nhide\n\nwhen I start as a clone\ngo to [back v] layer\nswitch costume to (clone v)\nset size to (70) %\nset [ghost v] effect to (0)\nrepeat (10)\n    change [ghost v] effect by (10)\n    change size by (-10)\nend\ndelete this clone\n\nwhen I receive [go v]\nset size to (70) %\nswitch costume to (normal v)\nshow\ngo to x: (-225) y: (-40)\npoint in direction (90)\nset [x move v] to [0]\nset [y move v] to [0]\nforever\n    clear graphic effects\n    change y by (-3)\n    if <touching (platform v)?> then\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n            set [y move v] to [8]\n        end\n    end\n    change y by (3)\n    if <(y move) > [-15]> then\n        change [y move v] by (-0.5)\n    end\n    change y by (-2)\n    if <not <touching (platform v)?>> then\n        change y by (-1)\n        if <not <touching (platform v)?>> then\n            change y by (-1)\n            if <not <touching (platform v)?>> then\n                change y by (-1)\n                if <not <touching (platform v)?>> then\n                    change y by (-1)\n                    if <not <touching (platform v)?>> then\n                        change y by (-1)\n                        if <not <touching (platform v)?>> then\n                            change y by (5)\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (2)\n    change y by (y move)\n    if <touching (platform v)?> then\n        change y by (-2)\n        if <touching (platform v)?> then\n            change y by ((-1) * (y move))\n            set [y move v] to [-3]\n        end\n        change y by (2)\n    end\nend\n\nwhen I receive [go v]\nforever\n    if <<(x position) = [235]> or <(x position) > [235]>> then\n        if <(collect coins) = (minum collected)> then\n            set [x move v] to [0]\n            set [y move v] to [0]\n            hide\n            change [level v] by (1)\n            start sound [Collect v]\n            go to x: (-225) y: (-40)\n            broadcast (transition v)\n            broadcast (next level v)\n            show\n        end\n    end\nend\n\nwhen I receive [go v]\nforever\n    set [x move v] to ((x move) * (0.85))\n    change x by (x move)\n    if <touching (platform v)?> then\n        change y by (-2)\n        if <touching (platform v)?> then\n            change y by (1)\n            if <touching (platform v)?> then\n                change y by (1)\n                if <touching (platform v)?> then\n                    change y by (1)\n                    if <touching (platform v)?> then\n                        change y by (1)\n                        if <touching (platform v)?> then\n                            change y by (1)\n                            if <touching (platform v)?> then\n                                change y by (-5)\n                                change x by ((-1) * (x move))\n                                if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<<mouse down?> and <(mouse x) > (x position)>> or <<mouse down?> and <(mouse x) < (x position)>>>> and <not <(x move) = [0]>>> then\n                                    set [y move v] to [8]\n                                    set [x move v] to (((x move) / ([abs v] of (x move) )) * (-10))\n                                else\n                                    set [x move v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change y by (2)\n    end\nend\n\nwhen I receive [go v]\nforever\n    create clone of (_myself_ v)\n    wait (.025) seconds\nend\n\nwhen I receive [go v]\nforever\n    if <touching (jump pad v)?> then\n        set [y move v] to [16]\n        wait (1) seconds\n        repeat (10)\n            change [x move v] by (4)\n        end\n    end\nend\n\nwhen I receive [go v]\ngo to [back v] layer\nforever\n    if <<(y position) < [-175]> or <touching (oof v)?>> then\n        hide\n        set [x move v] to [0]\n        set [y move v] to [0]\n        go to x: (-225) y: (-40)\n        point in direction (90)\n        start sound [Crunch v]\n        broadcast (transition v)\n        broadcast (coin reset v) and wait\n        broadcast (coin check v)\n        show\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        change [x move v] by (-1.2)\n        point in direction (-90)\n    end\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        change [x move v] by (1.2)\n        point in direction (90)\n    end\nend\n\nwhen I receive [change skin v]\nswitch costume to (cake skin v)\n\nwhen flag clicked\nforever\n    set [playerx v] to (x position)\n    set [playery v] to (y position)\nend\n\n@platform\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nswitch costume to (1 1 v)\nchange [ghost v] effect by (100)\nset [level v] to [1]\n\nwhen I receive [go v]\nshow\nforever\n    switch costume to (level)\nend\n\nwhen I receive [the end :\) v]\nstop [other scripts in sprite v]\nhide\n\n@deco\n\nwhen I receive [go v]\nshow\nforever\n    switch costume to (level)\nend\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nswitch costume to (1 1 v)\n\nwhen I receive [the end :\) v]\nstop [other scripts in sprite v]\nhide\n\n@oof\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nswitch costume to (1 1 v)\nclear graphic effects\nset [ghost v] effect to (100)\n\nwhen I receive [go v]\nshow\nforever\n    switch costume to (level)\nend\n\n@thumbnail \n\nwhen flag clicked\nset [ghost v] effect to (100)\ngo to [front v] layer\nshow\ngo to [front v] layer\n\nwhen I receive [stop v]\nclear graphic effects\nset [ghost v] effect to (100)\ngo to [front v] layer\nshow\nrepeat (50)\n    change [ghost v] effect by (-2)\n    wait (0.025) seconds\nend\n\n@music\n\nwhen flag clicked\nset [id v] to [1]\nset [ghost v] effect to (100)\nhide\n\nwhen I receive [go v]\nswitch costume to (1 -  isrg33 - dreams v)\nshow\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\nwait (3) seconds\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nhide\nwait until <(id) = [2]>\nswitch costume to (2 - plo's theme v)\nshow\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\nwait (3) seconds\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nhide\nwait until <(id) = [3]>\nswitch costume to (3 - the wind can be still v)\nshow\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\nwait (3) seconds\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nhide\nwait until <(id) = [4]>\nswitch costume to (4 - mines iccles v)\nshow\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\nwait (3) seconds\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nhide\n\nwhen I receive [go v]\nset [id v] to [1]\nwait (2) seconds\nrepeat until <(level) = [11]>\n    play sound [1 - Within The Sadness -1f1n1ty v] until done\nend\nwait (1.5) seconds\nset [id v] to [2]\nrepeat until <(level) = [20]>\n    play sound [2 - Plo's Theme v] until done\nend\nwait (1.5) seconds\nset [id v] to [3]\nrepeat until <(level) = [26]>\n    play sound [3 - the wind can be still v] until done\nend\nwait (1.5) seconds\nset [id v] to [4]\nforever\n    play sound [4 - mines iccles v] until done\nend\n\nwhen I receive [the end :\) v]\nstop [other scripts in sprite v]\nstop all sounds\nhide\n\n@notfication\n\nwhen I receive [the end :\) v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [go v]\ngo to x: (0) y: (50)\nswitch costume to (norm v)\nforever\n    wait (pick random (20) to (40)) seconds\n    show\n    repeat until <(y position) < [6]>\n        change y by (((5) - (y position)) / (6))\n    end\n    wait (3.5) seconds\n    repeat until <(y position) > [49.5]>\n        change y by (((y position) + (5)) / (5))\n    end\n    hide\nend\n\nwhen I receive [go v]\nforever\n    go to [front v] layer\nend\n\nwhen I receive [stop notif v]\nstop [other scripts in sprite v]\nhide\n\nwhen flag clicked\nswitch costume to (beginining v)\nshow\nrepeat until <(y position) < [6]>\n    change y by (((5) - (y position)) / (6))\nend\nwait (2.5) seconds\nrepeat until <(y position) > [49.5]>\n    change y by (((y position) + (5)) / (5))\nend\nhide\n\n@bg\n\nwhen I receive [the end :\) v]\nstop [other scripts in sprite v]\nhide\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nclear graphic effects\n\nwhen I receive [go v]\nshow\nforever\n    go to x: ((playerX) / (-10)) y: ((playerY) / (-10))\n    go to [back v] layer\nend\n\nwhen I receive [go v]\nswitch costume to (mountain day v)\nshow\nwait until <(level) = [11]>\nstop all sounds\nswitch costume to (mountain night v)\nwait until <(level) = [20]>\nstop all sounds\nswitch costume to (mountain midnight v)\nwait until <(level) = [26]>\nstop all sounds\nswitch costume to (mountain sun rise v)\n\n@Par\n\nwhen I receive [the end :\) v]\nstop [other scripts in sprite v]\nhide\n\nwhen flag clicked\nhide\ngo to [front v] layer\nforever\n    create clone of (_myself_ v)\n    wait (.1) seconds\nend\n\nwhen I start as a clone\nhide\ngo to x: (pick random (-230) to (230)) y: (-200)\nset size to (pick random (30) to (50)) %\npoint in direction (pick random (-90) to (90))\nshow\nrepeat (20)\n    move (2) steps\n    change y by (1)\n    turn right (5) degrees\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\nwhen [p v] key pressed\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@transition\n\nwhen I receive [transition v]\ngo to [front v] layer\nshow\nclear graphic effects\nwait (.5) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nswitch costume to (1 v)\nhide\nstop [other scripts in sprite v]\ngo to [back v] layer\n\nwhen flag clicked\nhide\nclear graphic effects\n\n@win screen \n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nclear graphic effects\n\nwhen I receive [the end :\) v]\nstart sound [4 - mines iccles \[end cut\] v]\ngo to x: (0) y: (0)\ncreate clone of (_myself_ v)\nshow\nswitch costume to (text v)\nwait (2) seconds\nrepeat (820)\n    change y by (1)\nend\nwait (.9) seconds\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nswitch costume to (me v)\ngo to x: (0) y: (0)\nwait (.9) seconds\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\nwait (1.3) seconds\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nhide\nbroadcast (thumbnail v)\n\nwhen I start as a clone\nswitch costume to (black screen v)\ngo to x: (0) y: (0)\ngo to [back v] layer\nshow\n\nwhen I receive [wr ani v]\nstop [other scripts in sprite v]\nwait (2) seconds\nhide\n\n@WR ANIMATION\n\nwhen flag clicked\nhide\nshow variable [time v]\nswitch costume to (empty v)\nset size to (100) %\nswitch costume to (costume1 v)\nclear graphic effects\n\nwhen I receive [wr ani v]\ngo to [front v] layer\nhide variable [time v]\nhide variable [☁ world record v]\ngo to [front v] layer\nshow\nrepeat (9)\n    next costume\n    wait (.025) seconds\nend\nwait (1) seconds\nrepeat (9)\n    switch costume to ((costume [number v]) - (1))\n    wait (.025) seconds\nend\nhide\nbroadcast (transition v)\nwait (.3) seconds\nbroadcast (flash v)\nshow\nswitch costume to (me v)\nwait (2) seconds\nbroadcast (flash v)\nswitch costume to (me2 v)\nwait (.5) seconds\nbroadcast (flash v)\nswitch costume to (me3 v)\nwait (1) seconds\nshow\ngo to [front v] layer\nstop [all v]\n\n@Intro\n\ndefine [Smooth spin] Speed - (speed) [Ending direction] (direction) [Full turn speed] (full speed)\nset [my variable v] to [0]\nrepeat (15)\n    change [my variable v] by (full speed)\n    turn right (my variable) degrees\nend\nrepeat until <(round (direction)) = (direction)>\n    turn right (((direction) - (direction)) / (speed)) degrees\nend\n\nwhen flag clicked\nset [full turn speed v] to [1]\nset [ending direction v] to [90]\nset [smooth spin v] to [5]\npoint in direction (90)\n\nwhen I start as a clone\nif <(id) = [1]> then\n    switch costume to (capture2 v)\n    show\n    go to x: (-240) y: (0)\n    set size to (10) %\n    repeat (2)\n        change x by (6)\n        change size by (5)\n    end\n    repeat (3)\n        change x by (9)\n        change size by (6)\n    end\n    repeat (4)\n        change x by (12)\n        change size by (8)\n    end\n    repeat (3)\n        change x by (12)\n        change size by (8)\n    end\n    repeat (3)\n        change x by (12)\n        change size by (6)\n    end\n    repeat (3)\n        change x by (9)\n        change size by (6)\n    end\n    repeat (3)\n        change x by (7)\n        change size by (6)\n    end\n    repeat (3)\n        change x by (5)\n        change size by (4)\n    end\n    repeat (3)\n        change x by (3)\n        change size by (3)\n    end\n    repeat (3)\n        change x by (3)\n        change size by (3)\n    end\n    repeat (3)\n        change x by (2)\n        change size by (2)\n    end\n    repeat (3)\n        change x by (1)\n        change size by (1)\n    end\n    [Smooth spin] Speed - (Smooth spin) [Ending direction] (Ending direction) [Full turn speed] (Full turn speed)\n    wait (.5) seconds\n    repeat (2)\n        change size by (-6)\n    end\n    repeat (3)\n        change size by (-8)\n    end\n    repeat (4)\n        change size by (-10)\n    end\n    repeat (5)\n        change size by (-14)\n    end\n    hide\n    broadcast (transition v)\n    broadcast (menu v)\n    delete this clone\nend\n\nwhen flag clicked\nhide\nset [id v] to [1]\ncreate clone of (_myself_ v)\nset [id v] to [2]\ncreate clone of (_myself_ v)\n\n@thumbnail\n\nwhen flag clicked\nhide\n\nwhen I receive [thumbnail v]\nset volume to (100) %\nstart sound [end v]\ngo to [front v] layer\ngo to x: (0) y: (200)\nset [brightness v] effect to (45)\nshow\nrepeat (45)\n    change y by (((0) - (y position)) / (7))\n    change [brightness v] effect by (-1)\nend\n\n@TIMER\n\nwhen I receive [go v]\nshow variable [time v]\nset [time v] to [0]\nwait (1) seconds\nset [time v] to [0]\nforever\n    repeat until <(level) = [32]>\n        change [time v] by (1)\n        wait (1) seconds\n    end\n    stop [this script v]\nend\n\nwhen flag clicked\nhide variable [time v]\nhide variable [☁ world record v]\n\nwhen I receive [the end :\) v]\nforever\n    if <(time) < (☁ World record)> then\n        set [☁ world record v] to (time)\n        broadcast (WR ANI v)\n        stop [this script v]\n    end\nend\n\nwhen I receive [the end :\) v]\nshow variable [☁ world record v]\n\n@fliter\n\nwhen I receive [play game v]\nhide\nwait (.5) seconds\nforever\n    if <<(level) = [2]> or <<(level) = [4]> or <(level) = [3]>>> then\n        show\n        go to [front v] layer\n    else\n        hide\n    end\nend\n\nwhen I receive [go v]\nswitch costume to (night v)\nforever\n    if <(level) = [2]> then\n        switch costume to (night v)\n    end\n    if <(level) = [3]> then\n        switch costume to (midnight v)\n    end\n    if <(level) = [4]> then\n        switch costume to (morning v)\n    end\nend\n\n@menu\n\nwhen I start as a clone\nif <(id) = [1]> then\n    go to x: (0) y: (0)\n    show\n    switch costume to (start v)\n    go to [front v] layer\n    forever\n        point in direction (([sin v] of ((time) * (1500)) ) + (90))\n        if <touching (mouse-pointer v)?> then\n            change size by (((120) - (size)) / (3))\n            set [ghost v] effect to (20)\n            if <mouse down?> then\n                wait (.1) seconds\n                broadcast (transition v)\n                broadcast (go v)\n                delete this clone\n            end\n        else\n            change size by (((100) - (size)) / (3))\n            set [ghost v] effect to (0)\n        end\n    end\nend\nif <(id) = [2]> then\n    go to x: (0) y: (0)\n    show\n    switch costume to (bg v)\n    go to [front v] layer\n    go [backward v] (1) layers\n    forever\n        point in direction (([sin v] of ((time) * (100)) ) + (90))\n    end\nend\nif <(id) = [3]> then\n    go to x: (0) y: (-110)\n    show\n    switch costume to (info v)\n    go to [front v] layer\n    forever\n        point in direction (([sin v] of ((time) * (1500)) ) + (90))\n        if <touching (mouse-pointer v)?> then\n            change size by (((120) - (size)) / (3))\n            set [ghost v] effect to (20)\n            if <mouse down?> then\n                wait (.1) seconds\n                broadcast (info v)\n            end\n        else\n            change size by (((100) - (size)) / (3))\n            set [ghost v] effect to (0)\n        end\n    end\nend\n\nwhen I receive [go v]\nwait (1) seconds\nstop [other scripts in sprite v]\n\nwhen I receive [go v]\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I receive [menu v]\nset [id v] to [1]\ncreate clone of (_myself_ v)\nset [id v] to [2]\ncreate clone of (_myself_ v)\nset [id v] to [3]\ncreate clone of (_myself_ v)\n\nwhen I receive [menu v]\nforever\n    play sound [song v] until done\nend\n\nwhen I receive [menu v]\nforever\n    change [time v] by (.02)\nend\n\n@info section\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [info v]\nshow\ngo to [front v] layer\nforever\n    if <<mouse down?> or <key (any v) pressed?>> then\n        hide\n        go to [back v] layer\n        stop [this script v]\n    end\nend\n\n@rain\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (50)\ngo to x: (pick random (230) to (-230)) y: (190)\nswitch costume to (rain v)\nrepeat (25)\n    change y by (-17)\nend\ndelete this clone\n\nwhen I receive [menu v]\nwait (.1) seconds\ngo to [front v] layer\nforever\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nclear graphic effects\nhide\n\nwhen I receive [go v]\nstop [other scripts in sprite v]\ndelete this clone\n\n@detector\n\nwhen I start as a clone\nif <(clone id) = [0]> then\n    go to x: (-15) y: (0)\n    set [loved__ v] to [0]\n    switch costume to (love v)\n    forever\n        set [love? v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [loved__ v] to [1]\n        end\n    end\nend\nif <(clone id) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (fave v)\n    set [faved___ v] to [0]\n    forever\n        set [fav v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [faved___ v] to [1]\n        end\n    end\nend\n\nwhen flag clicked\nhide\nset [faved___ v] to [0]\nset [loved__ v] to [0]\nset [clone id v] to [0]\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\nwait until <<(LOVED__) = [1]> and <(FAVED___) = [1]>>\nbroadcast (stop notif v)\nbroadcast (give skin v)\nset [already loved/faved? v] to [yes]\nhide\ndelete this clone\n\n@skin gain ani\n\nwhen flag clicked\nhide\ngo to [front v] layer\npoint in direction (90)\nset size to (30) %\ngo to x: (0) y: (0)\nswitch costume to (with out text v)\n\nwhen I receive [give skin v]\ngo to [front v] layer\npoint in direction (90)\nset size to (30) %\ngo to x: (0) y: (0)\nset rotation style [all around v]\nswitch costume to (with out text v)\nwait (1) seconds\nbroadcast (transition v)\nshow\nrepeat (56)\n    turn left (25) degrees\n    change size by (10)\nend\nturn left (25) degrees\npoint in direction (90)\nswitch costume to (with text v)\nrepeat until <<key (any v) pressed?> or <mouse down?>>\n    repeat (10)\n        change y by (1.5)\n    end\n    repeat (10)\n        change y by (-1.5)\n    end\nend\nswitch costume to (with out text v)\nrepeat (59)\n    change size by (-8.4)\nend\nset rotation style [left-right v]\nrepeat until <touching (player v)?>\n    move (10) steps\n    point towards (player v)\nend\nhide\nbroadcast (flash v)\nbroadcast (change skin v)\n\n@flash\n\nwhen flag clicked\nshow\nset size to (300) %\nset [ghost v] effect to (100)\n\nwhen I receive [flash v]\nforever\n    go to [front v] layer\nend\n\nwhen I receive [flash v]\nswitch costume to (white v)\ngo to [front v] layer\nclear graphic effects\nshow\ngo to x: (0) y: (0)\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\nclear graphic effects\n\n@clouds\n\nwhen I start as a clone\ngo to [back v] layer\nswitch costume to (pick random (1) to (3))\nset size to (pick random (90) to (110)) %\nset [ghost v] effect to (pick random (20) to (40))\nset y to (pick random (100) to (185))\nset x to (301)\nshow\nrepeat until <<(x position) < [-290]> or <(x position) = [-290]>>\n    change x by (-1)\nend\ndelete this clone\n\nwhen I receive [the end :\) v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [go v]\nhide\nforever\n    create clone of (_myself_ v)\n    wait (pick random (12) to (16)) seconds\nend\n\nwhen [p v] key pressed\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@Effect\n\nwhen I start as a clone\nshow\ngo to [front v] layer\nset [ghost v] effect to (pick random (85) to (95))\nset size to (pick random (40) to (70)) %\ngo to x: (240) y: (pick random (180) to (-180))\nglide (pick random (1.0) to (3.0)) secs to x: (-240) y: (pick random (180) to (-180))\ndelete this clone\n\nwhen I receive [go v]\nhide\nforever\n    create clone of (_myself_ v)\n    wait (0.2) seconds\nend\n\nwhen [p v] key pressed\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n