WORLDS 3 - a scrolling platformer
@Stage\n\n@Note\n\n@Spiderman\n\ndefine Move - in steps (steps)\nchange [falling v] by (1)\nrepeat (steps)\n    set [last value v] to (x position)\n    change x by ((speed x) / (steps))\n    Check Touching Solid\n    if <(touching) > [0]> then\n        Collide X - Slope or Wall?\n    end\n    set [last value v] to (y position)\n    change y by ((speed y) / (steps))\n    Check Touching Solid\n    if <(touching) > [0]> then\n        Collide Y - Ceiling or Floor\n    end\nend\n\ndefine Check Touching Solid\nif <<touching (levelhitbox v)?> or <<touching (crushers v)?> or <touching (platform v)?>>> then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\nwhen I receive [tick - player v]\nMoved - by Moving Platform\nControls - Up and Down\nControls - Left and Right\nMove - in steps (([abs v] of (speed x) ) + ([abs v] of (speed y) ))\nSet Costume\n\ndefine Controls - Up and Down\nif <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n    if <<(wall slide) > [0]> and <(Jumping) = [0]>> then\n        set [jumping v] to [1]\n        set [falling v] to [3]\n        set [wall slide v] to [0]\n        turn right (180) degrees\n        set [speed x v] to (((direction) / (90)) * (7))\n        set [long jump v] to [12]\n    end\n    if <<(falling) < [3]> and <(Jumping) = [0]>> then\n        set [jumping v] to [1]\n        set [falling v] to [3]\n    end\n    if <<(Jumping) > [0]> and <(Jumping) < (JUMP DURATION)>> then\n        change [jumping v] by (1)\n        set [speed y v] to (JUMP FORCE)\n    end\nelse\n    set [jumping v] to [0]\nend\nchange [speed y v] by (GRAVITY)\nif <(wall slide) > [0]> then\n    Check Can Wall Slide\n    if <(speed y) < [0]> then\n        set [speed y v] to ((speed y) * (0.6))\n    end\nend\n\ndefine Controls - Left and Right\nif <(long jump) > [0]> then\n    change [long jump v] by (-1)\n    stop [this script v]\nend\nset [key x v] to (<<key (right arrow v) pressed?> or <key (d v) pressed?>> - <<key (left arrow v) pressed?> or <key (a v) pressed?>>)\nif <(KEY X) = [0]> then\n    if <<(falling) > [2]> and <(wall slide) < [1]>> then\n        set [speed x v] to ((speed x) * (0.98))\n        stop [this script v]\n    end\n    if <([abs v] of (speed x) ) < [1]> then\n        set [frame v] to [0]\n        set [key x v] to [0]\n    else\n        change [frame v] by (0.5)\n    end\nelse\n    change [speed x v] by ((KEY X) * (ACCELERATION))\n    if <not <(direction) = ((KEY X) * (90))>> then\n        set [wall slide v] to [0]\n    end\n    point in direction ((KEY X) * (90))\n    change [frame v] by (1)\nend\nset [speed x v] to ((speed x) * (RESISTANCE))\n\ndefine Reset and Begin Level\nset size to (50) %\nset [wall slide v] to [0]\nset [long jump v] to [0]\nset [jumping v] to [0]\nset [speed y v] to [0]\nset [speed x v] to [0]\nset [falling v] to [99]\npoint in direction (90)\nbroadcast (transition - game on v)\nBegin Scene # (SPAWN SCENE) go to x: (SPAWN X) (SPAWN Y)\n\nwhen I receive [game loop v]\nforever\n    set [ghost v] effect to (0)\n    broadcast (Tick - First v)\n    broadcast (Tick -Platforms v)\n    broadcast (Tick - player v)\n    broadcast (Tick - Last v)\nend\n\nwhen I receive [tick - last v]\nif <(x position) > [235]> then\n    Begin Scene # ((SCENE #) + (1)) go to x: [-230] []\nend\nif <(x position) < [-235]> then\n    Begin Scene # ((SCENE #) + (-1)) go to x: [235] []\nend\nif <(y position) > [180]> then\n    Begin Scene # ((SCENE #) + (100)) go to x: [] [-160]\nend\nif <(y position) < [-180]> then\n    Begin Scene # ((SCENE #) + (-100)) go to x: [] [180]\nend\nif <touching (danger v)?> then\n    broadcast (Lose Life v)\nend\n\ndefine Begin Scene # (scene #) go to x: (x) (y)\nset [scene # v] to (scene #)\nif <(x) > []> then\n    set x to (x)\nend\nif <(y) > []> then\n    set y to (y)\nend\nbroadcast (Change Scene  v)\nstop [other scripts in sprite v]\nwait (0) seconds\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nif <(x) > []> then\n    Fix Collision in Direction [0]\nelse\n    Fix Collision in Direction [90]\nend\nSet Costume\nbroadcast (Game Loop v)\n\ndefine Fix Collision in Direction (dir)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (dir)\nrepeat (64)\n    Check Touching Solid\n    if <(touching) < [1]> then\n        point in direction (temp)\n        stop [this script v]\n    end\n    move (distance) steps\n    turn right (180) degrees\n    change [distance v] by (1)\nend\n\nwhen I receive [tick - first v]\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nset [platform dx v] to []\nset [platform dy v] to []\n\ndefine Set Costume\nset rotation style [left-right v]\nif <(wall slide) > [0]> then\n    switch costume to (hangon01 v)\n    stop [this script v]\nend\nif <(falling) > [1]> then\n    if <(speed y) > [0]> then\n        switch costume to (jump01 v)\n    else\n        switch costume to (run_j2 v)\n    end\n    stop [this script v]\nend\nif <(frame) > [0]> then\n    switch costume to ((1) + ([floor v] of ((frame) mod (16)) ))\nelse\n    switch costume to (hit angle 0 v)\n    repeat (5)\n        Check Touching Solid\n        if <(touching) < [1]> then\n            switch costume to ((costume [number v]) + (5))\n            stop [this script v]\n        end\n        next costume\n    end\n    switch costume to (stand v)\nend\n\ndefine Collide X - Slope or Wall?\nCheck Can Wall Slide\nchange y by (1)\nCheck Touching Solid\nif <(touching) > [0]> then\n    change y by (1)\n    Check Touching Solid\n    if <(touching) > [0]> then\n        change y by (-2)\n        set x to (last value)\n        set [speed x v] to [0]\n        stop [this script v]\n    end\n    set [speed x v] to ((speed x) * (0.8))\nend\nset [speed x v] to ((speed x) * (0.95))\nSlip\n\ndefine Collide Y - Ceiling or Floor\nset y to (last value)\nif <(speed y) > [0]> then\n    set [speed y v] to [0]\n    stop [this script v]\nend\nif <(falling) > [0]> then\n    set [falling v] to [0]\n    Slip\nend\nset [speed y v] to ((speed y) * (0.8))\n\ndefine Slip\nchange y by (-2)\nchange x by (1)\nCheck Touching Solid\nif <(touching) < [1]> then\n    set [falling v] to [9]\n    change [speed x v] by (1)\n    stop [this script v]\nend\nchange x by (-2)\nCheck Touching Solid\nif <(touching) < [1]> then\n    set [falling v] to [9]\n    change [speed x v] by (-1)\n    stop [this script v]\nend\nchange y by (2)\nchange x by (1)\n\ndefine Check Can Wall Slide\nif <(falling) < [2]> then\n    set [wall slide v] to [0]\n    stop [this script v]\nend\nswitch costume to (hitbox wallslide v)\nset rotation style [left-right v]\nCheck Touching Solid\nset [wall slide v] to (touching)\nswitch costume to (hitbox v2 v)\nset rotation style [left-right v]\n\ndefine Moved - by Moving Platform\nchange x by (PLATFORM DX)\nchange y by (PLATFORM DY)\nCheck Touching Solid\nif <(touching) > [0]> then\n    Find Closest Space to (x position) (y position) max [16]\n    if <(touching) > [0]> then\n        start sound [squishy v]\n        broadcast (Lose Life v)\n    end\nend\n\ndefine Find Closest Space to (x) (y) max (max)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (0)\nrepeat (max)\n    repeat (16)\n        go to x: (x) y: (y)\n        move (distance) steps\n        Check Touching Solid\n        if <(touching) < [1]> then\n            point in direction (temp)\n            stop [this script v]\n        end\n        turn right (22.5) degrees\n    end\n    change [distance v] by (1)\nend\ngo to x: (x) y: (y)\npoint in direction (temp)\n\nwhen I receive [lose life v]\nstop [other scripts in sprite v]\nstart sound [boom 1 v]\nrepeat (10)\n    switch costume to (death v)\n    change size by (10)\n    change [ghost v] effect by (10)\nend\nwait (1) seconds\nbroadcast (transition - die v) and wait\nReset and Begin Level\n\nwhen I receive [begin-game v]\nset [jump duration v] to [6]\nset [gravity v] to [-1.5]\nset [jump force v] to [15]\nset [acceleration v] to [2]\nset [resistance v] to [0.8]\nset [spawn scene v] to [101]\nset [spawn x v] to [-206]\nset [spawn y v] to [127]\nbroadcast (Change Scene  v)\nbroadcast (Game Loop v)\nbroadcast (Setup v) and wait\nReset and Begin Level\n\n@LevelART\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\nswitch costume to (scene1 v)\n\nwhen I receive [change scene  v]\nswitch costume to (join [Scene] (SCENE #))\nbroadcast (Buildings v)\n\n@LevelHitbox\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\nswitch costume to (scene1 v)\n\nwhen I receive [change scene  v]\nswitch costume to (join [Scene] (SCENE #))\n\n@Platform\n\nwhen I receive [change scene  v]\nhide\nif <<(SCENE #) = [2]> or <<(SCENE #) = [3]> or <<(SCENE #) = [103]> or <<(SCENE #) = [8]> or <<(SCENE #) = [117]> or >>>>> then\n    show\n    Animate Platform\nend\nif <(SCENE #) = [108]> then\n    Animate Platform\nend\n\ndefine Animate Platform\nif <(SCENE #) = [2]> then\n    go to x: (-69) y: (-89)\nend\nforever\n    set rotation style [left-right v]\n    if <(SCENE #) = [2]> then\n        switch costume to (car v)\n        point in direction (-90)\n        glide (2) secs to x: (295) y: (-89)\n        hide\n        wait (0.5) seconds\n        change [color v] effect by (pick random (-25) to (-50))\n        show\n        go to x: (-300) y: (-89)\n    end\n    if <(SCENE #) = [3]> then\n        hide\n        change [color v] effect by (pick random (-25) to (-50))\n        wait (1) seconds\n        switch costume to (car v)\n        show\n        go to x: (-300) y: (-89)\n        point in direction (-90)\n        glide (2.5) secs to x: (295) y: (-89)\n    end\n    if <(SCENE #) = [103]> then\n        set [color v] effect to (0)\n        switch costume to (platform v)\n        show\n        go to x: (70) y: (-212)\n        wait (1) seconds\n        glide (2) secs to x: (109) y: (-17)\n        wait (1) seconds\n        glide (2) secs to x: (70) y: (-212)\n    end\n    if <(SCENE #) = [8]> then\n        go to [back v] layer\n        set [color v] effect to (0)\n        switch costume to (costume2 v)\n        show\n        go to x: (-223) y: (36)\n        wait (1) seconds\n        glide (4) secs to x: (243) y: (36)\n        wait (1) seconds\n        go to x: (-223) y: (36)\n    end\n    if <(SCENE #) = [117]> then\n        go to [back v] layer\n        set [color v] effect to (0)\n        switch costume to (platform3 v)\n        show\n        go to x: (-47) y: (-119)\n        wait until <touching (spiderman v)?>\n        glide (1) secs to x: (-47) y: (-72)\n        wait (1) seconds\n        glide (3) secs to x: (181) y: (-72)\n        stop [this script v]\n    end\nend\n\nwhen I receive [tick -platforms v]\nTick (x position) (y position)\nset [last x v] to (x position)\nset [last y v] to (y position)\n\ndefine Tick (new x) (new y)\nif <(new y) > (last y)> then\n    change y by (1)\nelse\n    set y to ((last y) + (1))\nend\nif <touching (spiderman v)?> then\n    set [platform dx v] to ((new x) - (last x))\n    set [platform dy v] to ((new y) - (last y))\nend\ngo to x: (new x) y: (new y)\n\nglide (2) secs to x: (22) y: (121)\nwait (1) seconds\n\n@Music/Sound-Effects\n\nwhen flag clicked\nforever\n    play sound [Super_Spiffy v] until done\nend\n\n@Danger\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nswitch costume to (scene1 v)\nclear graphic effects\n\nwhen I receive [change scene  v]\ngo to x: (0) y: (0)\nclear graphic effects\nswitch costume to (join [Scene] (SCENE #))\nbroadcast (Buildings v)\ngo to [front v] layer\nif <<(SCENE #) = [8]> or <<(SCENE #) = [9]> or <<(SCENE #) = [12]> or <(SCENE #) = [19]>>>> then\n    go to [back v] layer\n    forever\n        set y to ((5) * ([sin v] of ((timer) * (180)) ))\n        set [whirl v] effect to ((10) * ([sin v] of ((timer) * (360)) ))\n    end\nend\nif  then\n    go to [back v] layer\n    forever\n        change y by ((5.5) * ([sin v] of (frame) ))\n        change [frame v] by (5)\n    end\nend\n\n@Collectable\n\nwhen I receive [change scene  v]\nif <(SCENE #) = (My Scene)> then\n    show\nelse\n    hide\nend\n\nwhen I start as a clone\nrepeat until <touching (spiderman v)?>\n    if <(costume [name v]) = [Collectable]> then\n        change y by ((0.5) * ([sin v] of (frame) ))\n        change [frame v] by (5)\n    end\nend\nset [my scene v] to []\nif <(costume [name v]) = [Collectable]> then\n    switch costume to (collectable2 v)\n    start sound [Suction Cup v]\n    repeat (20)\n        change y by (2)\n        change [ghost v] effect by (5)\n    end\n    if <(costume [name v]) = [Collectable]> then\n        hide\n    end\nelse\n    if <(costume [name v]) = [FlagOff]> then\n        show\n        switch costume to (flagon v)\n        start sound [Flag v]\n        set [spawn scene v] to (SCENE #)\n        set [spawn x v] to ([x position v] of [spiderman v])\n        set [spawn y v] to ([y position v] of [spiderman v])\n    else\n        start sound [Flag v]\n    end\nend\n\nwhen I receive [setup v]\nswitch costume to (collectable v)\nset [frame v] to [0]\nhide\nPlace [Collectable] scene [101] xy [34] [5]\nPlace [Collectable] scene [101] xy [-49] [110]\nPlace [Collectable] scene [1] xy [103] [-64]\nPlace [Collectable] scene [2] xy [-11] [9]\nPlace [Collectable] scene [3] xy [-192] [79]\nPlace [Collectable] scene [4] xy [-52] [118]\nPlace [Collectable] scene [4] xy [-177] [-7]\nPlace [Collectable] scene [5] xy [-24] [-7]\nPlace [Collectable] scene [6] xy [42] [-10]\nPlace [Collectable] scene [6] xy [-167] [9]\nPlace [Collectable] scene [7] xy [84] [22]\nPlace [Collectable] scene [8] xy [-102] [71]\nPlace [Collectable] scene [8] xy [-34] [71]\nPlace [Collectable] scene [8] xy [44] [71]\nPlace [Collectable] scene [8] xy [121] [71]\nPlace [Collectable] scene [9] xy [-80] [-42]\nPlace [Collectable] scene [9] xy [201] [-78]\nPlace [Collectable] scene [10] xy [40] [35]\nPlace [Collectable] scene [11] xy [85] [10]\nPlace [Collectable] scene [12] xy [-125] [-76]\nPlace [Collectable] scene [12] xy [79] [46]\nPlace [Collectable] scene [13] xy [9] [-49]\nPlace [Collectable] scene [14] xy [138] [-76]\nPlace [Collectable] scene [15] xy [24] [51]\nPlace [Collectable] scene [15] xy [-105] [-42]\nPlace [Collectable] scene [16] xy [-105] [-42]\nPlace [Collectable] scene [16] xy [51] [41]\nPlace [Collectable] scene [16] xy [133] [135]\nPlace [Collectable] scene [16] xy [-85] [132]\nPlace [Collectable] scene [19] xy [54] [91]\nPlace [Collectable] scene [19] xy [116] [91]\nPlace [Collectable] scene [20] xy [85] [-87]\nPlace [Collectable] scene [20] xy [-166] [-84]\nPlace [Collectable] scene [21] xy [-39] [-83]\nPlace [Collectable] scene [22] xy [-139] [-83]\nPlace [Collectable] scene [22] xy [-45] [-83]\nPlace [Collectable] scene [22] xy [58] [-83]\nPlace [Collectable] scene [22] xy [174] [-83]\nPlace [Collectable] scene [104] xy [-92] [-31]\nPlace [Collectable] scene [116] xy [148] [-140]\nPlace [Collectable] scene [116] xy [-130] [-52]\nPlace [Collectable] scene [116] xy [99] [-55]\nPlace [Collectable] scene [118] xy [-5] [-26]\nPlace [FlagOff] scene [3] xy [72] [113]\nPlace [FlagOff] scene [7] xy [-192] [-72]\nPlace [FlagOff] scene [12] xy [-170] [-72]\nPlace [FlagOff] scene [117] xy [-166] [-41]\nPlace [FlagOff] scene [20] xy [-192] [-72]\nPlace [FlagOff] scene [22] xy [191] [28]\nhide\n\ndefine Place (costume name) scene (scene) xy (x) (y)\nset [my scene v] to (scene)\nswitch costume to (costume name)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nset [my scene v] to []\n\n@Clouds\n\nwhen flag clicked\nhide\nforever\n    go to [back v] layer\n    set size to (pick random (50) to (75)) %\n    switch costume to (pick random (1) to (6))\n    point in direction (pick random (180) to (-180))\n    if <(pick random (1) to (2)) = [1]> then\n        go to x: (400) y: (pick random (180) to (0))\n    else\n        go to x: (-400) y: (pick random (180) to (0))\n    end\n    create clone of (_myself_ v)\n    wait (pick random (3) to (5)) seconds\nend\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nset [ghost v] effect to (pick random (50) to (70))\nif <(x position) < [0]> then\n    go to [back v] layer\n    repeat until <(x position) = (_XPosition)>\n        go to [back v] layer\n        set [_xposition v] to (x position)\n        change x by ((2) * ((size) / (100)))\n    end\nelse\n    repeat until <(x position) = (_XPosition)>\n        go to [back v] layer\n        set [_xposition v] to (x position)\n        change x by ((-2) * ((size) / (100)))\n    end\nend\ndelete this clone\n\n@PARRALAX\n\nwhen flag clicked\nforever\n    if <(SCENE #) < [100]> then\n        show\n        go to [back v] layer\n    else\n        Hide\n    end\nend\n\ndefine Hide\nhide\n\nwhen I receive [buildings v]\nswitch costume to (pick random (1) to (2))\n\n@Crushers\n\nwhen I receive [tick -platforms v]\nTick (x position) (y position)\nset [last x v] to (x position)\nset [last y v] to (y position)\n\ndefine Animate Platform\nwait (pick random (0.5) to (1.5)) seconds\nforever\n    repeat (40)\n        change y by ((5.5) * ([sin v] of (frame) ))\n        change [frame v] by (5)\n    end\nend\n\ndefine Tick (new x) (new y)\nif <(new y) > (last y)> then\n    change y by (1)\nelse\n    set y to ((last y) + (1))\nend\nif <touching (spiderman v)?> then\n    set [platform dx v] to ((new x) - (last x))\n    set [platform dy v] to ((new y) - (last y))\nend\ngo to x: (new x) y: (new y)\n\nwhen I start as a clone\nAnimate Platform\n\nwhen I receive [setup v]\nswitch costume to (collectable v)\nset [frame v] to [0]\nhide\nPlace [Crusher1] scene [20] xy [-1] [-95]\nPlace [Crusher1] scene [20] xy [171] [-95]\nPlace [Crusher1] scene [21] xy [-133] [-95]\nPlace [Crusher1] scene [21] xy [54] [-95]\n\ndefine Place (costume name) scene (scene) xy (x) (y)\nset [my scene v] to (scene)\nswitch costume to (costume name)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nset [my scene v] to []\n\nwhen I receive [change scene  v]\nif <(SCENE #) = (My Scene)> then\n    show\nelse\n    hide\nend\n\n@Transitions\n\nwhen I receive [setup transitions v]\ngo to x: (0) y: (0)\nswitch costume to (splash2 v)\nset size to (100) %\nshow\ngo to [front v] layer\nset [ghost v] effect to (0)\n\nwhen I receive [transition - game on v]\ngo to x: (0) y: (0)\ngo to [front v] layer\nswitch costume to (black v)\nset size to (100) %\nshow\nrepeat (5)\n    go to [front v] layer\n    switch costume to (mini v)\n    set size to ((size) * (1.2)) %\n    switch costume to (mask #1 v)\nend\ngo to [front v] layer\nset size to ((size) * (0.5)) %\nrepeat (2)\n    go to [front v] layer\n    switch costume to (mini v)\n    set size to ((size) * (1.2)) %\n    switch costume to (mask #2 v)\nend\nrepeat (2)\n    go to [front v] layer\n    switch costume to (mini v)\n    set size to ((size) * (1.2)) %\n    switch costume to (mask #3 v)\nend\nrepeat (3)\n    go to [front v] layer\n    switch costume to (mini v)\n    set size to ((size) * (1.2)) %\n    switch costume to (mask #4 v)\nend\nrepeat (5)\n    go to [front v] layer\n    switch costume to (mini v)\n    set size to ((size) * (1.2)) %\n    switch costume to (mask #5 v)\nend\ngo to [front v] layer\nhide\n\nwhen I receive [transition - die v]\ngo to x: (0) y: (0)\ngo to [front v] layer\nswitch costume to (mini v)\nset size to (1116) %\nswitch costume to (mask #5 v)\nshow\nrepeat (4)\n    switch costume to (mini v)\n    set size to ((size) / (1.2)) %\n    switch costume to (mask #5 v)\nend\nrepeat (3)\n    switch costume to (mini v)\n    set size to ((size) / (1.2)) %\n    switch costume to (mask #4 v)\nend\nrepeat (2)\n    switch costume to (mini v)\n    set size to ((size) / (1.2)) %\n    switch costume to (mask #3 v)\nend\nrepeat (2)\n    switch costume to (mini v)\n    set size to ((size) / (1.2)) %\n    switch costume to (mask #2 v)\nend\nswitch costume to (mini v)\nset size to (250) %\nrepeat (5)\n    switch costume to (mini v)\n    set size to ((size) / (1.2)) %\n    switch costume to (mask #1 v)\nend\nswitch costume to (black v)\nset size to (100) %\n\nwhen I receive [transition win v]\ngo to x: (0) y: (0)\nswitch costume to (win v)\nset size to (100) %\nshow\ngo to [front v] layer\n\n    wait (10) seconds\nend\n\nwhen I receive [transition - splash to black v]\nrepeat (13)\n    change [brightness v] effect by (-8)\nend\nswitch costume to (black v)\nset [brightness v] effect to (0)\n\nwhen I receive [pause v]\nset [ghost v] effect to (100)\nswitch costume to (paused v)\nset size to (80) %\nshow\ngo to [front v] layer\nrepeat (5)\n    change [ghost v] effect by (-20)\n    change size by (4)\nend\nrepeat until <not <key (p v) pressed?>>\n    wait (0) seconds\nend\nrepeat until <key (p v) pressed?>\n    wait (0) seconds\nend\nrepeat until <not <key (p v) pressed?>>\n    wait (0) seconds\nend\nrepeat (5)\n    change [ghost v] effect by (20)\n    change size by (-4)\nend\nhide\nset [ghost v] effect to (0)\n\nwhen I receive [transition - game on v]\nforever\n    go to [front v] layer\nend\n\n@Game Menu\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\nrepeat (3)\n    next costume\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nif <(costume [number v]) = [2]> then\n    forever\n        if <touching (mouse-pointer v)?> then\n            set size to (120) %\n        else\n            set size to (100) %\n        end\n    end\nend\nif <(costume [number v]) = [1]> then\n    forever\nend\n\nwhen this sprite clicked\nif <(costume [number v]) = [2]> then\n    broadcast (transition - die v) and wait\n    broadcast (Begin-Game v)\nend\n\nwhen I receive [begin-game v]\nhide\ndelete this clone\n\ngo to (mouse-pointer v)\n\n@Thumbnail\n\nwhen flag clicked\nhide\nforever\n    set [ghost v] effect to (100)\n    go to x: (0) y: (0)\n    show\n    go to [front v] layer\nend\n\n@Sprite1\n\n