Colour Codes: Two-Player Platformer
@Stage\n\nwhen flag clicked\nforever\n    play sound [2021-01-07_-_At_The_Top_-_www v] until done\nend\n\n@player 1\n\nwhen flag clicked\nset size to (100) %\nset [player 1 - end level v] to [0]\nset [death v] to [0]\nset [in jump v] to [0]\nset [mid-air v] to [0]\ngo to [front v] layer\ngo to x: (-199) y: (40)\nshow\nbroadcast (player 1 - points v)\nforever\n    if <key (up arrow v) pressed?> then\n        if <(in jump) = [0]> then\n            if <(mid-air) = [0]> then\n                set [in jump v] to [1]\n                set [jumping-code v] to [7.5]\n                repeat (15)\n                    change y by (jumping-code)\n                    change [jumping-code v] by (-0.5)\n                end\n                repeat until <touching color (#cbe4ff)?>\n                    change y by (jumping-code)\n                    change [jumping-code v] by (-0.5)\n                end\n                if <touching color (#cbe4ff)?> then\n                    change y by (0.8)\n                else\n                    if <touching color (#cbe4ff)?> then\n                        change y by (0.8)\n                    else\n                        if <touching color (#cbe4ff)?> then\n                            change y by (0.8)\n                        else\n                            if <touching color (#cbe4ff)?> then\n                                change y by (0.8)\n                            else\n                                if <touching color (#cbe4ff)?> then\n                                    change y by (0.8)\n                                else\n                                    if <touching color (#cbe4ff)?> then\n                                        change y by (0.8)\n                                    else\n                                        if <touching color (#cbe4ff)?> then\n                                            change y by (0.8)\n                                        else\n                                            go to x: (-199) y: (44)\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n                set [in jump v] to [0]\n            end\n        end\n    end\nend\n\ngo to x: (-199) y: (44)\n\nwhen flag clicked\nforever\n    if <<not <touching color (#cbe4ff)?>> and <not <touching color (#ffeeb2)?>>> then\n        wait (0.001) seconds\n        if <(mid-air) = [0]> then\n            if <(in jump) = [0]> then\n                set [mid-air v] to [1]\n                set [falling code v] to [0]\n                repeat until <touching color (#cbe4ff)?>\n                    change y by (falling code)\n                    change [falling code v] by (-0.5)\n                end\n                if <touching color (#cbe4ff)?> then\n                    change y by (0.8)\n                else\n                    if <touching color (#cbe4ff)?> then\n                        change y by (0.8)\n                    else\n                        if <touching color (#cbe4ff)?> then\n                            change y by (0.8)\n                        else\n                            if <touching color (#cbe4ff)?> then\n                                change y by (0.8)\n                            else\n                                if <touching color (#cbe4ff)?> then\n                                    change y by (0.8)\n                                else\n                                    if <touching color (#cbe4ff)?> then\n                                        change y by (0.8)\n                                    else\n                                        if <touching color (#cbe4ff)?> then\n                                            change y by (0.8)\n                                        else\n                                            go to x: (-199) y: (44)\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n                set [mid-air v] to [0]\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (right arrow v) pressed?> then\n        repeat until <not <key (right arrow v) pressed?>>\n            change x by (4)\n        end\n        slide right - player 1\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (left arrow v) pressed?> then\n        repeat until <not <key (left arrow v) pressed?>>\n            change x by (-4)\n        end\n        slide left - player 1\n    end\nend\n\ndefine slide left - player 2\n\nwhen flag clicked\nforever\n    if <touching color (#ffeeb2)?> then\n        if <(death) = [0]> then\n            start sound [Disconnect v]\n            set [death v] to [1]\n            repeat (4)\n                change size by (-25)\n            end\n            hide\n            go to x: (-199) y: (40)\n            set size to (100) %\n            show\n            set [death v] to [0]\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <(x position) > [240]> then\n        set [player 1 - end level v] to [1]\n        broadcast (player 1 - next level v)\n        hide\n        go to x: (-199) y: (40)\n        set size to (100) %\n        wait (1) seconds\n        show\n    end\nend\n\ndefine slide right - player 1\nset [slide v] to [3]\nrepeat (6)\n    change x by (slide)\n    change [slide v] by (-0.5)\nend\n\ndefine slide right - player 2\n\ndefine slide left - player 1\nset [slide v] to [-3]\nrepeat (6)\n    change x by (slide)\n    change [slide v] by (0.5)\nend\n\n@platform 1\n\nwhen I receive [player 1 - next level v]\nif <(player 1 - platform) = [6]> then\n    broadcast (player 1 monster v)\nend\nif <(player 1 - platform) < [8]> then\n    change [player 1 - platform v] by (1)\n    wait (0.85) seconds\n    next costume\nelse\n    set [player 1 final points v] to [1]\nend\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset [player 1 - platform v] to [1]\nset [player 1 final points v] to [0]\n\n@player 1 points\n\nwhen I receive [player 1 - points v]\nhide\nset [ghost v] effect to (100)\nset [player 1 timer v] to [0]\nrepeat until <(player 1 - end level) = [1]>\n    change [player 1 timer v] by (1)\n    if <not <(player 1 - end level) = [1]>> then\n        wait (1) seconds\n    end\nend\nshow\ngo to [front v] layer\nrepeat (4)\n    change [ghost v] effect by (-25)\nend\nchange [player 1 timer - showcase v] by ((15) - (player 1 timer))\nshow variable [player 1 timer - showcase v]\nif <(PLAYER 1 FINAL POINTS) = [1]> then\n    wait until <(PLAYER 2 FINAL POINTS) = [1]>\n    broadcast (END game v)\nelse\n    wait (0.8) seconds\n    hide variable [player 1 timer - showcase v]\n    repeat (4)\n        change [ghost v] effect by (25)\n    end\n    hide\n    broadcast (player 1 - points v)\n    set [player 1 - end level v] to [0]\nend\n\nwhen flag clicked\nset [player 1 timer v] to [0]\nset [player 1 timer - showcase v] to [0]\nset [player 1 - end level v] to [0]\nshow variable [player 1 timer v]\nhide variable [player 1 timer - showcase v]\nset [ghost v] effect to (100)\nhide\n\nwhen I receive [player 1 - final points v]\n\n@player 2\n\nwhen flag clicked\nset size to (100) %\nset [player 2 - touch ceiling v] to [0]\nset [player 2 - end level v] to [0]\nset [death - player 2 v] to [0]\nset [in jump - player 2 v] to [0]\nset [mid air - player 2 v] to [0]\ngo to [front v] layer\ngo to x: (-199) y: (-161)\nshow\nbroadcast (player 2 - points v)\nforever\n    if <key (w v) pressed?> then\n        if <(in jump - player 2) = [0]> then\n            if <(mid air - player 2) = [0]> then\n                set [in jump - player 2 v] to [1]\n                set [jumping code - player 2 v] to [7.5]\n                if <not <touching (platform 1 v)?>> then\n                    broadcast (wait until v)\n                    repeat (15)\n                        if <(player 2 - touch ceiling) = [0]> then\n                            change y by (jumping code - player 2)\n                            change [jumping code - player 2 v] by (-0.5)\n                        end\n                    end\n                end\n                if <not <touching color (#cbe4ff)?>> then\n                    if <(player 2 - touch ceiling) = [0]> then\n                        repeat until <<touching color (#cbe4ff)?> and <not <touching (platform 1 v)?>>>\n                            change y by (jumping code - player 2)\n                            change [jumping code - player 2 v] by (-0.5)\n                        end\n                        wait (0.01) seconds\n                        if <touching color (#cbe4ff)?> then\n                            change y by (0.7)\n                        else\n                            if <touching color (#cbe4ff)?> then\n                                change y by (0.7)\n                            else\n                                if <touching color (#cbe4ff)?> then\n                                    change y by (0.7)\n                                else\n                                    if <touching color (#cbe4ff)?> then\n                                        change y by (0.7)\n                                    else\n                                        if <touching color (#cbe4ff)?> then\n                                            change y by (0.7)\n                                        else\n                                            if <touching color (#cbe4ff)?> then\n                                                change y by (0.7)\n                                            else\n                                                if <touching color (#cbe4ff)?> then\n                                                    change y by (0.7)\n                                                else\n                                                    go to x: (-199) y: (-161)\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n            set [in jump - player 2 v] to [0]\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <<not <touching color (#cbe4ff)?>> and <not <touching color (#ffeeb2)?>>> then\n        wait (0.001) seconds\n        if <(mid air - player 2) = [0]> then\n            if <(in jump - player 2) = [0]> then\n                set [mid air - player 2 v] to [1]\n                set [falling code - player 2 v] to [0]\n                repeat until <touching color (#cbe4ff)?>\n                    change y by (falling code - player 2)\n                    change [falling code - player 2 v] by (-0.5)\n                end\n                if <touching color (#cbe4ff)?> then\n                    change y by (0.8)\n                else\n                    if <touching color (#cbe4ff)?> then\n                        change y by (0.8)\n                    else\n                        if <touching color (#cbe4ff)?> then\n                            change y by (0.8)\n                        else\n                            if <touching color (#cbe4ff)?> then\n                                change y by (0.8)\n                            else\n                                if <touching color (#cbe4ff)?> then\n                                    change y by (0.8)\n                                else\n                                    if <touching color (#cbe4ff)?> then\n                                        change y by (0.8)\n                                    else\n                                        if <touching color (#cbe4ff)?> then\n                                            change y by (0.8)\n                                        else\n                                            go to x: (-199) y: (-161)\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n                set [mid air - player 2 v] to [0]\n            end\n        end\n    end\nend\n\n\n\nwhen I receive [player 2 - touch ceiling v]\nset [in jump - player 2 v] to [1]\nset [player 2 - touch ceiling v] to [1]\nif <<not <touching color (#cbe4ff)?>> and <not <touching color (#ffeeb2)?>>> then\n    wait (0.001) seconds\n    if <(mid air - player 2) = [0]> then\n        if <(in jump - player 2) = [1]> then\n            set [mid air - player 2 v] to [1]\n            set [falling code - player 2 v] to [0]\n            repeat until <touching color (#cbe4ff)?>\n                change y by (falling code - player 2)\n                change [falling code - player 2 v] by (-0.5)\n            end\n            set [mid air - player 2 v] to [0]\n        end\n    end\n    set [player 2 - touch ceiling v] to [0]\nend\n\n\n\nwhen I receive [wait until v]\nwait until <touching (platform 1 v)?>\nbroadcast (player 2 - touch ceiling v) and wait\n\nwhen flag clicked\nforever\n    if <(x position) > [240]> then\n        set [player 2 - end level v] to [1]\n        broadcast (player 2 - end level v)\n        hide\n        go to x: (-199) y: (-161)\n        set size to (100) %\n        wait (1) seconds\n        show\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching color (#ffeeb2)?> then\n        if <(death - player 2) = [0]> then\n            start sound [Disconnect v]\n            set [death - player 2 v] to [1]\n            repeat (4)\n                change size by (-25)\n            end\n            hide\n            go to x: (-199) y: (-161)\n            set size to (100) %\n            show\n            set [death - player 2 v] to [0]\n        end\n    end\nend\n\ndefine slide right - player 2\nset [slide - player 2 v] to [3]\nrepeat (6)\n    change x by (slide - player 2)\n    change [slide - player 2 v] by (-0.5)\nend\n\ndefine slide left - player 2\nset [slide - player 2 v] to [-3]\nrepeat (6)\n    change x by (slide - player 2)\n    change [slide - player 2 v] by (0.5)\nend\n\nwhen flag clicked\nforever\n    if <key (a v) pressed?> then\n        repeat until <not <key (a v) pressed?>>\n            change x by (-4)\n        end\n        slide left - player 2\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (d v) pressed?> then\n        repeat until <not <key (d v) pressed?>>\n            change x by (4)\n        end\n        slide right - player 2\n    end\nend\n\n@platform 2\n\nwhen I receive [player 2 - end level v]\nif <(player 2 - platform) = [6]> then\n    broadcast (player 2 monster v)\nend\nif <(player 2 - platform) < [8]> then\n    change [player 2 - platform v] by (1)\n    wait (0.85) seconds\n    next costume\nelse\n    set [player 2 final points v] to [1]\nend\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset [player 2 final points v] to [0]\nset [player 2 - platform v] to [1]\n\n@player 2 points\n\nwhen I receive [player 2 - points v]\nhide\nset [ghost v] effect to (100)\nset [player 2 timer v] to [0]\nrepeat until <(player 2 - end level) = [1]>\n    change [player 2 timer v] by (1)\n    if <not <(player 2 - end level) = [1]>> then\n        wait (1) seconds\n    end\nend\nshow\ngo to [front v] layer\ngo to [front v] layer\nrepeat (4)\n    change [ghost v] effect by (-25)\nend\nchange [player 2 timer - showcase v] by ((15) - (player 2 timer))\nshow variable [player 2 timer - showcase v]\nif <(PLAYER 2 FINAL POINTS) = [1]> then\n    wait until <(PLAYER 1 FINAL POINTS) = [1]>\n    broadcast (END game v)\nelse\n    wait (0.8) seconds\n    hide variable [player 2 timer - showcase v]\n    repeat (4)\n        change [ghost v] effect by (25)\n    end\n    hide\n    broadcast (player 2 - points v)\n    set [player 2 - end level v] to [0]\nend\n\nwhen flag clicked\nset [player 2 timer v] to [0]\nset [player 2 timer - showcase v] to [0]\nset [player 2 - end level v] to [0]\nshow variable [player 2 timer v]\nhide variable [player 2 timer - showcase v]\nset [ghost v] effect to (100)\nhide\n\n@border\n\n@monster 1\n\nwhen flag clicked\nhide\ngo to x: (217) y: (55)\nforever\n    glide (1.7) secs to x: (130) y: (55)\n    glide (1.7) secs to x: (217) y: (55)\nend\n\nwhen I receive [player 1 monster v]\nwait (0.5) seconds\nshow\nwait until <(player 1 - platform) = [8]>\nhide\n\n@monster 2\n\nwhen flag clicked\nhide\ngo to x: (217) y: (-157)\nforever\n    glide (1.7) secs to x: (130) y: (-157)\n    glide (1.7) secs to x: (217) y: (-157)\nend\n\nwhen I receive [player 2 monster v]\nwait (0.5) seconds\nshow\ngo to [front v] layer\nwait until <(player 2 - platform) = [8]>\nhide\n\n@end game\n\nwhen I receive [end game v]\nif <(player 1 timer - showcase) > (player 2 timer - showcase)> then\n    switch costume to (costume1 v)\nelse\n    switch costume to (costume2 v)\nend\ngo to [front v] layer\nshow\nrepeat (4)\n    change [ghost v] effect by (-25)\nend\nshow\ngo to [front v] layer\nhide variable [player 1 timer v]\nhide variable [player 2 timer v]\nhide variable [player 2 timer - showcase v]\nhide variable [player 1 timer - showcase v]\nforever\n    go to [front v] layer\n    go to x: ((mouse x) / (40)) y: ((mouse y) / (40))\nend\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\n\n@TN\n\nwhen flag clicked\nhide\n\ngo to [front v] layer\nshow\nhide variable [player 1 timer v]\nhide variable [player 2 timer v]\nhide variable [player 2 timer - showcase v]\nhide variable [player 1 timer - showcase v]\n\n
Hi everyone! This is a project I made for a school assignment, an interactive game. Welcome to Colour Codes, a Two-Player platformer! Lol I spent so much time on this xD the code is crazy! In this game, the two players compete to finish the platformer (8 levels) the fastest! Let's try to get to 200 loves! :D\n\nAHHHHH BEING CURATED BY @YADESH123!!!\n\nInstructions:\n- Player 1 uses the arrrow keys.\n- Player 2 uses the WASD keys.\n- Reach the other end of the screen as fast as possible. \n- You get more points the faster you are. The most points that can be added to your score is 15 each round. \n- Avoid all yellow obstacles!\n\nChallenges:\n1) Boundaries/walls\n2) Spikes/Yellow Lava\n3) It's a surprise ;)\n\nEnjoy! Let me know if there are any bugs :) \n\n(Also, the end is a parallax xP)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nComment: What do you find at the end of the rainbow? The letter W! xD