Ninja Cat 3 - Platformer Game

Instructions: ▶️ MMO Tutorial - https://youtu.be/1JTgg4WVAX8\n\nHey Fellow Scratchers, I've been re-working the MMO platformer test project to see what new features I could add. This is a work in progress level, not yet complete so it may feel a little abrupt. Still, I need to test how it is working so far! So here goes :D - Jump on board and see how many players we get on this thing before it breaks lol.\n\nRun the course - collect the flags, and then make it back to the beginning to collect the final flag to get your time.\n\nIf you see a yellow player... It's me guys :D\nThe rainbow player is the fastest player right now who is playing. Their name is shown at the top of the screen.\n\n*** CONTROLS ***\n* Use arrow keys or WASD to control the player\n* Z is alternative crouch, SPACE alternative jump\n* Press 'N' to show all players names\n* Hold E or R to open Emoji panels\n* Complete the speed run and back to the start will report your time and reward you with a parachute - use space to use it :)\n* Mouse over a player to see their individual name\n* Q + R to reset level for speed runs\n\n*** SPECIAL MOVES ***\nHigh Jump - Hold down then Up\nLong Jump - Run then quickly press Down, then Up\nSlide - On a slope press Down and Left or Right\nWall Jump - Jump against a wall, then press Up again\n\nChangelog:\n15 July 2022 - Removed Name of fastest player (due to hackers *sob*)\n31 Mar 2022 - Updated cloud code\n9 Dec 2021 - Trying to add current fastest + Fixes for slope sliding\n7 Dec 2021 - Bugfix - Stop end of buffer making players appear under level.\n6 Dec 2021 - Initial Release v1.0\n\nCredits:\nEmoji - Openmoji\nMusic - Twenty Six 0 Eight by Tripledigit

