Gladiators (Platformer)

Instructions: *Use the W,A,S,D or Arrow Keys To Move The Player\n*Press Space To Attack an Enemy.\n*Sorry I Couldn't Add Mobile Friendly Features.(Was \n Working A Bit Messy.)\n *Play Full Screen For the Best Experience.\nPart 2 Demo: https://scratch.mit.edu/projects/416942313/

@Stage\n\nwhen flag clicked\nswitch backdrop to (2 v)\n\nwhen I receive [play v]\nforever\n    play sound [Sunlight v] until done\nend\n\nwhen I receive [start v]\nstop [other scripts in sprite v]\nbroadcast (Show v)\nswitch backdrop to (3 v)\nforever\n    play sound [Tobu - Deja Vu \(Original Mix\) v] until done\nend\n\nwhen I receive [show v]\nforever\n    if <(Level) = [21]> then\n        wait (5) seconds\n        broadcast (Outro v)\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\n@Blank\n\n@Player\n\nwhen I receive [start v]\nset size to (70) %\ngo to x: (-220) y: (-119)\nshow\n\nwhen I receive [start v]\nhide variable [show level v]\nforever\n    if <<key (x v) pressed?> and <not <(Level) = [21]>>> then\n        Game On\n        wait (0.05) seconds\n        change [level v] by (1)\n        broadcast (Delete Clones v)\n        broadcast (Create Clone v)\n        wait until <not <key (x v) pressed?>>\n    end\nend\n\ndefine Game On\nset [sx v] to [0]\nset [x v] to [-222]\nset [y v] to [-125]\nset [sy v] to [0]\nset [in air v] to [0]\nset [finish v] to []\npoint in direction (90)\nshow\n\ndefine Movement\nswitch costume to (hitbox v)\nif <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n    point in direction (-90)\n    change [sx v] by (-1.5)\nend\nif <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n    point in direction (90)\n    change [sx v] by (1.5)\nend\nset [sx v] to ((sx) * (0.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    Change Player x by (round (sx))\nend\nif <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n    if <(in air) < [4]> then\n        set [sy v] to [16]\n    end\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nChange Player y by (sy)\nDie\nPosition\nif <(y) < [-180]> then\n    set [finish v] to [No]\nend\nif <<(x position) > [235]> and <not <(Level) = [21]>>> then\n    broadcast (Show v)\n    set [finish v] to [Yes]\nend\nswitch costume to (Player)\n\nwhen I receive [start v]\nset [blink v] to [No]\nhide\ngo to [front v] layer\n\nwhen I receive [start v]\nset [level v] to [1]\nforever\n    Game On\n    repeat until <(Finish) > []>\n        Movement\n    end\n    if <(Finish) = [Yes]> then\n        Game Con\n    else\n        Game End\n    end\nend\n\ndefine Change Player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (platform v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine Position\ngo to x: (x) y: (y)\n\ndefine Change Player x by (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platform v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (platform v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n        if <(sx) > [0]> then\n            set [sx v] to [-15]\n        else\n            set [sx v] to [15]\n        end\n        set [in air v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <touching (platform v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\ndefine Game End\nset [blink v] to [Yes]\nrepeat (2)\n    hide\n    wait (0.05) seconds\n    show\n    wait (0.05) seconds\nend\nhide\nchange [health v] by (-1)\nset [blink v] to [No]\nbroadcast (Delete Clones v)\nbroadcast (Create Clone v)\n\ndefine Die\nif <<<touching (danger v)?> or <touching (enemy v)?>> and <(Blink) = [No]>> then\n    set [finish v] to [No]\nend\n\ndefine Game Con\nhide\nchange [level v] by (1)\nbroadcast (Text v)\nbroadcast (Delete Clones v)\nbroadcast (Create Clone v)\n\nwhen flag clicked\nhide\n\nwhen I receive [menu v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [outro v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@Danger\n\nwhen I receive [start v]\ngo to [back v] layer\nshow\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nforever\n    if <(Level) = [26]> then\n        hide\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\nwhen I receive [menu v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [outro v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@Costume\n\nwhen I receive [menu v]\nset [player v] to [1]\nshow\nforever\n    go to x: (10) y: (1)\n    set size to (200) %\n    switch costume to (Player)\nend\n\nwhen I receive [start v]\nhide\n\nwhen I receive [instruction v]\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [menu v]\nforever\n    if <(Player) = [0]> then\n        set [player v] to [10]\n    end\n    if <(Player) = [11]> then\n        set [player v] to [1]\n    end\nend\n\n@Splash\n\nwhen I receive [start v]\nhide\n\nwhen I receive [menu v]\nset [problem v] to [2]\nswitch costume to (menu v)\nshow\nwait (0.5) seconds\nforever\n    go to [back v] layer\n    go to x: (0) y: (0)\n    if <<mouse down?> and <(mouse y) < [-120]>> then\n        wait (0.1) seconds\n        broadcast (Start v)\n        set [problem v] to [0]\n        wait until <not <mouse down?>>\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\nswitch costume to (splash v)\ngo to [back v] layer\nshow\nforever\n    go to x: (0) y: (0)\n    if <mouse down?> then\n        broadcast (Menu v)\n        wait until <not <mouse down?>>\n        stop [this script v]\n    end\nend\n\n@Arrows\n\nwhen I receive [menu v]\nstop [other scripts in sprite v]\ncreate clone of (_myself_ v)\nswitch costume to (right v)\nshow\nwait (0.1) seconds\nforever\n    go to x: (0) y: (0)\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (10)\n        if <mouse down?> then\n            start sound [Finger Snap v]\n            change [player v] by (1)\n            wait until <not <mouse down?>>\n        end\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I start as a clone\nshow\nswitch costume to (left v)\nwait (0.1) seconds\nforever\n    go to x: (0) y: (0)\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (10)\n        if <mouse down?> then\n            start sound [Finger Snap v]\n            change [player v] by (-1)\n            wait until <not <mouse down?>>\n        end\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I receive [start v]\nhide\ndelete this clone\n\nwhen I receive [instruction v]\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I receive [outro v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@Platform\n\nwhen I receive [start v]\nshow\ngo to [back v] layer\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [menu v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [outro v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@Weapon \n\nwhen I receive [start v]\nhide\ngo to [back v] layer\nbroadcast (Show v)\nforever\n    switch costume to (sword  v)\n    set size to (115) %\n    if <<key (space v) pressed?> or <(attack) = [Yes]>> then\n        if <([direction v] of [player v]) = [90]> then\n            point in direction (90)\n            show\n            repeat (7)\n                turn right (15) degrees\n            end\n            hide\n        end\n        if <([direction v] of [player v]) = [-90]> then\n            point in direction (90)\n            show\n            repeat (7)\n                turn left (15) degrees\n            end\n            hide\n        end\n    end\nend\n\nwhen I receive [start v]\nforever\n    go to (player v)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [menu v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [outro v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@Enemy\n\ndefine clone at x: (x) y: (y) speed: (speed) size: (size)\nset size to (size) %\ngo to x: (x) y: (y)\nset [x v] to (speed)\ncreate clone of (_myself_ v)\nset [die v] to [0]\n\nwhen I start as a clone\nshow\nforever\n    set size to (70) %\n    if <(die) = [0]> then\n        Physics\n    end\nend\n\ndefine Physics\nchange x by (x)\nchange [y v] by (-1)\nif <<touching (platform v)?> or <touching (_edge_ v)?>> then\n    change y by (1)\nend\nif <<touching (platform v)?> or <touching (_edge_ v)?>> then\n    change y by (1)\nend\nif <<touching (platform v)?> or <touching (_edge_ v)?>> then\n    change y by (1)\nend\nif <<touching (platform v)?> or <touching (_edge_ v)?>> then\n    change y by (1)\nend\nif <<touching (platform v)?> or <touching (_edge_ v)?>> then\n    change y by (1)\nend\nif <<touching (platform v)?> or <touching (_edge_ v)?>> then\n    change y by (1)\nend\nif <<touching (platform v)?> or <touching (_edge_ v)?>> then\n    change y by (-6)\n    repeat until <not <<touching (platform v)?> or <touching (_edge_ v)?>>>\n        change x by ((([abs v] of (x) ) / (x)) * (-1))\n    end\n    set [x v] to ((0) - (x))\nend\nchange y by (y)\nif <<touching (platform v)?> or <touching (_edge_ v)?>> then\n    repeat until <not <<touching (platform v)?> or <touching (_edge_ v)?>>>\n        change y by ((([abs v] of (y) ) / (y)) * (-1))\n    end\n    set [y v] to [10]\nend\n\nwhen I receive [create clone v]\nif <(Level) = [2]> then\n    clone at x: [205] y: [-77] speed: [2] size: [70]\nend\nif <(Level) = [3]> then\n    clone at x: [-21] y: [-122] speed: [3] size: [70]\n    clone at x: [112] y: [-122] speed: [3] size: [70]\nend\nif <(Level) = [6]> then\n    clone at x: [24] y: [-122] speed: [3] size: [70]\nend\nif <(Level) = [9]> then\n    clone at x: [24] y: [-122] speed: [3] size: [70]\nend\nif <(Level) = [12]> then\n    clone at x: [-21] y: [-122] speed: [3] size: [70]\n    clone at x: [112] y: [-122] speed: [3] size: [70]\nend\nif <(Level) = [13]> then\n    clone at x: [-21] y: [-122] speed: [4] size: [70]\n    clone at x: [112] y: [-122] speed: [5] size: [70]\n    clone at x: [24] y: [-122] speed: [3] size: [70]\nend\nif <(Level) = [17]> then\n    clone at x: [-63] y: [-122] speed: [3] size: [70]\nend\nif <(Level) = [19]> then\n    clone at x: [-63] y: [-73] speed: [3] size: [70]\n    clone at x: [-23] y: [-73] speed: [2] size: [70]\n    clone at x: [24] y: [-73] speed: [3] size: [70]\n    clone at x: [66] y: [-73] speed: [2] size: [70]\nend\nif <(Level) = [20]> then\n    clone at x: [45] y: [-122] speed: [7] size: [70]\n    clone at x: [125] y: [-122] speed: [5] size: [70]\n    clone at x: [207] y: [-122] speed: [6] size: [70]\nend\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nforever\n    if <touching (weapon  v)?> then\n        point in direction (90)\n        clear graphic effects\n        set [die v] to [2]\n        repeat until <(y position) < [-175]>\n            change [ghost v] effect by (5)\n            change y by (-10)\n            turn right (15) degrees\n        end\n        delete this clone\n    end\nend\n\nwhen I receive [delete clones v]\ndelete this clone\n\nwhen I receive [menu v]\nstop [other scripts in sprite v]\nhide\n\nwhen I start as a clone\nforever\n    if <(problem) = [2]> then\n        delete this clone\n    end\nend\n\nwhen I receive [outro v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen I receive [outro v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@Healthbar\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nset [health v] to [10]\nshow\nforever\n    go to (player v)\n    change y by (25)\n    switch costume to (Health)\n    if <(Health) < [1]> then\n        broadcast (Menu v)\n    end\nend\n\nwhen I receive [menu v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [outro v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@Cloud\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nset size to (pick random (60) to (70)) %\nswitch costume to (pick random (1) to (3))\nset [ghost v] effect to (pick random (30) to (45))\nset [cside v] to (pick random (1) to (2))\nif <(cSide) = [1]> then\n    go to x: (246) y: (pick random (131) to (0))\n    repeat until <(x position) < [-243]>\n        change x by ((0) - (pick random (0.5) to (2)))\n    end\nelse\n    go to x: (-246) y: (pick random (131) to (0))\n    repeat until <(x position) > [243]>\n        change x by (pick random (0.5) to (2))\n    end\nend\ndelete this clone\n\nwhen I receive [start v]\ncreate clone of (_myself_ v)\nforever\n    wait (pick random (2.5) to (5)) seconds\n    create clone of (_myself_ v)\nend\n\nwhen I receive [menu v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [outro v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@Text\n\nwhen I receive [start v]\nbroadcast (Text v)\nshow\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\nend\n\nwhen I receive [text v]\nset [ghost v] effect to (100)\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [menu v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [outro v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen I receive [outro v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@Menu blablaba\n\nwhen flag clicked\nhide\n\nwhen I receive [menu v]\nshow\nforever\n    turn right (5) degrees\nend\n\nwhen I receive [menu v]\ngo to [back v] layer\ngo [forward v] (1) layers\nforever\n    go to x: (5) y: (0)\nend\n\nwhen I receive [start v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [outro v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@Bg\n\nwhen flag clicked\nhide\n\nwhen I receive [menu v]\ncreate clone of (_myself_ v)\nshow\nswitch costume to (backdrop1 v)\nset size to (100) %\nswitch costume to (lines v)\nset [ghost v] effect to (75)\ngo to [back v] layer\nforever\n    go to x: (0) y: (0)\n    repeat (200)\n        change x by (0.5)\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I start as a clone\nset [ghost v] effect to (100)\nrepeat (12)\n    change [ghost v] effect by (-1.25)\nend\n\nwhen I start as a clone\nswitch costume to (backdrop1 v)\ngo to x: (0) y: (0)\nset size to (100) %\nset [circle size v] to [0]\ngo to [back v] layer\nshow\nforever\n    change [circle size v] by (2)\n    switch costume to (backdrop1 v)\n    change size by (([sin v] of (circle size) ) / (2))\n    switch costume to (circle v)\n    turn right (1) degrees\n    set [brightness v] effect to (0)\nend\n\nwhen I receive [start v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen I receive [outro v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    show\n    switch costume to (splash v)\n    go to [front v] layer\n    go to x: (0) y: (0)\n    set [ghost v] effect to (100)\nend\n\n@Intro\n\nwhen flag clicked\nset [intro v] to [Yes]\nstart sound [Zaza - Be Together v]\ngo to x: (0) y: (0)\nswitch costume to (logo v)\npoint in direction (-70)\nset [ghost v] effect to (100)\nset size to (20) %\nshow\nrepeat (17)\n    turn left (10) degrees\n    change [ghost v] effect by (-5)\n    change size by (4)\nend\nrepeat (3)\n    turn left (7.5) degrees\n    change [ghost v] effect by (-3.75)\n    change size by (3)\nend\nrepeat (1)\n    turn left (5) degrees\n    change [ghost v] effect by (-2.5)\n    change size by (2)\nend\nrepeat (1)\n    turn left (3) degrees\n    set size to (100) %\n    clear graphic effects\nend\nwait (0.5) seconds\nwait (5.5) seconds\nstart sound [car passing v]\ncreate clone of (_myself_ v)\nswitch costume to (glide v)\ngo to x: (-800) y: (0)\nglide (0.2) secs to x: (0) y: (0)\nbroadcast (del v)\nbroadcast (Play v)\nglide (0.2) secs to x: (800) y: (0)\nhide\nstop [other scripts in sprite v]\n\nwhen flag clicked\nwait (1.7) seconds\nset [x v] to [2]\nrepeat (8)\n    wait (0.4) seconds\n    create clone of (_myself_ v)\n    change [x v] by (1)\nend\nset [x v] to [999]\n\nwhen I receive [del v]\ndelete this clone\n\nwhen I start as a clone\nif <(intro) = [Yes]> then\n    if <(x) = [999]> then\nelse\n    go to [back v] layer\n    clear graphic effects\n    set size to (110) %\n    go to x: (0) y: (0)\n    switch costume to (costume1 v)\nend\n\nwhen I receive [outro v]\ngo to x: (0) y: (-25)\nshow\nset [sine v] to [0]\nswitch costume to (logo v)\nset [intro v] to [No]\ncreate clone of (_myself_ v)\nforever\n    change [sine v] by (7.5)\n    point in direction ((([sin v] of (sine) ) * (15)) + (90))\n    set size to ((([sin v] of ((sine) * (2)) ) * (25)) + (150)) %\nend\n\nwhen I receive [outro v]\nforever\n    play sound [Outro Music v] until done\nend\n\nwhen flag clicked\nwait (5.5) seconds\nstart sound [recording1 v]\n\n