Journey-Ice-A Scrolling Platformer

Instructions: Arrow keys to move (up arrow to jump). Avoid spikes, puddles, and enemies.

@Stage\n\nNew Enemy [minion] at x, y: [115] [-38]\nthen glide [2.5] secs to x: [65] y: [-38]\nNew Enemy [minion2] at x, y: [650] [-38]\nthen glide [2] secs to x: [550] y: [-38]\nNew Enemy [minion3] at x, y: [1500] [65]\nthen glide [2] secs to x: [1450] y: [65]\nNew Enemy [hahahaha] at x, y: [] []\nthen chase [2] secs to x: [1231] [22]\nNew Enemy [enemy] at x, y: [1493] [-70]\nthen chase [2] secs to x: [1493] [-70]\nNew Enemy [enemy] at x, y: [1720] [-11]\nthen glide [2] secs to x: [1635] y: [-11]\nNew Enemy [enemy] at x, y: [2064] [-96]\n\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\n\n@Enemies\n\ndefine move enemy\nset rotation style [left-right v]\npoint towards (player v)\nclear graphic effects\nswitch costume to (costume1 v)\nset [old x v] to (x)\nif <(type) = [3]> then\n    set size to (100) %\n    set [x v] to (round ((orig x) + ((move x) * ([abs v] of (((((TICK) / (div)) + (offset)) mod (2)) - (1)) ))))\n    set [y v] to (round ((orig y) + ((move y) * ([abs v] of (((((TICK) / (div)) + (offset)) mod (2)) - (1)) ))))\nelse\n    set [x v] to (round ((orig x) + ((move x) * ([abs v] of (((((TICK) / (div)) + (offset)) mod (2)) - (1)) ))))\n    set [y v] to (round ((orig y) + ((move y) * ([abs v] of (((((TICK) / (div)) + (offset)) mod (2)) - (1)) ))))\nend\nif <<touching (player v)?> and <(([y position v] of [player v]) - (((type) * (6)) - (5))) < (y position)>> then\n    broadcast (Reset v)\n    set [exit v] to [die]\n    set [speed y v] to [-10]\n    hide\nend\nif <<touching (player v)?> and <(([y position v] of [player v]) - (((type) * (6)) - (5))) > (y position)>> then\n    broadcast (bounce v)\n    hide\n    delete this clone\nend\nPosition\nset [color v] effect to (((type) - (2)) * (140))\nswitch costume to ((((TICK) * ((div) / (100))) mod (12)) + (1))\n\ndefine Position\nposition at ((x) - (Scroll x)) ((y) - (Scroll y))\n\ndefine then glide (time) secs to x: (x) y: (y)\nset [type v] to [2]\nset [orig x v] to (x)\nset [orig y v] to (y)\nset [move x v] to ((x) - (x))\nset [move y v] to ((y) - (y))\nset [div v] to ((30) * (time))\nset [offset v] to [0]\n\ndefine Follow\nif <(visible) > [0]> then\n    if <(([x position v] of [player v]) + (Scroll x)) < (x)> then\n        change [move x v] by (-1)\n    end\n    if <(x) < (([x position v] of [player v]) + (Scroll x))> then\n        change [move x v] by (1)\n    end\n    if <(move x) > [5]> then\n        set [move x v] to [5]\n    end\n    if <[-5] > (move x)> then\n        set [move x v] to [-5]\n    end\nend\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [setup v]\nhide\nset [type v] to []\nif <(Level) = [1]> then\n    New Enemy [minion] at x, y: [650] [-10]\n    then glide [2.5] secs to x: [550] y: [-10]\n    New Enemy [minion2] at x, y: [550] [-10]\n    then glide [2] secs to x: [650] y: [-10]\n    New Enemy [minion3] at x, y: [800] [42]\n    then glide [2] secs to x: [900] y: [42]\n    New Enemy [] at x, y: [] []\nelse\n    if <(Level) = [2]> then\n        New Enemy [minion4] at x, y: [1000] [-10]\n        then glide [2] secs to x: [900] y: [-10]\n        New Enemy [] at x, y: [] []\n    else\n        if <(Level) = [3]> then\n            New Enemy [minion5] at x, y: [200] [-10]\n            then glide [2] secs to x: [300] y: [-10]\n            New Enemy [minion6] at x, y: [1120] [135]\n            then glide [2] secs to x: [1190] y: [135]\n            New Enemy [] at x, y: [] []\n        else\n        end\n    end\nend\nset [x v] to [9999999999]\n\nwhen I receive [tick v]\nif <(type) > []> then\n    if <(type) = [2]> then\n        move enemy\n    else\n        if <(type) = [3]> then\n            set size to (100) %\n            move enemy\n        else\n            if <(type) = [4]> then\n        end\n    end\n    Position\nend\n\ndefine position at (x) (y)\nset size to (200) %\ngo to x: (x) y: (y)\nset size to (100) %\nif <(type) = [3]> then\n    set size to (100) %\nend\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\n    set [visible v] to [1]\nelse\n    hide\n    set [visible v] to [0]\nend\nif <((old x) - (x)) > [0]> then\n    point in direction (-90)\nelse\n    point in direction (90)\nend\n\nwhen flag clicked\nhide\n\ndefine then rotate (time) secs\nset rotation style [all around v]\nset [type v] to [4]\nset [div v] to ((time) * (30))\n\ndefine then chase (time) secs to x: (x) (y)\nset [type v] to [3]\nset [orig x v] to (x)\nset [orig y v] to (y)\nset [move x v] to ((x) - (x))\nset [move y v] to ((y) - (y))\nset [div v] to ((30) * (time))\nset [offset v] to [0]\n\ndefine New Enemy (costume) at x, y: (x) (y)\ncreate clone of (_myself_ v)\nset rotation style [left-right v]\nswitch costume to (costume)\nset [type v] to [1]\nset [x v] to (x)\nset [y v] to (y)\nset [orig x v] to (x)\nset [orig y v] to (y)\nset [old x v] to [0]\n\nthen glide [2.5] secs to x: [550] y: [-10]\nNew Enemy [minion2] at x, y: [550] [-10]\nthen glide [2] secs to x: [650] y: [-10]\nNew Enemy [minion3] at x, y: [800] [42]\nthen glide [2] secs to x: [900] y: [42]\nNew Enemy [] at x, y: [] []\n\n@intro\n\nwhen I start as a clone\nshow\nif <(id) = [0]> then\n    go [forward v] (1) layers\n    go to x: (-240) y: (0)\n    switch costume to (costume2 v)\n    point in direction (90)\n    set [velocity v] to [100]\n    repeat (20)\n        change [velocity v] by (0.5)\n        change x by (velocity)\n    end\nelse\n    set [velocity v] to [5]\n    repeat (18)\n        change [velocity v] by (-0.5)\n    end\n    set size to (100) %\n    if <(id) = [1]> then\n        go [forward v] (1) layers\n        show\n        go to x: (200) y: (0)\n        switch costume to (costume3 v)\n        go to [front v] layer\n        point in direction (90)\n        go to x: (0) y: (0)\n        show\n        repeat (35)\n            change x by ((velocity) * (-1))\n        end\n        point in direction (90)\n        go to x: (200) y: (0)\n        change [id v] by (1)\n        CLONES 2\n        hide\n        wait (0.0000000001) seconds\n        show\n        go to x: (200) y: (-200)\n        switch costume to (costume4 v)\n        go to [front v] layer\n        point in direction (90)\n        go to x: (0) y: (0)\n        repeat (60)\n            change x by ((velocity) * (-0.0000000000000000000000000000000000000000000000000000000001))\n            turn right ((velocity) * (1)) degrees\n        end\n        point in direction (90)\n        go to x: (200) y: (0)\n        hide\n        show\n        switch costume to (costume5 v)\n        broadcast (end v) and wait\n    end\nend\n\nwhen I receive [end v]\nshow\nrepeat (20)\n    change [ghost v] effect by (5)\n    change volume by (-5)\nend\nhide\nbroadcast (game start v) and wait\nstop [other scripts in sprite v]\ndelete this clone\n\ndefine clones\n\ndefine CLONES 2\n\nwhen I receive [story end v]\n\nwhen flag clicked\nset volume to (100) %\nset [velocity v] to [0]\nset size to (100) %\nshow\nswitch costume to (costume1 v)\ngo to x: (0) y: (0)\ngo to [front v] layer\nset rotation style [all around v]\nset [id v] to [0]\ncreate clone of (_myself_ v)\nwait (0) seconds\nset [id v] to [1]\ncreate clone of (_myself_ v)\nwait until <key (space v) pressed?>\nbroadcast (end v)\n\n@stamp\n\nwhen I start as a clone\nset size to (30) %\nshow\ngo to (player v)\nset [stamp: x2 v] to ([x v] of [player v])\nset [y v] to ([y v] of [player v])\ngo to [back v] layer\ngo [forward v] (5) layers\nrepeat (10)\n    position ((stamp: x2) - (Scroll x)) ((y) - (Scroll y))\n    change size by (-1.5)\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\nwhen flag clicked\nhide\n\nwait (0) seconds\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\n\nwhen flag clicked\nhide\n\n@Danger\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [setup v]\nhide\nset [danger: x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (level 1 1 v)\n    Clones at x: [360] y: [0]\n    Clones at x: [360] y: [0]\n    Clones at x: [360] y: [0]\n    Clones at x: [360] y: [0]\n    Clones at x: [360] y: [0]\n    Clones at x: [360] y: [0]\nelse\n    if <(Level) = [2]> then\n        switch costume to (level 2 1 v)\n        Clones at x: [360] y: [0]\n        Clones at x: [360] y: [0]\n        Clones at x: [360] y: [0]\n        Clones at x: [360] y: [0]\n        Clones at x: [360] y: [0]\n    else\n        if <(Level) = [3]> then\n            switch costume to (level 3 1 v)\n            Clones at x: [360] y: [0]\n            Clones at x: [360] y: [0]\n            Clones at x: [360] y: [0]\n            Clones at x: [360] y: [0]\n        end\n    end\nend\nset [danger: x v] to [99999999999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [tick v]\nposition ((Danger: x) - (Scroll x)) ((y) - (Scroll y))\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen flag clicked\nhide\n\ndefine Clones at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [danger: x v] by (x)\nchange [y v] by (y)\nnext costume\n\nClones at x: [360] y: [0]\n\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\n\n@snow\n\nwhen flag clicked\nhide\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\ngo to [back v] layer\nshow\ngo to x: (pick random (-232) to (232)) y: (140)\nrepeat until <touching (_edge_ v)?>\n    point in direction (snow)\n    move (10) steps\nend\ndelete this clone\n\nwhen flag clicked\nhide\nforever\n    set [snow v] to [175]\n    wait (pick random (5) to (10)) seconds\n    set [snow v] to [180]\n    wait (pick random (5) to (10)) seconds\n    set [snow v] to [170]\n    wait (pick random (5) to (10)) seconds\n    set [snow v] to [-176]\n    wait (pick random (5) to (10)) seconds\n    set [snow v] to [-174]\n    wait (pick random (5) to (10)) seconds\n    set [snow v] to [-170]\n    wait (pick random (5) to (10)) seconds\n    set [snow v] to [171]\n    wait (pick random (5) to (10)) seconds\nend\n\n@thumbnail \n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\ngo to x: (11) y: (-12)\nswitch costume to (costume1 v)\ngo to [front v] layer\nforever\n    go to [front v] layer\nend\n\n@fake\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [setup v]\nhide\ngo to [front v] layer\nset [danger: x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (level 1 1 v)\n    Clones at x: [600] y: [0]\nelse\n    if <(Level) = [2]> then\n        switch costume to (level 1 5 v)\n    else\n        if <(Level) = [3]> then\n            switch costume to (level 3 1 v)\n        end\n    end\nend\nset [danger: x v] to [99999999999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [tick v]\nposition ((Danger: x) - (Scroll x)) ((y) - (Scroll y))\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen flag clicked\nhide\n\ndefine Clones at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [danger: x v] by (x)\nchange [y v] by (y)\nnext costume\n\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\nClones at x: [360] y: [0]\n\n@diamond\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [setup v]\nshow\nset [collected v] to [0]\nset [collected maximum v] to [0]\nset [coins: x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (snowflake v)\n    Clones at x: [320] y: [50]\n    Clones at x: [950] y: [175]\nelse\n    if <(Level) = [2]> then\n        switch costume to (snowflake v)\n        Clones at x: [80] y: [60]\n        Clones at x: [810] y: [-10]\n    else\n        if <(Level) = [3]> then\n            switch costume to (snowflake v)\n            Clones at x: [100] y: [0]\n            Clones at x: [800] y: [180]\n        else\n            hide\n            set [ghost v] effect to (100)\n        end\n    end\nend\nset [coins: x v] to [-999999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [tick v]\nposition ((Coins: x) - (Scroll x)) ((y) - (Scroll y))\nif <touching (player v)?> then\n    change [collected v] by (1)\n    if <(collected) = [2]> then\n        broadcast (Open Portal v)\n    end\n    delete this clone\nend\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen flag clicked\nhide\n\ndefine Clones at x: (x) y: (y)\nset size to (100) %\nset [coins: x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\n@Platforms\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((Platforms: x) - (Scroll x)) ((y) - (Scroll y))\n\nwhen I receive [setup v]\nhide\nset [platforms: x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (level 1 1 v)\n    Clones at x: [360] y: [0]\n    Clones at x: [360] y: [0]\n    Clones at x: [360] y: [0]\n    Clones at x: [360] y: [0]\n    Clones at x: [360] y: [0]\n    Clones at x: [360] y: [0]\nelse\n    if <(Level) = [2]> then\n        switch costume to (level 2 1 v)\n        Clones at x: [360] y: [0]\n        Clones at x: [360] y: [0]\n        Clones at x: [360] y: [0]\n        Clones at x: [360] y: [0]\n        Clones at x: [360] y: [0]\n    else\n        if <(Level) = [3]> then\n            switch costume to (level 3 1 v)\n            Clones at x: [360] y: [0]\n            Clones at x: [360] y: [0]\n            Clones at x: [360] y: [0]\n            Clones at x: [360] y: [0]\n        else\n            switch costume to (end? v)\n            Clones at x: [360] y: [0]\n        end\n    end\nend\nset [platforms: x v] to [-99999999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [tick v]\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen flag clicked\nhide\n\ndefine Clones at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [platforms: x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@story\n\n@Exit\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [setup v]\nhide\nset [collected v] to [0]\nset [exit2: x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (closed v)\n    Clones at x: [2000] y: [94]\nelse\n    if <(Level) = [2]> then\n        switch costume to (closed v)\n        Clones at x: [1450] y: [94]\n    else\n        if <(Level) = [3]> then\n            switch costume to (closed v)\n            Clones at x: [1200] y: [200]\n        else\n            switch costume to (closed v)\n            change [ghost v] effect by (100)\n            hide\n        end\n    end\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [tick v]\nposition ((Exit2: x) - (Scroll x)) ((y) - (Scroll y))\nif <<(costume [name v]) = [open]> and <touching (player v)?>> then\n    set [exit v] to [win]\nend\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen flag clicked\nhide\n\ndefine Clones at x: (x) y: (y)\nset size to (100) %\nset [exit2: x v] to (x)\nset [y v] to (y)\n\nwhen I receive [open portal v]\nswitch costume to (open v)\n\n@player\n\ndefine Game - Win\nrepeat (50)\n    point towards (exit v)\n    turn right (65) degrees\n    move ((distance to [exit v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nhide\nbroadcast (transition v)\nwait (1) seconds\nchange [level v] by (1)\n\nbroadcast (transition v)\nwait (1) seconds\n\nwhen I receive [play game v]\n\nwhen flag clicked\nhide\n\nbroadcast (Tick v) and wait\n\nwhen I receive [bounce v]\nset [sy v] to [15]\n\nwhen I receive [level select v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen I receive [bounce v]\nset [sy v] to [15]\n\nwhen I receive [green flag v]\nclear graphic effects\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    Game on\n    repeat until <(Exit) > []>\n        Tick\n        broadcast (Tick v)\n        change [tick v] by (1)\n    end\n    if <(Exit) = [win]> then\n        Game - Win\n    else\n        Game - Die\n    end\nend\n\ndefine Game on\nhide\nset size to (100) %\nset [x v] to [0]\nclear graphic effects\nset [tick v] to [0]\nset [y v] to [0]\nset [sx v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset [scroll x v] to [0]\nset [scroll y v] to [0]\npoint in direction (-90)\nshow\n\ndefine Tick\nset rotation style [don't rotate v]\nif <<key (left arrow v) pressed?> or <<(left key pressed) = [1]> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>>> then\n    change [sx v] by (-1)\nend\nif <<key (right arrow v) pressed?> or <<(right key pressed) = [1]> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>>> then\n    change [sx v] by (1)\nend\nif <key (r v) pressed?> then\n    broadcast (Play Game v) and wait\nend\nif <(sx) > [10]> then\n    set [sx v] to [10]\nend\nif <[-10] > (sx)> then\n    set [sx v] to [-10]\nend\nif <not <(sx) = [0]>> then\n    Change Player x by (sx)\nend\nif <<key (up arrow v) pressed?> or <<(up key pressed) = [1]> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>> then\n    if <(in air) < [4]> then\n        set [sy v] to [16]\n    end\nend\nif <<touching (platforms v)?> and <touching color (#93ff93)?>> then\n    set [sy v] to [30]\nend\nset [sx v] to ((sx) * (0.9))\nchange [sy v] by (-2)\nChange Player y by (sy)\nTest - Die\nchange [scroll x v] by (round (((x) - (Scroll x)) / (10)))\nif <(Scroll x) < [0]> then\n    set [scroll x v] to [0]\nend\nif <(Level) < [3]> then\n    if <[1400] < (Scroll x)> then\n        set [scroll x v] to [1750]\n    end\nelse\n    if <(Level) = [4]> then\n        if <[0] < (Scroll x)> then\n            set [scroll x v] to [0]\n        end\n    else\n        if <[2000] < (Scroll x)> then\n            set [scroll x v] to [2000]\n        end\n    end\nend\nif <(Scroll y) < [0]> then\n    set [scroll y v] to [0]\nend\nif <(Level) = [4]> then\n    if <[2000] < (Scroll y)> then\n        set [scroll y v] to [2000]\n    end\nelse\n    if <[100] < (Scroll y)> then\n        set [scroll y v] to [100]\n    end\nend\nchange [scroll y v] by (round (((y) - (Scroll y)) / (10)))\nif <(Level) = [5]> then\n    set [scroll x v] to [0]\n    set [scroll y v] to [0]\nend\nPosition\nif <(y) < [-180]> then\n    set [exit v] to [die]\nend\nSet Costume\n\ndefine Change Player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (platforms v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine Position\ngo to x: ((x) - (Scroll x)) y: ((y) - (Scroll y))\n\ndefine Change Player x by (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platforms v)?> then\n    repeat (8)\n        change [y v] by (1)\n        Position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-8)\n    repeat until <not <touching (platforms v)?>>\n        if <(sx) > [0]> then\n            set [sx v] to [0]\n            change [x v] by (-1)\n        else\n            set [sx v] to [0]\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\ndefine Game - Die\nrepeat (5)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\nhide\nset [exit v] to []\nwait (0.5) seconds\n\nwhen I receive [tick v]\ncreate clone of (stamp v)\n\ndefine Test - Die\nif <touching (danger v)?> then\n    set [exit v] to [die]\nend\n\nwhen I receive [game start v]\nbroadcast (Green Flag v) and wait\nbroadcast (Play Game v) and wait\n\ndefine Set Costume\nif <(sx) > [0]> then\n    switch costume to (right v)\nelse\n    if <[0] > (sx)> then\n        switch costume to (left v)\n    else\n        switch costume to (forward v)\n    end\nend\n\n