@Stage\n\n@Player\n\nwhen I receive [play v]\nReset Player\nshow\nforever\n    Platform Engine [5] [13] [-1] [0.5]\n    if <<touching (portal v)?> and <(CC) = [5]>> then\n        wait (1) seconds\n        repeat (12)\n            change size by (2)\n            change [ghost v] effect by ((100) / (12))\n        end\n        hide\n        set size to (25) %\n        clear graphic effects\n        broadcast (Transition In v) and wait\n        Reset Player\n        broadcast (@NEXTLEVEL v) and wait\n    end\n    if <(y position) < [-179]> then\n        play sound [fall v] until done\n        Reset Player\n        show\n    end\n    if <key (r v) pressed?> then\n        wait until <not <key (r v) pressed?>>\n        Reset Player\n        show\n    end\nend\n\ndefine Reset Player\nshow\nset size to (25) %\nset rotation style [left-right v]\npoint in direction (90)\ngo to x: (0) y: (100)\nset [slope v] to [0]\nset [touchingfloor? v] to [false]\nset [walk v] to [0]\nset [xv v] to [0]\nset [yv v] to [0]\nset [playerx v] to (item (LEVEL) of [respawnsx v])\nset [camx v] to (playerX)\nclear graphic effects\nhide\n\ndefine Scrolling Blocks\nchange [camx v] by (x position)\nset x to (0)\n\nwhen flag clicked\nhide\ndelete all of [respawnsx v]\nadd [60] to [respawnsx v]\nadd [-120] to [respawnsx v]\nadd [-165] to [respawnsx v]\nadd [-95] to [respawnsx v]\nadd [0] to [respawnsx v]\n\ndefine Quick Scroll\nif <key (right arrow v) pressed?> then\n    change [camx v] by (100)\nend\nif <key (left arrow v) pressed?> then\n    change [camx v] by (-100)\nend\n\ndefine Platform Engine (speed) (jumpheight) (gravity) (friction)\nswitch costume to (hitbox v)\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    change [xv v] by (speed)\n    point in direction (90)\n    switch costume to (join [Walk] (((Walk) mod (4)) + (1)))\nelse\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [xv v] by ((speed) * (-1))\n        point in direction (-90)\n        switch costume to (join [Walk] (((Walk) mod (4)) + (1)))\n    else\n        switch costume to (stand v)\n    end\nend\nchange [walk v] by (1)\nif <(Walk) > [9000]> then\n    set [walk v] to [0]\nend\nset [xv v] to ((XV) * (friction))\nchange x by (XV)\nif <touching (hitbox v)?> then\n    set [slope v] to [0]\n    repeat until <<not <touching (hitbox v)?>> or <(Slope) = [8]>>\n        change [slope v] by (1)\n        change y by (1)\n    end\n    if <touching (hitbox v)?> then\n        change y by ((Slope) * (-1))\n        repeat ([ceiling v] of ([abs v] of (XV) ) )\n            if <touching (hitbox v)?> then\n                change x by ((([abs v] of (XV) ) / (XV)) * (-1))\n            end\n        end\n        set [xv v] to [0]\n    end\nend\nchange y by (YV)\nif <touching (hitbox v)?> then\n    repeat ([ceiling v] of ([abs v] of (YV) ) )\n        if <touching (hitbox v)?> then\n            change y by ((([abs v] of (YV) ) / (YV)) * (-1))\n        end\n    end\n    Touching Floor?\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> and <(TouchingFloor?) = [true]>> then\n        set [yv v] to (jumpheight)\n        switch costume to (jump v)\n        start sound [jump v]\n    else\n        set [yv v] to [0]\n    end\nelse\n    Touching Floor?\n    if <(YV) > [0]> then\n        switch costume to (jump v)\n    else\n        if <(TouchingFloor?) = [false]> then\n            switch costume to (fall v)\n        end\n    end\n    change [yv v] by (gravity)\nend\nchange [playerx v] by (x position)\nchange [camx v] by (x position)\nset x to (0)\n\ndefine Touching Floor?\nchange y by (-3)\nset [touchingfloor? v] to <touching (hitbox v)?>\nchange y by (3)\n\n@HitBox\n\ndefine Create\nrepeat (2)\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (CamX))\n    if <([abs v] of ((Level_X) - (CamX)) ) > [480]> then\n        hide\n    else\n        show\n    end\n    set [ghost v] effect to (100)\nend\n\nwhen I receive [delete all clones v]\ndelete this clone\n\nwhen I receive [create level v]\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (((LEVEL) * (3)) - (2))\nCreate\nhide\n\nwhen flag clicked\nswitch costume to (1 v)\nhide\n\n@Art\n\ndefine Create\nrepeat (2)\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (CamX))\n    if <([abs v] of ((Level_X) - (CamX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [delete all clones v]\ndelete this clone\n\nwhen I receive [create level v]\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (((LEVEL) * (3)) - (2))\nCreate\nhide\n\nwhen flag clicked\nswitch costume to (1 v)\nhide\n\n@Transition\n\nwhen I receive [transition in v]\nswitch costume to (costume1 v)\nhide\nshow\nstart sound [Disconnect v]\nrepeat (16)\n    go to [front v] layer\n    next costume\nend\n\nwhen I receive [transition out v]\nswitch costume to (costume17 v)\nstart sound [Connect v]\nrepeat (16)\n    go to [front v] layer\n    switch costume to ((costume [number v]) - (1))\nend\nhide\n\nwhen flag clicked\nhide\n\n@Level Manager\n\nwhen I receive [game v]\nwait (1) seconds\nbroadcast (@NEXTLEVEL v)\n\nbroadcast (Transition In v) and wait\n\ndefine Level\nbroadcast (Delete All Clones v) and wait\nbroadcast (Create Level v) and wait\nbroadcast (Create Coins v) and wait\nbroadcast (Create Portal v) and wait\nbroadcast (Level Loop v)\nbroadcast (Play v)\n\nwhen flag clicked\nset [level v] to [0]\n\nwhen I receive [@nextlevel v]\nchange [level v] by (1)\nLevel\nbroadcast (Transition Out v) and wait\n\n@Play\n\nwhen flag clicked\nset [vanish? v] to [false]\nshow\nswitch costume to (title v)\ncreate clone of (_myself_ v)\nswitch costume to (play v)\ncreate clone of (_myself_ v)\nhide\n\nwhen I start as a clone\nif <(costume [number v]) = [1]> then\n    set size to (130) %\n    switch costume to (title v)\n    go to [front v] layer\n    go to x: (0) y: (90)\n    set [sine v] to [0]\n    forever\n        change size by ([sin v] of (Sine) )\n        change [sine v] by (10)\n        if <(Vanish?) = [true]> then\n            Vanish\n            delete this clone\n        end\n    end\nelse\n    if <(costume [number v]) = [2]> then\n        go to x: (0) y: (-60)\n        set size to (120) %\n        forever\n            if <(Vanish?) = [true]> then\n                Vanish\n                delete this clone\n            end\n            if <touching (mouse-pointer v)?> then\n                change size by (((100) - (size)) / (4))\n                if <mouse down?> then\n                    stop [other scripts in sprite v]\n                    Vanish\n                    broadcast (Transition In v) and wait\n                    broadcast (game v)\n                    delete this clone\n                end\n            else\n                change size by (((80) - (size)) / (4))\n            end\n        end\n    end\nend\n\ngo to x: (0) y: (-120)\nset size to (70) %\nforever\n    if <(Vanish?) = [true]> then\n        Vanish\n        delete this clone\n    end\n    if <touching (mouse-pointer v)?> then\n        change size by (((100) - (size)) / (4))\n        if <mouse down?> then\n            stop [other scripts in sprite v]\n            Vanish\n            delete this clone\n        end\n    else\n        change size by (((70) - (size)) / (4))\n    end\nend\n\nwhen I receive [vanish v]\nbroadcast (vanish v)\n\ndefine Vanish\nset [vanish? v] to [true]\nrepeat (10)\n    change size by (((0) - (size)) / (4))\n    change [ghost v] effect by (10)\nend\nhide\nstop [other scripts in sprite v]\n\nbroadcast (game v)\n\nchange size by (((120) - (size)) / (4))\nif <mouse down?> then\n    stop [other scripts in sprite v]\n    Vanish\n    broadcast (game v)\n    delete this clone\nend\n\n@Coins\n\nwhen flag clicked\nhide\nset [cc v] to [0]\ndelete all of [coinsx v]\ndelete all of [coiny v]\nadd [-193] to [coinsx v]\nadd [420] to [coinsx v]\nadd [655] to [coinsx v]\nadd [915] to [coinsx v]\nadd [1143] to [coinsx v]\nadd [-60] to [coiny v]\nadd [150] to [coiny v]\nadd [-60] to [coiny v]\nadd [25] to [coiny v]\nadd [152] to [coiny v]\nadd [110] to [coinsx v]\nadd [485] to [coinsx v]\nadd [947] to [coinsx v]\nadd [722] to [coinsx v]\nadd [-238] to [coinsx v]\nadd [35] to [coiny v]\nadd [-31] to [coiny v]\nadd [118] to [coiny v]\nadd [-9] to [coiny v]\nadd [-85] to [coiny v]\nadd [145] to [coinsx v]\nadd [636] to [coinsx v]\nadd [1017] to [coinsx v]\nadd [952] to [coinsx v]\nadd [398] to [coinsx v]\nadd [-50] to [coiny v]\nadd [134] to [coiny v]\nadd [150] to [coiny v]\nadd [150] to [coiny v]\nadd [-112] to [coiny v]\nadd [-228] to [coinsx v]\nadd [237] to [coinsx v]\nadd [674] to [coinsx v]\nadd [903] to [coinsx v]\nadd [495] to [coinsx v]\nadd [-18] to [coiny v]\nadd [44] to [coiny v]\nadd [-59] to [coiny v]\nadd [48] to [coiny v]\nadd [77] to [coiny v]\nadd [-257] to [coinsx v]\nadd [796] to [coinsx v]\nadd [889] to [coinsx v]\nadd [992] to [coinsx v]\nadd [1123] to [coinsx v]\nadd [-106] to [coiny v]\nadd [-107] to [coiny v]\nadd [-68] to [coiny v]\nadd [-34] to [coiny v]\nadd [3] to [coiny v]\n\nwhen [space v] key pressed\nadd ((round (CamX)) + (mouse x)) to [coinsx v]\nadd (mouse y) to [coiny v]\n\nwhen I receive [delete all clones v]\ndelete this clone\n\nwhen I receive [create coins v]\nif <(LEVEL) < [6]> then\n    set [cloneid v] to [0]\n    set [cc v] to [0]\n    repeat (5)\n        change [cloneid v] by (1)\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I start as a clone\nforever\n    set x to ((item ((cloneID) + (((LEVEL) - (1)) * (5))) of [coinsx v]) - (CamX))\n    set y to (item ((cloneID) + (((LEVEL) - (1)) * (5))) of [coiny v])\n    if <([abs v] of ((item ((cloneID) + (((LEVEL) - (1)) * (5))) of [coinsx v]) - (CamX)) ) > [240]> then\n        hide\n    else\n        show\n    end\n    if <touching (player v)?> then\n        change [cc v] by (1)\n        start sound (((cloneID) mod (2)) + (1))\n        delete this clone\n    end\nend\n\n@Portal\n\nwhen flag clicked\nhide\ndelete all of [portalsx v]\ndelete all of [portaly v]\nadd [908] to [portalsx v]\nadd [-103] to [portaly v]\nadd [1139] to [portalsx v]\nadd [-79] to [portaly v]\nadd [888] to [portalsx v]\nadd [-127] to [portaly v]\nadd [1128] to [portalsx v]\nadd [-35] to [portaly v]\nadd [1265] to [portalsx v]\nadd [-19] to [portaly v]\n\nwhen [z v] key pressed\nadd ((round (CamX)) + (mouse x)) to [portalsx v]\nadd (mouse y) to [portaly v]\n\nwhen I receive [delete all clones v]\ndelete this clone\n\nwhen I receive [create portal v]\nif <(LEVEL) < [6]> then\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nforever\n    set x to ((item (LEVEL) of [portalsx v]) - (CamX))\n    set y to (item (LEVEL) of [portaly v])\n    if <([abs v] of ((item (LEVEL) of [portalsx v]) - (CamX)) ) > [260]> then\n        hide\n    else\n        show\n    end\n    if <(CC) = [5]> then\n        switch costume to (o v)\n    else\n        switch costume to (c v)\n    end\nend\n\ngo to [front v] layer\n\n@Music\n\nwhen flag clicked\nforever\n    play sound [cherry v] until done\nend\n\n@TN\n\nwhen flag clicked\nhide\n\nshow\ngo to [front v] layer\n\n