Beach - platformer
@Stage\n\nwhen flag clicked\nbroadcast (title screen v)\n\nbroadcast (start game v)\n\nwhen I receive [title screen v]\nswitch backdrop to (screens v)\n\nwhen I receive [start game v]\nswitch backdrop to (backdrop1 v)\n\nwhen flag clicked\nforever\n    play sound [Xylo1 v] until done\nend\n\n@level\n\nwhen I receive [start game v]\ngo to x: (0) y: (0)\nswitch costume to (scene 1 v)\nshow\ngo to [back v] layer\n\nwhen I receive [next scene v]\nnext costume\n\nwhen I receive [title screen v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@player\n\nwhen I receive [start game v]\ngo to x: (-211) y: (-67)\nset [transition v] to [false]\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [falling v] to [99]\npoint in direction (90)\nswitch costume to (idle v)\nclear graphic effects\nshow\ngo to [front v] layer\nforever\n    broadcast (move player v)\n    if <touching (danger v)?> then\n        broadcast (dead v) and wait\n    end\nend\n\nwhen I receive [move player v]\nchange [speed x v] by ((<key (right arrow v) pressed?> - <key (left arrow v) pressed?>) * (1))\nmove x (speed x)\nset [speed x v] to ((speed x) * (0.85))\nmove y (speed y)\nchange [speed y v] by (-1)\nif <<(falling) < [3]> and <key (up arrow v) pressed?>> then\n    set [speed y v] to [10]\nend\nif <(x position) > [240]> then\n    set [transition v] to [true]\n    broadcast (next scene v)\nend\n\ndefine move y (speed y)\nchange [falling v] by (1)\nrepeat ([abs v] of (speed y) )\n    change y by ((speed y) / ([abs v] of (speed y) ))\n    if <touching (level v)?> then\n        change y by (() - ((speed y) / ([abs v] of (speed y) )))\n        if <(speed y) > [0]> then\n            set [speed y v] to [0]\n            set [falling v] to [99]\n        else\n            set [speed y v] to [0]\n            set [falling v] to [0]\n        end\n        stop [this script v]\n    end\nend\n\nwhen I receive [next scene v]\nnext costume\nchange x by (-480)\nchange y by (1)\nwait (0) seconds\nset [transition v] to [false]\n\ndefine move x (speed x)\nchange [falling v] by (1)\nrepeat ([abs v] of (speed x) )\n    change x by ((speed x) / ([abs v] of (speed x) ))\n    if <touching (level v)?> then\n        change x by (() - ((speed x) / ([abs v] of (speed x) )))\n        set [speed x v] to [0]\n        stop [this script v]\n    end\nend\n\nwhen I receive [dead v]\nstart sound [dead v]\nrepeat (10)\n    turn right (5) degrees\n    change [ghost v] effect by (10)\n    change y by (10)\nend\nwait (0.5) seconds\nreset\n\ndefine reset\ngo to x: (-211) y: (-67)\nrepeat until <not <touching (level v)?>>\n    change y by (1)\nend\nclear graphic effects\npoint in direction (90)\nset [falling v] to [99]\nset [speed x v] to [0]\nset [speed y v] to [0]\n\nwhen I receive [title screen v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen I receive [win v]\nstop [other scripts in sprite v]\n\n@danger\n\nwhen I receive [start game v]\ngo to x: (0) y: (0)\nswitch costume to (scene 1 v)\nshow\ngo to [back v] layer\n\nwhen I receive [next scene v]\nnext costume\n\nwhen I receive [title screen v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@wave\n\nwhen I receive [start game v]\nforever\n    wait (1) seconds\n    if <(pick random (1) to (10)) = [1]> then\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I start as a clone\nshow\ngo to [back v] layer\ngo to x: (-350) y: (0)\nstart sound [Ocean Wave v]\nglide (5) secs to x: (350) y: (0)\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@clouds\n\nwhen I receive [start game v]\nforever\n    wait (0.7) seconds\n    if <(pick random (1) to (7)) = [1]> then\n        create clone of (_myself_ v)\n        wait (0.7) seconds\n    end\nend\n\nwhen I start as a clone\nswitch costume to (join [cloud-] (pick random (1) to (4)))\nshow\ngo to [back v] layer\ngo to x: (350) y: (pick random (6) to (-45))\nglide (10) secs to x: (-350) y: (y position)\n\nwhen I receive [title screen v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@play\n\nwhen I receive [title screen v]\nshow\nset size to (0) %\nforever\n    change size by ((((100) + (<touching (mouse-pointer v)?> * (15))) - (size)) / (2))\nend\n\nwhen I receive [start game v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen I receive [title screen v]\nforever\n    wait until <mouse down?>\n    if <touching (mouse-pointer v)?> then\n        wait until <not <mouse down?>>\n        broadcast (start game v)\n    end\n    wait until <not <mouse down?>>\nend\n\n@thumbnail\n\nwhen flag clicked\nshow\nforever\n    go to [front v] layer\n    set [ghost v] effect to (100)\n    go to x: (0) y: (0)\nend\n\n@sea shells\n\nwhen I receive [start game v]\nset [sea shells v] to [0]\ngo to x: (0) y: (0)\ngo to [front v] layer\ngo [backward v] (1) layers\nswitch costume to ( v)\nwait until <(sea shells) = [3]>\nwait (0.5) seconds\nbroadcast (win v)\n\nwhen I receive [next scene v]\nclear graphic effects\ngo to x: (0) y: (0)\nrepeat until <touching (player v)?>\n    switch costume to ( v)\n    switch costume to ([costume name v] of [level v])\n    show\nend\nchange [sea shells v] by (1)\nstart sound [Collect v]\nrepeat (10)\n    change y by (5)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [title screen v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@win\n\nwhen I receive [win v]\nstart sound [win v]\ngo to [front v] layer\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait until <mouse down?>\nwait until <not <mouse down?>>\nbroadcast (title screen v)\n\nwhen I receive [title screen v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@text\n\nwhen I receive [title screen v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen I receive [start game v]\nhide\nwait (0) seconds\nwait until <([costume name v] of [level v]) = [scene 1]>\ntext\nwait until <([costume name v] of [level v]) = [scene 2]>\ntext\nwait until <([costume name v] of [level v]) = [scene 3]>\ntext\nwait until <([costume name v] of [level v]) = [scene 4]>\ntext\nwait until <([costume name v] of [level v]) = [scene 5]>\ntext\nwait until <([costume name v] of [level v]) = [scene 6]>\ntext\nwait until <([costume name v] of [level v]) = [scene 7]>\ntext\nwait until <([costume name v] of [level v]) = [scene 8]>\ntext\nwait until <([costume name v] of [level v]) = [scene 9]>\ntext\nwait until <([costume name v] of [level v]) = [scene 10]>\ntext\nwait until <([costume name v] of [level v]) = [scene 11]>\ntext\nwait until <([costume name v] of [level v]) = [scene 12]>\ntext\n\ndefine text\nswitch costume to ([costume name v] of [level v])\nshow\nset y to (-100)\nrepeat (14)\n    change y by ((() - (y position)) / (3))\nend\nwait until <<key (space v) pressed?> or <(transition) = [true]>>\nwait until <<not <key (space v) pressed?>> or <(transition) = [true]>>\nrepeat (14)\n    change y by (((-50) - (y position)) / (3))\nend\nhide\n\n