Infection || A Platformer

Instructions: Part Two - https://scratch.mit.edu/projects/381523055\nNote - This Virus is not Joke\n\nWelcome to Infection. Try to escape the Bio Lab by using the Arrow Keys, WASD, and Mobile touch.

@Stage\n\n@player\n\nwhen flag clicked\nhide\n\ndefine Tick\ngo to [front v] layer\nset rotation style [left-right v]\nif <(x position) > [233]> then\n    change [level v] by (1)\n    Reset\nend\nif <<touching (danger v)?> or <(y position) < [-179]>> then\n    broadcast (Death v)\n    hide\n    wait (1) seconds\n    Reset\nend\nif <touching (bounce v)?> then\n    set y to (y position)\n    set [y vel v] to [25]\nend\nswitch costume to (hitbox v)\n\nwhen flag clicked\nforever\n    broadcast (Tick v) and wait\nend\n\ndefine Reset\ngo to x: (-183) y: (-80)\nset [x vel v] to [0]\nset [y vel v] to [0]\nshow\n\nwhen I receive [redo v]\nReset\n\nwhen I receive [skip v]\nchange [level v] by (1)\nReset\n\nwhen I receive [start v]\nhide\nReset\nforever\n    platform physics (12) (-1) (.8) (1) (10) (6)\nend\n\nwhen flag clicked\nset [level v] to [1]\nforever\n    Tick\nend\n\ndefine platform physics (jump height) (gravity) (friction) (movement speed) (wall jump vm) (wall jump hm)\nchange y by (y vel)\nif <touching (ground v)?> then\n    repeat ([abs v] of (y vel) )\n        if <touching (ground v)?> then\n            change y by ((-1) * (([abs v] of (y vel) ) / (y vel)))\n        end\n    end\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(y position) < (mouse y)>>> and <not <(y vel) > [0]>>> then\n        set [y vel v] to (jump height)\n    else\n        set [y vel v] to [0]\n    end\nelse\n    change [y vel v] by (gravity)\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(x position) < (mouse x)>>> then\n    point in direction (90)\n    change [x vel v] by (movement speed)\nend\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    point in direction (-90)\n    change [x vel v] by ((-1) * (movement speed))\nend\nchange x by (x vel)\nif <touching (ground v)?> then\n    set [old y v] to (y position)\n    repeat (([abs v] of (x vel) ) + (1))\n        if <touching (ground v)?> then\n            change y by (1)\n        end\n    end\n    if <touching (ground v)?> then\n        set y to (old y)\n        repeat ([ceiling v] of ([abs v] of (x vel) ) )\n            if <touching (ground v)?> then\n                change x by ((-1) * (([abs v] of (x vel) ) / (x vel)))\n            end\n        end\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(y position) < (mouse y)>>> then\n            if <(x vel) < [0]> then\n                set [x vel v] to [0]\n                if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n                    set [x vel v] to (wall jump hm)\n                    set [y vel v] to (wall jump vm)\n                end\n            else\n                set [x vel v] to [0]\n                if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(x position) < (mouse x)>>> then\n                    set [x vel v] to ((-1) * (wall jump hm))\n                    set [y vel v] to (wall jump vm)\n                end\n            end\n        end\n    end\nend\nset [x vel v] to ((x vel) * (friction))\n\n@ground\n\nwhen I receive [tick v]\nswitch costume to (LEVEL)\ngo to x: (0) y: (0)\n\n@Danger\n\nwhen flag clicked\ngo to [back v] layer\nset [ghost v] effect to (100)\nset [me v] to [1]\nset [brightness v] effect to (20)\nrepeat (3)\n    create clone of (_myself_ v)\n    change [brightness v] effect by (-10)\n    change [me v] by (1)\nend\n\nwhen I start as a clone\nset [ghost v] effect to (60)\nforever\n    set y to ((([sin v] of (((timer) + (me)) * (300)) ) * (10)) - (5))\nend\n\nwhen I receive [tick v]\nswitch costume to (LEVEL)\n\ngo to [back v] layer\n\n@grunge_surface_dark_scratches_18460_3840x2400\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo [backward v] (50) layers\nshow\nforever\n    go to [front v] layer\n    set [ghost v] effect to (97)\nend\n\n@Background particles\n\nwhen flag clicked\nhide\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nshow\ngo to [back v] layer\ngo to x: (10000) y: (pick random (-180) to (180))\npoint in direction (pick random (-60) to (-135))\nset size to (pick random (40) to (130)) %\nset [ghost v] effect to (pick random (70) to (90))\nset [speed v] to (pick random (4) to (10))\n\nwhen I receive [tick v]\nmove (speed) steps\nif <(x position) < [-200]> then\n    delete this clone\nend\n\n@Particle Engine\n\ndefine Create Clone (starting x) (starting y) (xvel) (yvel)\nhide\ngo to x: (starting x) y: (starting y)\nset [xvel v] to (xvel)\nset [yvel v] to (yvel)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\ngo [backward v] (1) layers\nswitch costume to (pick random (1) to (3))\nshow\nrepeat until <touching (_edge_ v)?>\n    change [yvel v] by (-1)\n    change x by (Xvel)\n    change y by (Yvel)\nend\ndelete this clone\n\nwhen I receive [death v]\nInt\n\ndefine Int\nrepeat (10)\n    Create Clone ([x position v] of [player v]) ([y position v] of [player v]) (pick random (-10) to (10)) (pick random (10) to (-10))\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nforever\n    Create Clone ([x position v] of [player v]) ([y position v] of [player v]) (pick random (-5) to (5)) (pick random (10) to (1))\nend\n\n@Back decor\n\nwhen I receive [tick v]\ngo to [back v] layer\nswitch costume to (LEVEL)\n\n@Sprite1\n\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\n\nwhen flag clicked\nhide\n\n@Sprite2\n\nwhen flag clicked\nshow\nclear graphic effects\nwait (2) seconds\nbroadcast (Menu v)\nrepeat (50)\n    go to [front v] layer\n    change [ghost v] effect by (2)\nend\nhide\n\n@Sprite3\n\nwhen I receive [start v]\nshow\nforever\n    go to (player v)\n    go to [back v] layer\nend\n\nwhen flag clicked\nhide\n\n@Menu\n\nwhen I receive [reset clones v]\ndelete this clone\n\nwhen I start as a clone\nif <(clone id) = [2]> then\n    go [backward v] (1) layers\n    switch costume to (costume3 v)\n    glide (.5) secs to x: (-156) y: (155)\nelse\n    switch costume to (costume2 v)\n    glide (.5) secs to x: (-188) y: (155)\nend\n\nwhen I receive [reset menu v]\nset [open v] to [0]\nif <[0] < (clone id)> then\n    glide (1) secs to x: (-218) y: (155)\nend\n\nwhen I start as a clone\nif <(clone id) = [1]> then\n    forever\n        if <touching (mouse-pointer v)?> then\n            set [brightness v] effect to (10)\n            if <mouse down?> then\n                wait until <not <mouse down?>>\n                broadcast (skip v) and wait\n            end\n        else\n            clear graphic effects\n        end\n    end\nelse\n    forever\n        if <touching (mouse-pointer v)?> then\n            set [brightness v] effect to (10)\n            if <mouse down?> then\n                wait until <not <mouse down?>>\n                broadcast (redo v) and wait\n            end\n        else\n            clear graphic effects\n        end\n    end\nend\n\nwhen I receive [start v]\nshow\nbroadcast (reset clones v)\ngo to x: (-218) y: (155)\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (10)\n        if <mouse down?> then\n            wait until <not <mouse down?>>\n            if <(open) = [0]> then\n                broadcast (reset clones v)\n                set [clone id v] to [0]\n                set [open v] to [1]\n                repeat (2)\n                    change [clone id v] by (1)\n                    create clone of (_myself_ v)\n                end\n                set [clone id v] to [0]\n            else\n                broadcast (reset menu v) and wait\n            end\n        end\n    else\n        clear graphic effects\n    end\n    switch costume to (costume1 v)\nend\n\nwhen flag clicked\nhide\n\n@Sprite4\n\nwhen I receive [menu v]\nshow\ngo to x: (0) y: (0)\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by (((130) - (size)) / (3))\n        if <mouse down?> then\n            broadcast (Start v) and wait\n        end\n    else\n        change size by (((100) - (size)) / (10))\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nhide\n\n@Sprite5\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nhide\n\nwhen I receive [menu v]\nshow\nforever\n    point in direction ((90) + (([sin v] of (((timer) + ((#) / (10))) * (100)) ) * (10)))\nend\n\n@detector\n\nwhen flag clicked\nhide\nset [faved___ v] to [0]\nset [loved__ v] to [0]\nset [clone id2 v] to [0]\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [clone id2 v] to [1]\ncreate clone of (_myself_ v)\nwait until <<(LOVED__) = [1]> and <(FAVED___) = [1]>>\nwait (1) seconds\nshow\ngo to x: (0) y: (50)\nreset timer\nswitch costume to (pick random (1) to (4))\nset [ghost v] effect to (100)\nrepeat until <(timer) > [3.5]>\n    change y by ((y position) / (-15))\n    change [ghost v] effect by (-3)\nend\nreset timer\nrepeat until <(timer) > [3.5]>\n    change y by (((y position) - (-100)) / (-15))\n    change [ghost v] effect by (10)\nend\n\nwhen I start as a clone\nif <(clone id2) = [0]> then\n    go to x: (-15) y: (0)\n    set [loved__ v] to [0]\n    switch costume to (love v)\n    forever\n        set [love? v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [loved__ v] to [1]\n        end\n    end\nend\nif <(clone id2) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (fave v)\n    set [faved___ v] to [0]\n    forever\n        set [fav v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [faved___ v] to [1]\n        end\n    end\nend\n\n