Combat-Based Platformer
@Stage\n\nwhen flag clicked\nforever\n    play sound [CrowsSE v] until done\nend\n\nwhen flag clicked\nforever\n    play sound [OwlSE v] until done\nend\n\nwhen flag clicked\nforever\n    play sound [CricketsSE v] until done\nend\n\n@Player Body\n\nwhen I receive [start v]\nforever\n    if <key (space v) pressed?> then\n        switch costume to (swing v)\n        wait (0.05) seconds\n        start sound [HittingSE v]\n        switch costume to (swing2 v)\n        broadcast (Hit v)\n        wait (0.05) seconds\n        switch costume to (swing3 v)\n        wait (0.05) seconds\n        switch costume to (swing4 v)\n        wait (0.05) seconds\n        switch costume to (idle v)\n        wait (0.1) seconds\n    else\n        if <<<key (a v) pressed?> or <key (d v) pressed?>> or <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>>> then\n            switch costume to (walk1 v)\n            wait (0.08) seconds\n            switch costume to (walk2 v)\n            wait (0.09) seconds\n            switch costume to (walk3 v)\n            wait (0.05) seconds\n        else\n            wait (0.1) seconds\n            switch costume to (idle v)\n            wait (0.1) seconds\n            switch costume to (idle2 v)\n            wait (0.1) seconds\n            switch costume to (idle3 v)\n        end\n    end\nend\n\nwhen I receive [start v]\nset [playerhealth v] to [3]\nset [xpos v] to [0]\ngo to x: (0) y: (0)\npoint in direction (90)\nset rotation style [left-right v]\nshow\nwait (0.03) seconds\ngo to [front v] layer\nforever\n    Scroll\nend\n\ndefine Scroll\nif <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n    if <(Xpos) > [-514]> then\n        point in direction (90)\n        change x by (5)\n    end\nend\nif <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n    if <(Xpos) < [539]> then\n        point in direction (-90)\n        change x by (-5)\n    end\nend\nchange [xpos v] by ((x position) * (-1))\ngo to x: (0) y: (0)\n\nwhen I receive [title v]\nstop [other scripts in sprite v]\n\nwhen I receive [gameover v]\nstop [other scripts in sprite v]\nforever\n    wait (0.1) seconds\n    switch costume to (idle v)\n    wait (0.1) seconds\n    switch costume to (idle2 v)\n    wait (0.1) seconds\n    switch costume to (idle3 v)\nend\n\n@Player Legs\n\nwhen I receive [start v]\nshow\nforever\n    if <<<key (a v) pressed?> or <key (d v) pressed?>> or <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>>> then\n        start sound [WalkingSE v]\n        switch costume to (walk1 v)\n        wait (0.08) seconds\n        switch costume to (walk2 v)\n        wait (0.09) seconds\n        switch costume to (walk3 v)\n        wait (0.05) seconds\n    else\n        switch costume to ([costume name v] of [player body v])\n    end\nend\n\nwhen I receive [start v]\ngo to x: (0) y: (0)\npoint in direction (90)\nset rotation style [left-right v]\ngo to [front v] layer\nforever\n    go to (player body v)\n    point in direction ([direction v] of [player body v])\nend\n\nwhen I receive [gameover v]\nstop [other scripts in sprite v]\nforever\n    wait (0.1) seconds\n    switch costume to (idle v)\n    wait (0.1) seconds\n    switch costume to (idle2 v)\n    wait (0.1) seconds\n    switch costume to (idle3 v)\nend\n\nwhen I receive [title v]\nstop [other scripts in sprite v]\n\n@Ground\n\nwhen I receive [start v]\nhide\ngo to x: (0) y: (0)\nset [clonetype v] to [1]\nwait (0.1) seconds\ncreate clone of (_myself_ v)\nset [clonetype v] to [2]\nwait (0.1) seconds\ncreate clone of (_myself_ v)\nset [clonetype v] to [3]\nwait (0.1) seconds\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nforever\n    if <(CloneType) = [1]> then\n        switch costume to (mid v)\n        go to x: (Xpos) y: (0)\n    else\n        if <(CloneType) = [2]> then\n            switch costume to (right v)\n            go to x: ((Xpos) + (400)) y: (0)\n        else\n            switch costume to (left v)\n            go to x: ((Xpos) - (400)) y: (0)\n        end\n    end\nend\n\nwhen I receive [title v]\nstop [other scripts in sprite v]\ndelete this clone\n\n@front\n\nwhen I receive [start v]\nhide\ngo to x: (0) y: (0)\nset [clonetype v] to [1]\nwait (0.1) seconds\ncreate clone of (_myself_ v)\nset [clonetype v] to [2]\nwait (0.1) seconds\ncreate clone of (_myself_ v)\nset [clonetype v] to [3]\nwait (0.1) seconds\ncreate clone of (_myself_ v)\nset [clonetype v] to [4]\nwait (0.1) seconds\ncreate clone of (_myself_ v)\nset [clonetype v] to [5]\nwait (0.1) seconds\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nwait (0.05) seconds\ngo to [front v] layer\nforever\n    if <(CloneType) = [1]> then\n        go to x: ((Xpos) * (1.5)) y: (-40)\n    else\n        if <(CloneType) = [2]> then\n            go to x: (((Xpos) * (1.5)) + (505)) y: (-40)\n        else\n            if <(CloneType) = [3]> then\n                go to x: (((Xpos) * (1.5)) + (1010)) y: (-40)\n            else\n                if <(CloneType) = [4]> then\n                    go to x: (((Xpos) * (1.5)) - (505)) y: (-40)\n                else\n                    go to x: (((Xpos) * (1.5)) - (1010)) y: (-40)\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [title v]\nstop [other scripts in sprite v]\ndelete this clone\n\n@back1\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nforever\n    if <(CloneType) = [1]> then\n        go to x: ((Xpos) * (.6)) y: (55)\n    else\n        if <(CloneType) = [2]> then\n            go to x: (((Xpos) * (.6)) + (400)) y: (55)\n        else\n            if <(CloneType) = [3]> then\n                go to x: (((Xpos) * (.6)) + (800)) y: (55)\n            else\n                if <(CloneType) = [4]> then\n                    go to x: (((Xpos) * (.6)) - (400)) y: (55)\n                else\n                    go to x: (((Xpos) * (.6)) - (800)) y: (55)\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [start v]\nhide\ngo to x: (0) y: (0)\nset [clonetype v] to [1]\ncreate clone of (_myself_ v)\nset [clonetype v] to [2]\ncreate clone of (_myself_ v)\nset [clonetype v] to [3]\ncreate clone of (_myself_ v)\nset [clonetype v] to [4]\ncreate clone of (_myself_ v)\nset [clonetype v] to [5]\ncreate clone of (_myself_ v)\n\nwhen I receive [title v]\nstop [other scripts in sprite v]\ndelete this clone\n\n@back2\n\nwhen I receive [start v]\nwait (1) seconds\nhide\ngo to x: (0) y: (0)\nset [clonetype v] to [1]\ncreate clone of (_myself_ v)\nset [clonetype v] to [2]\ncreate clone of (_myself_ v)\nset [clonetype v] to [3]\ncreate clone of (_myself_ v)\nset [clonetype v] to [4]\ncreate clone of (_myself_ v)\nset [clonetype v] to [5]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nforever\n    if <(CloneType) = [1]> then\n        go to x: ((Xpos) * (.3)) y: (66)\n    else\n        if <(CloneType) = [2]> then\n            go to x: (((Xpos) * (.3)) + (400)) y: (66)\n        else\n            if <(CloneType) = [3]> then\n                go to x: (((Xpos) * (.3)) + (800)) y: (66)\n            else\n                if <(CloneType) = [4]> then\n                    go to x: (((Xpos) * (.3)) - (400)) y: (66)\n                else\n                    go to x: (((Xpos) * (.3)) - (800)) y: (66)\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [title v]\nstop [other scripts in sprite v]\ndelete this clone\n\n@back3\n\nwhen I start as a clone\ngo to [back v] layer\nshow\nforever\n    if <(CloneType) = [1]> then\n        switch costume to (ground sun v)\n        go to x: ((Xpos) * (.1)) y: (70)\n    else\n        if <(CloneType) = [2]> then\n            switch costume to (ground v)\n            go to x: (((Xpos) * (.1)) + (400)) y: (70)\n        else\n            switch costume to (ground v)\n            go to x: (((Xpos) * (.1)) - (400)) y: (70)\n        end\n    end\nend\n\nwhen I receive [start v]\nwait (1.2) seconds\nhide\ngo to x: (0) y: (0)\nset [clonetype v] to [1]\ncreate clone of (_myself_ v)\nset [clonetype v] to [2]\ncreate clone of (_myself_ v)\nset [clonetype v] to [3]\ncreate clone of (_myself_ v)\n\nwhen I receive [title v]\nset [clonetype v] to [0]\nstop [other scripts in sprite v]\ndelete this clone\n\n@OutlineSprite1\n\nwhen I receive [start v]\nshow\nforever\n    go to [front v] layer\nend\n\n@Unasaw\n\nwhen I receive [start v]\nhide\nforever\n    if <(Gameover) = [no]> then\n        create clone of (_myself_ v)\n        wait (pick random (1) to (3)) seconds\n    end\nend\n\nwhen I start as a clone\nDirectClone\nforever\n    MoveClone\nend\n\ndefine DirectClone\nset y to (-21)\nset rotation style [left-right v]\nset [clonehealth v] to [2]\nset [clonehit/stop v] to [no]\nclear graphic effects\nswitch costume to (idle v)\nshow\nif <(pick random (1) to (2)) = [1]> then\n    set [myx v] to [450]\nelse\n    set [myx v] to [-450]\nend\n\ndefine MoveClone\npoint towards (player body v)\nset x to ((MyX) + (Xpos))\nset [clonex v] to (x position)\nif <(CloneHit/Stop) = [no]> then\n    if <([x position v] of [player body v]) > (CloneX)> then\n        change [myx v] by (3)\n    else\n        change [myx v] by (-3)\n    end\nend\n\nwhen I start as a clone\nforever\n    if <(distance to [player body v]) < [50]> then\n        set [clonehit/stop v] to [yes]\n        switch costume to (swing v)\n        wait (pick random (.4) to (1)) seconds\n        switch costume to (swing2 v)\n        wait (0.1) seconds\n        switch costume to (swing3 v)\n        wait (0.1) seconds\n        switch costume to (swing4 v)\n        set [clonehit/stop v] to [yesHIT]\n        start sound [UnasawHittingSE v]\n        wait (0.1) seconds\n        switch costume to (swing5 v)\n        wait (0.1) seconds\n        set [clonehit/stop v] to [no]\n    else\n        wait (0.08) seconds\n        switch costume to (walk v)\n        wait (0.09) seconds\n        switch costume to (walk2 v)\n        wait (0.05) seconds\n        switch costume to (walk3 v)\n    end\nend\n\nwhen I start as a clone\nforever\n    if <touching (sword hitbox v)?> then\n        set [clonehit/stop v] to [yes]\n        if <(CloneHealth) < [1]> then\n            change [score v] by (1)\n            clear graphic effects\n            go to [front v] layer\n            switch costume to (skull v)\n            stop [other scripts in sprite v]\n            start sound [ScoreSE v]\n            repeat (25)\n                set x to ((MyX) + (Xpos))\n                set [clonex v] to (x position)\n                change [ghost v] effect by (4)\n                change y by (1)\n            end\n            delete this clone\n        else\n            if <([x position v] of [player body v]) > (CloneX)> then\n                start sound [UnasawHurtSE v]\n                clear graphic effects\n                change [clonehealth v] by (-1)\n                set [clonexv v] to [10]\n                repeat (10)\n                    change [brightness v] effect by ((CloneXv) * (.7))\n                    change [myx v] by ((CloneXv) * (-1))\n                    set [clonexv v] to ((CloneXv) * (.7))\n                end\n                clear graphic effects\n                set [clonehit/stop v] to [no]\n            else\n                start sound [UnasawHurtSE v]\n                clear graphic effects\n                change [clonehealth v] by (-1)\n                set [clonexv v] to [10]\n                repeat (10)\n                    change [brightness v] effect by ((CloneXv) * (.7))\n                    change [myx v] by (CloneXv)\n                    set [clonexv v] to ((CloneXv) * (.7))\n                end\n                clear graphic effects\n                set [clonehit/stop v] to [no]\n            end\n        end\n    else\n        if <<<touching (player body v)?> or <touching (player legs v)?>> and <(CloneHit/Stop) = [yesHIT]>> then\n            broadcast (DAMAGE v)\n            change [playerhealth v] by (-1)\n            wait (1) seconds\n        end\n    end\nend\n\nwhen I receive [gameover v]\nstop [other scripts in sprite v]\nforever\n    wait (0.1) seconds\n    switch costume to (idle v)\n    wait (0.1) seconds\n    switch costume to (idle2 v)\n    wait (0.1) seconds\n    switch costume to (idle3 v)\nend\n\nwhen I receive [title v]\nset [clonehit/stop v] to [no]\ndelete this clone\n\nwhen I receive [title v]\nstop [other scripts in sprite v]\nforever\n    delete this clone\nend\n\n@Sword HITbox\n\nwhen I receive [hit v]\ngo to [front v] layer\nshow\nwait (0.2) seconds\nhide\n\nwhen I receive [start v]\nhide\nset [ghost v] effect to (100)\nforever\n    go to (player body v)\n    point in direction ([direction v] of [player body v])\nend\n\n@Damage\n\nwhen I receive [start v]\nset [gameover v] to [no]\nhide\n\nwhen I receive [damage v]\ngo to x: (0) y: (0)\nswitch costume to (costume2 v)\nhide\nif <(PlayerHealth) < [1]> then\n    set [gameover v] to [yes]\n    broadcast (Gameover v) and wait\n    stop [this script v]\nelse\n    start sound [PlayerHurtSE v]\n    clear graphic effects\n    show\n    repeat (10)\n        go to [front v] layer\n        change [ghost v] effect by (10)\n    end\nend\n\n@Score\n\nwhen I receive [start v]\nset [score v] to [0]\nhide\nset [numbercounter v] to [1]\nrepeat (10)\n    create clone of (_myself_ v)\n    change [numbercounter v] by (1)\nend\n\nwhen I start as a clone\nforever\n    go to x: (((NumberCounter) * (50)) - (((length of (Score)) * (50)) / (2))) y: (110)\n    if <(length of (Score)) < (NumberCounter)> then\n        hide\n    else\n        show\n        switch costume to (letter (NumberCounter) of (Score))\n    end\nend\n\nwhen I start as a clone\nset size to (250) %\nforever\n    point in direction (([sin v] of ((timer) * (1000)) ) + (90))\nend\n\nwhen I receive [gameover v]\nstop [other scripts in sprite v]\nset [yv v] to [16]\nrepeat (16)\n    go to [front v] layer\n    change [yv v] by (-1)\n    change y by ((Yv) * (-1))\nend\nforever\n    point in direction (([sin v] of ((timer) * (1000)) ) + (90))\nend\n\nwhen I receive [title v]\ndelete this clone\n\n@TitleScreen\n\nwhen I receive [title v]\nset [titleclone v] to [1]\ncreate clone of (_myself_ v)\nset [titleclone v] to [2]\ncreate clone of (_myself_ v)\nset [titleclone v] to [3]\ncreate clone of (_myself_ v)\nwait (0.1) seconds\nset [titleclone v] to [4]\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nforever\n    go to x: ((mouse x) * (-0.01)) y: ((mouse y) * (-0.01))\nend\n\nwhen I start as a clone\nclear graphic effects\nshow\ngo to x: (0) y: (0)\nif <(TitleClone) = [1]> then\n    set rotation style [left-right v]\n    point in direction (90)\n    go to [front v] layer\n    forever\n        switch costume to (char v)\n        wait (0.2) seconds\n        switch costume to (char2 v)\n        wait (0.2) seconds\n        switch costume to (char3 v)\n        wait (0.1) seconds\n    end\nelse\n    if <(TitleClone) = [2]> then\n        go to [front v] layer\n        switch costume to (box v)\n        set [ghost v] effect to (30)\n    else\n        if <(TitleClone) = [3]> then\n            switch costume to (title v)\n            go to [front v] layer\n            forever\n                repeat (35)\n                    change size by (0.1)\n                end\n                repeat (35)\n                    change size by (-0.1)\n                end\n            end\n        else\n            if <(TitleClone) = [4]> then\n                switch costume to (start v)\n                go to [front v] layer\n                go to x: (0) y: (-130)\n                forever\n                    if <(distance to [mouse-pointer v]) < [100]> then\n                        if <mouse down?> then\n                            wait until <not <mouse down?>>\n                            broadcast (Start v) and wait\n                            wait (0.2) seconds\n                        end\n                        point in direction (([sin v] of ((timer) * (1000)) ) + (90))\n                        change size by (((120) - (size)) / (3))\n                    else\n                        change size by (((100) - (size)) / (3))\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nbroadcast (Title v)\n\nwhen I receive [title v]\nshow\nclear graphic effects\nset size to (100) %\ngo to x: (0) y: (0)\nswitch costume to (back v)\ngo to [front v] layer\n\nwhen I receive [start v]\nstop [other scripts in sprite v]\nif <(TitleClone) = [2]> then\n    hide\nelse\n    repeat (25)\n        change [ghost v] effect by (5)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nforever\n    if <(TitleClone) = [4]> then\n        if <(distance to [mouse-pointer v]) < [100]> then\n            start sound [SelectSE v]\n            wait until <not <(distance to [mouse-pointer v]) < [100]>>\n        end\n    end\nend\n\n@GameOver\n\nwhen I receive [gameover v]\nset [gameoverclone v] to [1]\ncreate clone of (_myself_ v)\nset [gameoverclone v] to [2]\ncreate clone of (_myself_ v)\nwait (0.1) seconds\nset [gameoverclone v] to [3]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nclear graphic effects\nset size to (100) %\nif <(GameoverClone) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (box v)\n    set [ghost v] effect to (30)\n    go to [front v] layer\nelse\n    if <(GameoverClone) = [2]> then\n        switch costume to (main menu v)\n        go to [front v] layer\n        go to x: (0) y: (-130)\n        forever\n            if <(distance to [mouse-pointer v]) < [100]> then\n                if <mouse down?> then\n                    wait until <not <mouse down?>>\n                    broadcast (Title v)\n                    wait (0.2) seconds\n                end\n                point in direction (([sin v] of ((timer) * (1000)) ) + (90))\n                change size by (((120) - (size)) / (3))\n            else\n                change size by (((100) - (size)) / (3))\n            end\n        end\n    else\n        if <(GameoverClone) = [3]> then\n            go to [front v] layer\n            switch costume to (shine v)\n            forever\n                go to x: (15) y: (-9)\n                turn right (1) degrees\n            end\n        end\n    end\nend\n\nwhen I receive [gameover v]\nstart sound [LoseSE v]\nshow\nswitch costume to (gameover v)\nset size to (125) %\nforever\n    repeat (35)\n        change size by (0.1)\n    end\n    repeat (35)\n        change size by (-0.1)\n    end\nend\n\nwhen I receive [title v]\nhide\ndelete this clone\n\nwhen I start as a clone\nforever\n    if <(GameoverClone) = [2]> then\n        if <(distance to [mouse-pointer v]) < [100]> then\n            start sound [SelectSE v]\n            wait until <not <(distance to [mouse-pointer v]) < [100]>>\n        end\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nhide\nforever\n    go to [front v] layer\n    reset timer\nend\n\nwhen [timer v] > (0.1)\nshow\n\n
Directions:\n*WASD or ARROW KEYS to move\n*HOLD space to hit\n*Don't get hit by the Unisaws! If you get hit 3 times the game is over