Smiley Fighters Platformer!

Instructions: ALL COPIES CAN, AND WILL, BE TAKEN DOWN!

@Stage\n\nwhen flag clicked\nset volume to (60) %\nforever\n    play sound (pick random (1) to (2)) until done\nend\n\nwhen I receive [next! v]\nnext backdrop\n\n@Smiley\n\ndefine touch <>\nchange [fall v] by (1)\nrepeat until <not <touching (ground v)?>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [fall v] to [0]\n    end\n    set [sp. y v] to [0]\nend\n\ndefine set\nif <(fall) < [3]> then\n    if <(frame) = [0]> then\n        switch costume to (costume1 v)\n    else\n        switch costume to ([floor v] of ((4) + ((frame) mod (10))) )\n    end\nelse\nend\n\nwhen flag clicked\nforever\n    if <(x position) = [243]> then\n        broadcast (Next! v)\n    end\nend\n\nwhen I receive [next! v]\ngo to x: (-191) y: (-106)\n\nwhen flag clicked\nforever\n    if <touching color (#990000)?> then\n        set [death x v] to (x position)\n        set [death y v] to (y position)\n        repeat (25)\n            change [ghost v] effect by (4)\n        end\n        go to x: (-191) y: (-106)\n        set [ghost v] effect to (0)\n        change [smiley hp v] by (-1)\n    end\nend\n\ndefine None\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (ground v)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\n    if <<<key (w v) pressed?> or <<key (up arrow v) pressed?> or <key (space v) pressed?>>> and <([abs v] of (speed) ) > [2.5]>> then\n        set [sp. x v] to ((-1.2) * (speed))\n        set [sp. y v] to [13]\n        set [fall v] to [6]\n        set [w. jump v] to [15]\n    else\n        set [sp. x v] to [0]\n    end\nend\nchange [frame v] by (0.5)\nif <(speed) < [0]> then\n    change [frame v] by ((speed) / (-8))\nelse\n    change [frame v] by ((speed) / (8))\nend\n\nwhen flag clicked\nset [frame v] to [0]\nforever\n    change [frame v] by ((1) / (10))\n    switch costume to ([floor v] of ((4) + ((frame) mod (10))) )\nend\n\nwhen I receive [death v]\nset [death x v] to (x position)\nset [death y v] to (y position)\nrepeat (25)\n    change [ghost v] effect by (4)\nend\ngo to x: (-191) y: (-106)\nset [ghost v] effect to (0)\nchange [smiley hp v] by (-1)\n\nwhen flag clicked\nreset\nforever\n    change [sp. y v] by (-1)\n    change y by (sp. y)\n    touch <(sp. y) > [0]>\n    if <(w. jump) > [0]> then\n        change [w. jump v] by (-1)\n    else\n        set [sp. x v] to ((sp. x) * (0.75))\n        if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n            change [sp. x v] by (-2)\n        end\n        if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n            change [sp. x v] by (2)\n        end\n    end\n    if <(sp. x) < [-0.5]> then\n        walk facing (-90) change x by (sp. x)\n    else\n        if <(sp. x) > [0.5]> then\n            walk facing (90) change x by (sp. x)\n        else\n            set [frame v] to [0]\n        end\n    end\n    if <<<key (w v) pressed?> or <<key (up arrow v) pressed?> or <key (space v) pressed?>>> and <(fall) < [3]>> then\n        set [sp. y v] to [15]\n    end\n    if <(y position) < [-180]> then\n        go to x: (-191) y: (-106)\n        set [sp. y v] to [0]\n    end\nend\n\ndefine reset\nreset timer\nswitch backdrop to (backdrop1 v)\nset size to (275) %\nset [ghost v] effect to (0)\nset rotation style [left-right v]\ngo to x: (-191) y: (-106)\nshow\nset [sp. y v] to [0]\nset [sp. x v] to [0]\nset [fall v] to [10]\nset [in platform? v] to [1]\nset [frame v] to [0]\nset [w. jump v] to [0]\nset [weapon v] to [0]\nset [smiley max hp v] to [10]\nset [smiley hp v] to (Smiley Max HP)\n\nwhen flag clicked\nforever\n    if <(Smiley HP) < [1]> then\n        reset\n    end\nend\n\n@Ground\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen I receive [next! v]\nnext costume\n\n@Heart\n\nwhen flag clicked\nhide\n\ndefine show\nset [heart shown? v] to [1]\nif <(pick random (1) to (100)) = [7]> then\n    switch costume to (gold v)\nelse\n    switch costume to (normal v)\nend\nshow\n\nwhen backdrop switches to [backdrop13 v]\ngo to x: (119) y: (-127)\nshow\nrepeat until <not <(backdrop [name v]) = [backdrop13]>>\n    if <<touching (smiley v)?> and <key (t v) pressed?>> then\n        if <not <(heart shown?) = [0]>> then\n            if <([costume name v] of [heart v]) = [GOLD]> then\n                set [heart shown? v] to [0]\n                if <not <((Smiley HP) + (3)) > (Smiley Max HP)>> then\n                    change [smiley hp v] by (3)\n                end\n                hide\n            else\n                if <([costume name v] of [heart v]) = [Normal]> then\n                    set [heart shown? v] to [0]\n                    if <not <((Smiley HP) + (1)) > (Smiley Max HP)>> then\n                        change [smiley hp v] by (1)\n                    end\n                    hide\n                end\n            end\n        end\n    end\nend\nhide\n\nwhen backdrop switches to [backdrop4 v]\ngo to x: (127) y: (-9)\nshow\nrepeat until <not <(backdrop [name v]) = [backdrop4]>>\n    if <<touching (smiley v)?> and <key (t v) pressed?>> then\n        if <not <(heart shown?) = [0]>> then\n            if <([costume name v] of [heart v]) = [GOLD]> then\n                set [heart shown? v] to [0]\n                if <not <((Smiley HP) + (3)) > (Smiley Max HP)>> then\n                    change [smiley hp v] by (3)\n                end\n                hide\n            else\n                if <([costume name v] of [heart v]) = [Normal]> then\n                    set [heart shown? v] to [0]\n                    if <not <((Smiley HP) + (1)) > (Smiley Max HP)>> then\n                        change [smiley hp v] by (1)\n                    end\n                    hide\n                end\n            end\n        end\n    end\nend\nhide\n\n@Smiley HP\n\n@Box\n\nwhen flag clicked\nset [weapon v] to [none]\nhide\n\nwhen backdrop switches to [backdrop5 v]\nshow\nrepeat until <not <(backdrop [name v]) = [backdrop5]>>\n    if <<key (t v) pressed?> and <touching (smiley v)?>> then\n        if <not <(weapon) = [sword]>> then\n            set [weapon v] to [sword]\n            hide\n        end\n    end\nend\nhide\n\n@Sword\n\nwhen flag clicked\nhide\nset size to (275) %\nforever\n    if <(weapon) = [sword]> then\n        show\n        go to (smiley v)\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nswitch costume to (normal v)\nforever\n    if <(weapon) = [sword]> then\n        if <key (r v) pressed?> then\n            switch costume to (attacking v)\n            wait (0.2) seconds\n            switch costume to (normal v)\n            wait (0.2) seconds\n        end\n    end\nend\n\nwhen flag clicked\nset rotation style [left-right v]\nforever\n    if <(weapon) = [sword]> then\n        point in direction (90)\n        if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n            point in direction (-90)\n        end\n        if <<key (s v) pressed?> or <key (right arrow v) pressed?>> then\n            point in direction (90)\n        end\n    end\nend\n\n@tree\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [backdrop6 v]\nshow\nset [ghost v] effect to (0)\nrepeat until <not <(backdrop [name v]) = [backdrop6]>>\n    if <<([costume name v] of [sword v]) = [attacking]> and <touching (sword v)?>> then\n        repeat (5)\n            change [ghost v] effect by (20)\n        end\n        hide\n    end\nend\nhide\n\n@Thumb\n\nwhen flag clicked\nhide\n\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\n\n@Box2\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [backdrop9 v]\nshow\nrepeat until <not <(backdrop [name v]) = [backdrop9]>>\n    if <<key (t v) pressed?> and <touching (smiley v)?>> then\n        if <not <(weapon) = [bow]>> then\n            set [weapon v] to [bow]\n            hide\n        end\n    end\nend\nhide\n\n@Arrow\n\nwhen flag clicked\nhide\nset [arrow follow? v] to [1]\nforever\n    if <(weapon) = [bow]> then\n        if <key (r v) pressed?> then\n            create clone of (_myself_ v)\n            wait (0.6) seconds\n        end\n    end\nend\n\nwhen flag clicked\nset rotation style [left-right v]\npoint in direction (90)\nforever\n    if <(arrow follow?) = [1]> then\n        if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n            point in direction (90)\n        end\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            point in direction (-90)\n        end\n    end\nend\n\nwhen I start as a clone\nset [arrow follow? v] to [0]\ngo to (smiley v)\nshow\nrepeat until <<touching (_edge_ v)?> or <touching (ground v)?>>\n    move (11) steps\n    change y by (-1.25)\nend\nwait (0.03) seconds\nhide\nset [arrow follow? v] to [1]\ndelete this clone\n\n@Crystal\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [backdrop10 v]\nshow\nset [ghost v] effect to (0)\nrepeat until <not <(backdrop [name v]) = [backdrop10]>>\n    if <<touching (arrow v)?> or <touching (sword v)?>> then\n        repeat (5)\n            change [ghost v] effect by (20)\n        end\n        hide\n    end\nend\nhide\n\n