Among Us Platformer

Instructions: Use arrow keys to play the game left and right to move, and up to jump.  Avoid traps, don't touch imposter, and don't fall off the platform.

@Stage\n\nwhen flag clicked\nset volume to (50) %\nforever\n    play sound [Space Noise v] until done\nend\n\n@MainCharacter\n\nwhen flag clicked\nset size to (50) %\nset [level v] to [1]\nReset\nbroadcast (StartGame v)\nbroadcast (StartNewLevel v)\n\ndefine Reset\ngo to x: (-200) y: (0)\nset [g_isplayerdead v] to [false]\nset [g_velocity v] to [0]\nset [g_onground v] to [0]\nset [g_gravity v] to [-1]\nset [jumping v] to [0]\n\nwhen I receive [startgame v]\nchange [ghost v] effect by (100)\nshow\nrepeat until <(G_isPlayerDead) = [true]>\n    broadcast (StartAllControl v)\n    broadcast (CheckPlatformDetection v)\n    broadcast (CheckPlayerPosition v)\nend\n\ndefine MovementControl\nif <key (right arrow v) pressed?> then\n    set [g_speedx v] to [5]\nelse\n    if <key (left arrow v) pressed?> then\n        set [g_speedx v] to [-5]\n    else\n        set [g_speedx v] to [0]\n    end\nend\n\nwhen I receive [startallcontrol v]\nMovementControl\nJumpControl\nif <key (up arrow v) pressed?> then\n    change [g_velocity v] by (G_gravity)\nelse\n    change [g_velocity v] by ((G_gravity) * (2))\nend\nchange y by (G_velocity)\n\ndefine MoveHitbox (speedx)\nchange x by (speedx)\nset [deviation v] to [0]\nrepeat until <<(deviation) = [5]> or <not <touching (ground v)?>>>\n    change y by (1)\n    change [deviation v] by (1)\nend\nif <(deviation) = [5]> then\n    change x by ((0) - (speedx))\n    change y by ((0) - (deviation))\nend\n\nwhen I receive [checkplatformdetection v]\nCheckHitGround <(G_velocity) > [0]>\nMoveHitbox (G_speedX)\n\ndefine JumpControl\nif <key (up arrow v) pressed?> then\n    if <<(G_onGround) > [0]> and <(jumping) = [0]>> then\n        set [g_onground v] to [0]\n        set [jumping v] to [1]\n        set [g_velocity v] to [15]\n    end\nend\n\ndefine CheckHitGround <isjumping>\nrepeat until <not <touching (ground v)?>>\n    if <isjumping> then\n        change y by (-1)\n        set [g_velocity v] to [0]\n    else\n        change y by (1)\n        set [g_velocity v] to [0]\n        set [g_onground v] to [1]\n        if <(jumping) = [1]> then\n            set [jumping v] to [0]\n        end\n    end\nend\n\nwhen I receive [startnewlevel v]\nbroadcast (Reset v) and wait\nbroadcast (Setup v) and wait\n\nwhen I receive [bounce v]\nset [g_velocity v] to [25]\n\nwhen I receive [checkplayerposition v]\nforever\n    if <<touching color (#ff2121)?> or <(y position) < [-150]>> then\n        broadcast (Die v)\n    end\n    if <<(x position) > [225]> and <(Level) < [10]>> then\n        change [level v] by (1)\n        broadcast (StartNewLevel v)\n    end\n    if <(G_isPlayerDead) = [true]> then\n        wait (0.1) seconds\n        Reset\n        broadcast (StartGame v)\n    end\nend\n\nwhen I receive [startnewlevel v]\nReset\nbroadcast (StartGame v)\n\nwhen [m v] key pressed\nset [g_mouseposition v] to (join (mouse x) (join [, ] (mouse y)))\nshow variable [g_mouseposition v]\n\nwhen I receive [die v]\nset [g_isplayerdead v] to [true]\n\n@AnimatedCharacter\n\nwhen flag clicked\nset size to (50) %\nset rotation style [left-right v]\ngo to [front v] layer\nshow\nforever\n    go to (maincharacter v)\n    if <<not <key (any v) pressed?>> and <(G_onGround) = [1]>> then\n        switch costume to (idle v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n        if <(costume [name v]) = [idle]> then\n            switch costume to (walkcolor0001 v)\n        else\n            next costume\n        end\n        wait (0.02) seconds\n    end\n    if <key (left arrow v) pressed?> then\n        point in direction (-90)\n        if <(costume [name v]) = [idle]> then\n            switch costume to (walkcolor0001 v)\n        else\n            next costume\n        end\n        wait (0.02) seconds\n    end\n    if <key (up arrow v) pressed?> then\n        switch costume to (walkcolor0001 v)\n    end\nend\n\nwhen flag clicked\nset [deaths v] to [0]\nforever\n    if <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> then\n        if <(costume [number v]) = [6]> then\n            play sound [walk v] until done\n        end\n    end\n    if <key (up arrow v) pressed?> then\n        play sound [jump v] until done\n    end\nend\n\nwhen I receive [die v]\nplay sound [Alien Creak1 v] until done\nchange [deaths v] by (1)\n\n@Ground\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    if <(Level) < [11]> then\n        switch costume to (Level)\n    end\nend\n\n@Trampoline\n\nwhen flag clicked\nhide\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Place Clone At (x) (y)\nset [x v] to (x)\nset [y v] to (y)\nswitch costume to (trampoline1 v)\nshow\ncreate clone of (_myself_ v)\n\nwhen I receive [setup v]\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [2]> then\n    Place Clone At [34] [-97]\nend\nif <(Level) = [4]> then\n    Place Clone At [-110] [-97]\nend\nif <(Level) = [8]> then\n    Place Clone At [72] [-17]\nend\nif <(Level) = [9]> then\n    Place Clone At [150] [-97]\nend\nhide\nset [x v] to [-99999]\n\nwhen I start as a clone\ngo to x: (x) y: (y)\nforever\n    if <touching (maincharacter v)?> then\n        broadcast (Bounce v)\n        repeat (8)\n            next costume\n            wait (0.05) seconds\n        end\n        switch costume to (trampoline1 v)\n    end\nend\n\n@Spikes\n\nwhen flag clicked\nhide\n\ndefine Place Clone At (x) (y)\nset [x v] to (x)\nset [y v] to (y)\nshow\ncreate clone of (_myself_ v)\n\nwhen I receive [setup v]\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    Place Clone At [50] [-97]\nend\nif <(Level) = [4]> then\n    Place Clone At [130] [-97]\nend\nif <(Level) = [6]> then\n    Place Clone At [89] [-97]\nend\nif <(Level) = [8]> then\n    Place Clone At [130] [-97]\nend\nhide\nset [x v] to [-99999]\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I start as a clone\ngo to x: (x) y: (y)\nforever\n    if <touching (maincharacter v)?> then\n        broadcast (Die v)\n    end\nend\n\n@Laser\n\ndefine Place Clone At (x) (y)\nset [x v] to (x)\nset [y v] to (y)\nshow\ncreate clone of (_myself_ v)\n\nwhen I receive [setup v]\nStart Laser Again\n\nwhen I receive [reset v]\nerase all\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen I start as a clone\ngo to [back v] layer\ngo to x: (x) y: (y)\nset [timer v] to [0]\nforever\n    set pen color to (#ff2222)\n    set pen size to (1)\n    erase all\n    pen down\n    repeat (10)\n        change y by (250)\n        change y by (-250)\n        change pen size by (3)\n        wait (0.1) seconds\n        change [timer v] by (1)\n    end\n    if <(timer) > [15]> then\n        broadcast (Stop Laser v)\n        delete this clone\n    end\nend\n\nwhen flag clicked\nhide\n\ndefine Start Laser Again\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [3]> then\n    Place Clone At [0] [120]\nend\nif <(Level) = [5]> then\n    Place Clone At [2] [120]\nend\nif <(Level) = [6]> then\n    Place Clone At [3] [120]\nend\nif <(Level) = [7]> then\n    Place Clone At [-55] [120]\nend\nhide\nset [x v] to [-99999]\n\nwhen I receive [stop laser v]\nstop [other scripts in sprite v]\nerase all\nwait (1.5) seconds\nbroadcast (Start Laser Again v)\n\nwhen I receive [start laser again v]\nStart Laser Again\n\nwhen I start as a clone\nset volume to (50) %\nforever\n    wait (0.5) seconds\n    play sound [zap sound v] until done\n    wait (0.5) seconds\nend\n\n@Imposter\n\nwhen flag clicked\nset rotation style [left-right v]\nhide\n\ndefine Place Clone At (x) (y)\nset [x v] to (x)\nset [y v] to (y)\nswitch costume to (walkcolor0001 v)\nshow\ncreate clone of (_myself_ v)\n\nwhen I receive [setup v]\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [2]> then\n    Place Clone At [90] [45]\nend\nif <(Level) = [3]> then\n    Place Clone At [90] [-90]\nend\nif <(Level) = [7]> then\n    Place Clone At [50] [-20]\nend\nhide\nset [x v] to [-99999]\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I start as a clone\nchange [color v] effect by (pick random (25) to (175))\ngo to x: (x) y: (y)\nPatrolling Around\n\ndefine Patrolling Around\nforever\n    repeat (25)\n        point in direction (90)\n        change x by (5)\n        next costume\n    end\n    switch costume to (idle v)\n    wait (0.5) seconds\n    repeat (25)\n        point in direction (-90)\n        change x by (-5)\n        next costume\n    end\n    switch costume to (idle v)\n    wait (0.5) seconds\nend\n\nwhen I start as a clone\nforever\n    if <(costume [number v]) = [6]> then\n        play sound [walk v] until done\n    end\nend\n\nwhen I start as a clone\nforever\n    if <touching (maincharacter v)?> then\n        broadcast (Die v)\n    end\nend\n\n@Smasher\n\nwhen flag clicked\nhide\n\ndefine Place Clone At (x) (y)\nset [x v] to (x)\nset [y v] to (y)\nshow\ncreate clone of (_myself_ v)\n\nwhen I receive [setup v]\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [5]> then\n    Place Clone At [206] [50]\nend\nif <(Level) = [9]> then\n    Place Clone At [2] [50]\nend\nhide\nset [x v] to [-99999]\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I start as a clone\ngo to x: (x) y: (y)\nSmash Down (y)\n\ndefine Smash Down (y)\nforever\n    repeat until <touching (ground v)?>\n        change y by (-2)\n    end\n    broadcast (PlaySmashSound v)\n    wait (1) seconds\n    repeat until <(y position) > (y)>\n        change y by (5)\n    end\nend\n\nwhen I receive [playsmashsound v]\nset volume to (50) %\nplay sound [crash metal v] until done\n\nwhen I start as a clone\nforever\n    if <touching (maincharacter v)?> then\n        broadcast (Die v)\n    end\nend\n\n