Out of Season || A Platformer
@Stage\n\nwhen I receive [game begin v]\nwait (1) seconds\nforever\n    play sound [Treenan v] until done\nend\n\nwhen flag clicked\nset [level v] to [1]\nforever\n    switch backdrop to (SEASON)\nend\n\n@Intro\n\nwhen flag clicked\nhide\nset [cloneid v] to [0]\nrepeat (2)\n    change [cloneid v] by (1)\n    create clone of (_myself_ v)\nend\nchange [cloneid v] by (1)\nrepeat (9)\n    repeat (10)\n        create clone of (_myself_ v)\n    end\n    repeat (16)\n        change [sin v] by (8)\n    end\nend\n\nwhen I start as a clone\nclear graphic effects\nif <(CloneID) = [1]> then\n    show\n    switch costume to (costume1 v)\n    set [x v] to [-320]\n    set [y v] to [-220]\n    forever\n        change [x v] by (4.8)\n        change [y v] by (3.6)\n        go to x: (x) y: (y)\n    end\nend\nif <(CloneID) = [2]> then\n    show\n    go to x: (0) y: (0)\n    switch costume to (costume2 v)\n    set [sin v] to [0]\n    go to [front v] layer\n    forever\n        change [sin v] by (8)\n        point in direction ((([tan v] of (sin) ) * (30)) + (90))\n    end\nend\nif <(CloneID) = [3]> then\n    hide\n    go to [front v] layer\n    go [backward v] (1) layers\n    go to x: (0) y: (0)\n    point in direction (pick random (1) to (360))\n    set [color v] effect to (pick random (1) to (100))\n    set [ghost v] effect to (pick random (60) to (80))\n    set size to (pick random (150) to (350)) %\n    show\n    repeat until <touching (_edge_ v)?>\n        move (10) steps\n    end\n    delete this clone\nend\n\nwhen flag clicked\nplay sound [Owl City - Unbelievable.mp2 v] until done\nbroadcast (GAME BEGIN v)\n\nwhen I receive [game begin v]\nrepeat (25)\n    change [brightness v] effect by (4)\nend\ndelete this clone\n\n@Background effects\n\nwhen flag clicked\nhide\nforever\n    create clone of (_myself_ v)\n    switch costume to (SEASON)\nend\n\nwhen I start as a clone\nset [falling vel v] to (pick random (-1) to (-2))\ngo to x: (pick random (-230) to (230)) y: (170)\nset size to (pick random (80) to (120)) %\nshow\nrepeat until <<touching (_edge_ v)?> or <touching (player v)?>>\n    change y by (falling vel)\nend\ndelete this clone\n\n@Player\n\ndefine platfomer: jump height (jump height) ; friction (friction) ; speed (speed)\nif <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> then\n    point in direction (90)\n    change [x velocity v] by (speed)\nend\nif <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(x position) > (mouse x)>>>> then\n    point in direction (-90)\n    change [x velocity v] by ((speed) * (-1))\nend\nset [x velocity v] to ((x velocity) * (friction))\nchange x by (x velocity)\nif <touching (ground v)?> then\n    change y by (1)\n    if <touching (ground v)?> then\n        change y by (1)\n        if <touching (ground v)?> then\n            change y by (1)\n            if <touching (ground v)?> then\n                change y by (1)\n                if <touching (ground v)?> then\n                    change y by (1)\n                    if <touching (ground v)?> then\n                        change y by (1)\n                        if <touching (ground v)?> then\n                            change y by (1)\n                            if <touching (ground v)?> then\n                                change y by (1)\n                                if <touching (ground v)?> then\n                                    change x by ((x velocity) * (-1))\n                                    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n                                        if <(x velocity) > [0]> then\n                                            set [x velocity v] to [-5]\n                                        else\n                                            set [x velocity v] to [5]\n                                        end\n                                        set [y velocity v] to [10]\n                                    else\n                                        set [x velocity v] to [0]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange [y velocity v] by (-1)\nchange y by (y velocity)\nif <touching (ground v)?> then\n    change y by ((y velocity) * (-1))\n    set [y velocity v] to [0]\nend\nchange y by (-1)\nif <touching (ground v)?> then\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n        change [y velocity v] by (jump height)\n    end\nend\nchange y by (1)\nif <(x position) > [230]> then\n    broadcast (NEW LEVEL v)\nend\nif <touching (danger v)?> then\n    go to x: (-220) y: (0)\nend\nif <key (r v) pressed?> then\n    go to x: (-220) y: (0)\nend\nif <<key (n v) pressed?> and <(LEVEL) < [12]>> then\n    broadcast (NEW LEVEL v)\n    wait until <not <key (n v) pressed?>>\nend\n\nwhen I receive [game begin v]\ngo to x: (-220) y: (0)\nset [x velocity v] to [0]\nset [y velocity v] to [0]\nset [level v] to [1]\nforever\n    platfomer: jump height [15] ; friction [0.9] ; speed [1]\nend\n\nwhen I receive [new level v]\nchange [level v] by (1)\ngo to x: (-220) y: (0)\n\n@Ground\n\nwhen flag clicked\nforever\n    switch costume to (LEVEL)\n    if <[4] > (LEVEL)> then\n        set [season v] to [1]\n    end\n    if <<[7] > (LEVEL)> and <(LEVEL) > [3]>> then\n        set [season v] to [2]\n    end\n    if <<[10] > (LEVEL)> and <(LEVEL) > [6]>> then\n        set [season v] to [3]\n    end\n    if <<[13] > (LEVEL)> and <(LEVEL) > [9]>> then\n        set [season v] to [4]\n    end\nend\n\n@Coins\n\nwhen flag clicked\nshow\nswitch costume to (coin v)\nforever\n    if <touching (player v)?> then\n        hide\n        play sound [Collect v] until done\n    end\nend\n\nwhen I receive [new level v]\nnext costume\nshow\n\n@Thumbnail\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n@Danger\n\nwhen flag clicked\nforever\n    switch costume to (LEVEL)\nend\n\n@Fake\n\nwhen flag clicked\nforever\n    switch costume to (LEVEL)\nend\n\n