Environmental Platformer


@Stage\n\n@Earth\n\nwhen flag clicked\ngo to x: (-178) y: (-112)\nswitch backdrop to (backdrop1 v)\nset [level v] to [0]\nhide variable [x v]\nhide variable [y v]\nset [x v] to [0]\nset [y v] to [0]\nhide variable [environment points v]\nhide variable [deaths v]\nset [deaths v] to [0]\nset [environment points v] to [0]\nforever\n    change [y v] by (-1)\n    if <key (left arrow v) pressed?> then\n        change [x v] by (-1)\n    end\n    if <key (right arrow v) pressed?> then\n        change [x v] by (1)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (-4)\n        change x by ((x) * (-1))\n        if <key (up arrow v) pressed?> then\n            set [y v] to [15]\n            if <([abs v] of (x) ) = (x)> then\n                set [x v] to [-10]\n            else\n                set [x v] to [10]\n            end\n        else\n            set [x v] to [0]\n        end\n    end\n    change y by (y)\n    if <touching color (#000000)?> then\n        change y by ((y) - ((y) * (2)))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <<key (up arrow v) pressed?> and <touching color (#000000)?>> then\n        set [y v] to [15]\n    end\n    change y by (1)\n    if <touching color (#666600)?> then\n        change [deaths v] by (1)\n        go to x: (-193) y: (-80)\n    end\n    if <(y position) < [-160]> then\n        change [deaths v] by (1)\n        go to x: (-193) y: (-80)\n    end\n    if <(x position) > [222]> then\n        change [level v] by (1)\n        broadcast (next level v)\n        switch backdrop to (next backdrop v)\n        go to x: (-193) y: (-80)\n    end\n    if <(level) = [9]> then\n        show variable [environment points v]\n        show variable [deaths v]\n    end\nend\n\n@garbage\n\nwhen I receive [death v]\ndelete this clone\n\nwhen I receive [death v]\nBroadcast Level\n\nwhen I receive [next level v]\nBroadcast Level\n\nwhen I receive [1 v]\nhide\n\nwhen flag clicked\nforever\n    if <touching (earth v)?> then\n        hide\n        change [environment points v] by (1)\n    end\nend\n\nwhen flag clicked\nset [environment points v] to [0]\nhide\n\ndefine Broadcast Level\nif <(backdrop [name v]) = [backdrop1]> then\n    broadcast (1 v)\nend\nif <(backdrop [name v]) = [backdrop2]> then\n    broadcast (2 v)\nend\nif <(backdrop [name v]) = [backdrop3]> then\n    broadcast (3 v)\nend\nif <(backdrop [name v]) = [backdrop4]> then\n    broadcast (4 v)\nend\nif <(backdrop [name v]) = [backdrop5]> then\n    broadcast (5 v)\nend\nif <(backdrop [name v]) = [backdrop6]> then\n    broadcast (6 v)\nend\nif <(backdrop [name v]) = [backdrop7]> then\n    broadcast (7 v)\nend\nif <(backdrop [name v]) = [backdrop8]> then\n    broadcast (8 v)\nend\nif <(backdrop [name v]) = [backdrop9]> then\n    broadcast (9 v)\nend\nif <(backdrop [name v]) = [backdrop10]> then\n    broadcast (end v)\nend\n\nwhen I start as a clone\nforever\n    if <touching (earth v)?> then\n        hide\n        change [environment points v] by (1)\n        delete this clone\n    end\nend\n\nwhen I receive [2 v]\nhide\n\nwhen I receive [3 v]\nshow\ngo to x: (-79) y: (-117)\nswitch costume to (kit kat wrapper v)\n\nwhen I receive [4 v]\nhide\n\nwhen I receive [5 v]\nhide\n\nwhen I receive [6 v]\nhide\n\nwhen I receive [7 v]\nshow\nswitch costume to (plastic fork v)\ngo to x: (119) y: (-29)\n\nwhen I receive [8 v]\nhide\n\n@green waste\n\nwhen I receive [1 v]\nhide\n\nwhen I receive [next level v]\nBroadcast Level\n\nwhen I receive [death v]\ndelete this clone\n\nwhen I receive [death v]\nBroadcast Level\n\ndefine Broadcast Level\nif <(backdrop [name v]) = [backdrop1]> then\n    broadcast (1 v)\nend\nif <(backdrop [name v]) = [backdrop2]> then\n    broadcast (2 v)\nend\nif <(backdrop [name v]) = [backdrop3]> then\n    broadcast (3 v)\nend\nif <(backdrop [name v]) = [backdrop4]> then\n    broadcast (4 v)\nend\nif <(backdrop [name v]) = [backdrop5]> then\n    broadcast (5 v)\nend\nif <(backdrop [name v]) = [backdrop6]> then\n    broadcast (6 v)\nend\nif <(backdrop [name v]) = [backdrop7]> then\n    broadcast (7 v)\nend\nif <(backdrop [name v]) = [backdrop8]> then\n    broadcast (8 v)\nend\nif <(backdrop [name v]) = [backdrop9]> then\n    broadcast (9 v)\nend\nif <(backdrop [name v]) = [backdrop10]> then\n    broadcast (end v)\nend\n\nwhen flag clicked\nset [environment points v] to [0]\nhide\n\nwhen flag clicked\nforever\n    if <touching (earth v)?> then\n        hide\n        change [environment points v] by (1)\n    end\nend\n\nwhen I start as a clone\nforever\n    if <touching (earth v)?> then\n        hide\n        change [environment points v] by (1)\n        delete this clone\n    end\nend\n\nwhen I receive [3 v]\nshow\ngo to x: (183) y: (-118)\nswitch costume to (2 v)\n\nwhen I receive [2 v]\nhide\n\nwhen I receive [4 v]\nhide\n\nwhen I receive [5 v]\nshow\ngo to x: (-27) y: (-92)\nswitch costume to (1 v)\n\nwhen I receive [6 v]\nhide\n\nwhen I receive [7 v]\nhide\n\nwhen I receive [8 v]\nshow\nswitch costume to (leaf v)\ngo to x: (112) y: (85)\n\nwhen I receive [9 v]\nhide\n\n@recyclables\n\nwhen I receive [death v]\nBroadcast Level\n\nwhen I receive [next level v]\nBroadcast Level\n\nwhen I receive [death v]\ndelete this clone\n\nwhen I start as a clone\nforever\n    if <touching (earth v)?> then\n        hide\n        change [environment points v] by (1)\n        delete this clone\n    end\nend\n\ndefine Broadcast Level\nif <(backdrop [name v]) = [backdrop1]> then\n    broadcast (1 v)\nend\nif <(backdrop [name v]) = [backdrop2]> then\n    broadcast (2 v)\nend\nif <(backdrop [name v]) = [backdrop3]> then\n    broadcast (3 v)\nend\nif <(backdrop [name v]) = [backdrop4]> then\n    broadcast (4 v)\nend\nif <(backdrop [name v]) = [backdrop5]> then\n    broadcast (5 v)\nend\nif <(backdrop [name v]) = [backdrop6]> then\n    broadcast (6 v)\nend\nif <(backdrop [name v]) = [backdrop7]> then\n    broadcast (7 v)\nend\nif <(backdrop [name v]) = [backdrop8]> then\n    broadcast (8 v)\nend\nif <(backdrop [name v]) = [backdrop9]> then\n    broadcast (9 v)\nend\nif <(backdrop [name v]) = [backdrop10]> then\n    broadcast (end v)\nend\n\nwhen flag clicked\nset [environment points v] to [0]\nhide\n\nwhen flag clicked\nforever\n    if <touching (earth v)?> then\n        hide\n        change [environment points v] by (1)\n    end\nend\n\nwhen I receive [1 v]\nhide\n\nwhen I receive [3 v]\nshow\ngo to x: (54) y: (-120)\nswitch costume to (juice box v)\n\nwhen I receive [2 v]\nhide\n\nwhen I receive [4 v]\nhide\n\nwhen I receive [5 v]\nhide\n\nwhen I receive [6 v]\nshow\nswitch costume to (bottled water v)\ngo to x: (190) y: (-107)\n\nwhen I receive [7 v]\nshow\nswitch costume to (recycle bin v)\ngo to x: (18) y: (-108)\n\nwhen I receive [8 v]\nhide\n\nwhen I receive [9 v]\nhide\n\n@thumbnail\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\n\n@light switch\n\nwhen flag clicked\nset [unlock v] to [0]\nhide\n\nwhen I receive [2 v]\nhide\n\nwhen I receive [3 v]\nhide\n\nwhen I receive [1 v]\nhide\n\nwhen I receive [8 v]\nset [unlock v] to [0]\nshow\nswitch costume to (costume1 v)\ngo to x: (123) y: (-75)\nwait until <touching (earth v)?>\nswitch costume to (costume2 v)\nset [unlock v] to [1]\n\nwhen I receive [9 v]\nhide\n\nwhen I receive [4 v]\nhide\n\nwhen I receive [5 v]\nshow\nswitch costume to (costume1 v)\ngo to x: (94) y: (-109)\nwait until <touching (earth v)?>\nhide\nset [unlock v] to [1]\n\nwhen I receive [6 v]\nset [unlock v] to [0]\nshow\nswitch costume to (costume1 v)\ngo to x: (-27) y: (-59)\nwait until <touching (earth v)?>\nswitch costume to (costume2 v)\nset [unlock v] to [1]\n\nwhen I receive [7 v]\nset [unlock v] to [0]\nshow\nswitch costume to (costume1 v)\ngo to x: (126) y: (-109)\nwait until <touching (earth v)?>\nswitch costume to (costume2 v)\nset [unlock v] to [1]\n\n@barrier\n\nwhen flag clicked\nset [unlock v] to [0]\nhide\nclear graphic effects\n\nwhen I receive [5 v]\nshow\ngo to x: (-15) y: (-49)\nswitch costume to (costume1 v)\nset [ghost v] effect to (0)\nwait until <(unlock) = [1]>\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [4 v]\nhide\n\nwhen I receive [3 v]\nhide\n\nwhen I receive [2 v]\nhide\n\nwhen I receive [1 v]\nhide\n\nwhen I receive [6 v]\nshow\nclear graphic effects\nset [unlock v] to [0]\nswitch costume to (costume2 v)\ngo to x: (167) y: (-62)\nset [ghost v] effect to (0)\nwait until <(unlock) = [1]>\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [7 v]\nshow\nclear graphic effects\nset [unlock v] to [0]\nswitch costume to (costume3 v)\ngo to x: (-112) y: (-130)\nset [ghost v] effect to (0)\nwait until <(unlock) = [1]>\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [8 v]\nshow\nclear graphic effects\nset [unlock v] to [0]\nswitch costume to (costume4 v)\ngo to x: (100) y: (91)\nset [ghost v] effect to (0)\nwait until <(unlock) = [1]>\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [9 v]\nhide\n\n@golden world\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nforever\n    if <touching (earth v)?> then\n        hide\n        change [environment points v] by (46)\n    end\nend\n\nwhen I receive [1 v]\nhide\n\nwhen I receive [9 v]\nshow\n\n@golden world2\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nforever\n    if <touching (earth v)?> then\n        hide\n        change [environment points v] by (46)\n    end\nend\n\nwhen I receive [1 v]\nhide\n\nwhen I receive [9 v]\nshow\n\n