Tag - 2P Platformer

Instructions: PLEASE. If you're going to remix, change something so it's not just a copy.\n\nArrow Keys to move P1\nWASD to move P2.\nYou have 60 seconds to tag each other and once the time is up, whoever isn't it claims victory! The game stops once it's over, and the thumbnail is shown.\nUPDATE 1: Added a new end screen

@Stage\n\nwhen flag clicked\nswitch backdrop to (start v)\nbroadcast (Start v)\nforever\n    if <(Time Left) > [0]> then\n        if <(Tagger) = [P1]> then\n            switch backdrop to (backdrop2 v)\n        end\n        if <(Tagger) = [P2]> then\n            switch backdrop to (backdrop1 v)\n        end\n    else\n        if <(Tagger) = [P1]> then\n            switch backdrop to (backdrop3 v)\n        end\n        if <(Tagger) = [P2]> then\n            switch backdrop to (backdrop4 v)\n        end\n    end\nend\n\nwhen flag clicked\nset [time left v] to [60]\nshow variable [time left v]\nforever\n    repeat until <(Time Left) = [0]>\n        if <(Time Left) > [15]> then\n            wait (1) seconds\n            change [time left v] by (-1)\n        end\n        if <<(Time Left) < [17]> and <(Time Left) > [0]>> then\n            wait (1) seconds\n            start sound [beep v]\n            change [time left v] by (-001)\n        end\n    end\n    stop [other scripts in sprite v]\n    start sound [Done v]\n    wait (1) seconds\n    stop all sounds\n    broadcast (Finish v)\nend\n\nwhen I receive [finish v]\nstop [other scripts in sprite v]\n\n@Sprite3\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\n\n@Sprite1\n\nwhen I start as a clone\nset size to (104) %\nshow\n\ndefine generate\nset [id v] to [1]\nswitch costume to (parta v)\nrepeat (6)\n    create clone of (_myself_ v)\n    next costume\n    change [id v] by (1)\nend\n\nwhen I receive [position v]\ngo to x: (((id) * (480)) - (scroll x 1)) y: (85)\n\nwhen I receive [start v]\nhide\ngenerate\nset [scroll x 1 v] to [480]\nbroadcast (message1 v)\nforever\n    if <(scroll x 1) > [2400]> then\n        set [scroll x 1 v] to [480]\n    end\n    if <[480] > (scroll x 1)> then\n        set [scroll x 1 v] to [2400]\n    end\nend\n\n@Sprite2\n\nwhen I start as a clone\nset size to (104) %\nshow\n\ndefine generate\nset [id v] to [1]\nswitch costume to (parta v)\nrepeat (6)\n    create clone of (_myself_ v)\n    next costume\n    change [id v] by (1)\nend\n\nwhen I receive [position2 v]\ngo to x: (((id) * (480)) - (scroll x 2)) y: (-85)\n\nwhen I receive [start v]\nhide\ngenerate\nset [scroll x 2 v] to [480]\nforever\n    if <(scroll x 2) > [2400]> then\n        set [scroll x 2 v] to [480]\n    end\n    if <[480] > (scroll x 2)> then\n        set [scroll x 2 v] to [2400]\n    end\nend\n\n@player1\n\nwhen I receive [message1 v]\nswitch costume to (costume1 v)\nset [id v] to [1]\nrepeat (5)\n    create clone of (_myself_ v)\n    change [id v] by (1)\nend\nset [id v] to [0]\ngo to x: (75) y: (50)\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    if <key (left arrow v) pressed?> then\n        change [xv v] by (-2)\n        point in direction (-90)\n    end\n    if <key (right arrow v) pressed?> then\n        change [xv v] by (2)\n        point in direction (90)\n    end\n    set [xv v] to ((xv) * (0.8))\n    change x by (round (xv))\n    Walls\n    change [yv v] by (-1)\n    if <<key (up arrow v) pressed?> and <(can jump?) = [1]>> then\n        set [yv v] to [9]\n    end\n    change y by (yv)\n    Floor\n    change [scroll x 1 v] by (round ((x position) / (4)))\n    change x by (() - (round ((x position) / (4))))\n    broadcast (position v)\n    set [p1 x v] to ((x position) + (scroll x 1))\n    set [p1 y v] to ((y position) + (-85))\nend\n\ndefine Walls\nif <touching color (#040404)?> then\n    change y by (4)\n    if <touching color (#040404)?> then\n        change y by (-4)\n        repeat until <not <touching color (#040404)?>>\n            change x by ((() - (xv)) / ([abs v] of (xv) ))\n        end\n        set [xv v] to [0]\n    else\n        repeat until <touching color (#040404)?>\n            change y by (-1)\n        end\n        change y by (1)\n    end\nend\n\ndefine Floor\nset [can jump? v] to [0]\nif <touching color (#040404)?> then\n    repeat until <not <touching color (#040404)?>>\n        change y by ((() - (yv)) / ([abs v] of (yv) ))\n    end\n    if <(yv) < [0]> then\n        set [can jump? v] to [1]\n    end\n    set [yv v] to [0]\nend\n\nwhen I start as a clone\nswitch costume to (costume1 v)\nforever\n    point in direction ([direction v] of [player1 v])\n    if <(id) = [1]> then\n        go to x: ((P1 X) - (scroll x 2)) y: ((P1 Y) + (-85))\n    end\n    if <(id) = [2]> then\n        go to x: (((P1 X) - (scroll x 2)) + (1920)) y: ((P1 Y) + (-85))\n    end\n    if <(id) = [3]> then\n        go to x: (((P1 X) - (scroll x 2)) + (-1920)) y: ((P1 Y) + (-85))\n    end\n    if <(id) = [4]> then\n        go to x: (((P1 X) - (scroll x 2)) + (960)) y: ((() - (P1 Y)) + (-85))\n        switch costume to (costume2 v)\n    end\n    if <(id) = [5]> then\n        go to x: (((P1 X) - (scroll x 2)) + (-960)) y: ((() - (P1 Y)) + (-85))\n        switch costume to (costume2 v)\n    end\nend\n\nwhen I receive [start v]\nset [ghost v] effect to (0)\nforever\n    if <<touching (player2 v)?> and <(Tagger) = [P2]>> then\n        wait (.3) seconds\n        set [tagger v] to [P1]\n    end\nend\n\n@player2\n\nwhen I receive [message1 v]\nswitch costume to (costume1 v)\nset [id v] to [1]\nrepeat (5)\n    create clone of (_myself_ v)\n    change [id v] by (1)\nend\nset [id v] to [0]\ngo to x: (100) y: (-135)\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    if <key (a v) pressed?> then\n        change [xv v] by (-2)\n        point in direction (-90)\n    end\n    if <key (d v) pressed?> then\n        change [xv v] by (2)\n        point in direction (90)\n    end\n    set [xv v] to ((xv) * (0.8))\n    change x by (round (xv))\n    Walls\n    change [yv v] by (-1)\n    if <<key (w v) pressed?> and <(can jump?) = [1]>> then\n        set [yv v] to [9]\n    end\n    change y by (yv)\n    Floor\n    change [scroll x 2 v] by (round ((x position) / (4)))\n    change x by (() - (round ((x position) / (4))))\n    broadcast (position2 v)\n    set [p2 x v] to ((x position) + (scroll x 2))\n    set [p2 y v] to ((y position) + (85))\nend\n\ndefine Walls\nif <touching color (#040404)?> then\n    change y by (4)\n    if <touching color (#040404)?> then\n        change y by (-4)\n        repeat until <not <touching color (#040404)?>>\n            change x by ((() - (xv)) / ([abs v] of (xv) ))\n        end\n        set [xv v] to [0]\n    else\n        repeat until <touching color (#040404)?>\n            change y by (-1)\n        end\n        change y by (1)\n    end\nend\n\ndefine Floor\nset [can jump? v] to [0]\nif <touching color (#040404)?> then\n    repeat until <not <touching color (#040404)?>>\n        change y by ((() - (yv)) / ([abs v] of (yv) ))\n    end\n    if <(yv) < [0]> then\n        set [can jump? v] to [1]\n    end\n    set [yv v] to [0]\nend\n\nwhen I start as a clone\nswitch costume to (costume1 v)\nforever\n    point in direction ([direction v] of [player2 v])\n    if <(id) = [1]> then\n        go to x: ((P2 X) - (scroll x 1)) y: ((P2 Y) + (85))\n    end\n    if <(id) = [2]> then\n        go to x: (((P2 X) - (scroll x 1)) + (1920)) y: ((P2 Y) + (85))\n    end\n    if <(id) = [3]> then\n        go to x: (((P2 X) - (scroll x 1)) + (-1920)) y: ((P2 Y) + (85))\n    end\n    if <(id) = [4]> then\n        go to x: (((P2 X) - (scroll x 1)) + (960)) y: ((() - (P2 Y)) + (85))\n        switch costume to (costume2 v)\n    end\n    if <(id) = [5]> then\n        go to x: (((P2 X) - (scroll x 1)) + (-960)) y: ((() - (P2 Y)) + (85))\n        switch costume to (costume2 v)\n    end\nend\n\nwhen I receive [start v]\nset [ghost v] effect to (0)\nforever\n    if <<touching (player1 v)?> and <(Tagger) = [P1]>> then\n        wait (.3) seconds\n        set [tagger v] to [P2]\n    end\nend\n\n@Tagger\n\ndefine Random Tagger\nset [random v] to (pick random (1) to (2))\nif <(Random) = [1]> then\n    set [tagger v] to [P1]\nend\nif <(Random) = [2]> then\n    set [tagger v] to [P2]\nend\n\nwhen I receive [finish v]\nstop [other scripts in sprite v]\n\nwhen I receive [start v]\nRandom Tagger\nforever\n    if <(Tagger) = [P1]> then\n        go to (player1 v)\n    end\n    if <(Tagger) = [P2]> then\n        go to (player2 v)\n    end\nend\n\n@Thumbnail\n\nwhen I receive [start v]\nshow variable [time left v]\nhide\n\nwhen flag clicked\nhide\nforever\n    reset timer\nend\n\nwhen I receive [finish v]\nhide variable [time left v]\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\nif <(Tagger) = [P1]> then\n    switch costume to (red win v)\nelse\n    switch costume to (blue win v)\nend\nstop [all v]\n\nwhen [timer v] > (.1)\nif <(Time Left) = [0]> then\n    if <(Tagger) = [P1]> then\n        switch costume to (red win v)\n    else\n        switch costume to (blue win v)\n    end\n    stop [this script v]\nelse\n    hide variable [time left v]\n    go to x: (0) y: (0)\n    switch costume to (standard v)\n    go to [front v] layer\n    show\nend\n\nswitch costume to (standard v)\n\n@Music\n\nwhen flag clicked\nplay sound [Checkpoint v] until done\n\nwhen flag clicked\nforever\n    if <[16] > (Time Left)> then\n        set volume to (20) %\n    end\nend\n\nwhen flag clicked\nset volume to (100) %\n\nwhen I receive [finish v]\nstop [other scripts in sprite v]\n\n@Restart\n\nshow\nforever\n    go to [front v] layer\nend\n\nwhen flag clicked\nset size to (100) %\nforever\n    if <touching (mouse-pointer v)?> then\n        repeat until <not <touching (mouse-pointer v)?>>\n            change size by (((150) - (size)) / (4))\n        end\n    end\n    change size by (((100) - (size)) / (4))\nend\n\nwhen I receive [start v]\nhide\n\nwhen I receive [finish v]\n\nwhen this sprite clicked\n\nbroadcast (Start v)\n\n