Grass platformer #Games

Instructions: W A S D or mobile or keys try to get to a safe house before the grass gets to you!!

@Stage\n\n@Character\n\nwhen I start as a clone\nswitch costume to (costume2 v)\nrepeat (5)\n    change size by (-5)\n    change [ghost v] effect by (-5)\nend\ndelete this clone\n\nwhen flag clicked\nset [xvel v] to [0]\nset [yvel v] to [0]\ngo to x: (-200) y: (-52)\nswitch costume to (costume1 v)\nforever\n    Platform Physics X [1.4] [0.85] [6] [6]\n    Platform Physics Y [-0.9] [-0.9]\nend\n\ndefine Platform Physics X (running speed) (friction) (wall jump vertical) (wall jump horizontal)\nif <<key (right arrow v) pressed?> or <(STICK X) > [0.5]>> then\n    change [xvel v] by (running speed)\nend\nif <<key (left arrow v) pressed?> or <(STICK X) < [-0.5]>> then\n    change [xvel v] by ((running speed) * (-1))\nend\nset [xvel v] to ((XVel) * (friction))\nchange x by (XVel)\nif <touching (platforms v)?> then\n    set [oldy v] to (y position)\n    repeat (([abs v] of (XVel) ) + (1))\n        if <touching (platforms v)?> then\n            change y by (1)\n        end\n    end\n    if <touching (platforms v)?> then\n        set y to (OldY)\n        repeat ([ceiling v] of ([abs v] of (XVel) ) )\n            change x by ((([abs v] of (XVel) ) / (XVel)) * (-1))\n        end\n    end\n    if <<key (up arrow v) pressed?> or <(STICK Y) > [0.5]>> then\n        if <(XVel) < [0]> then\n            if <<key (left arrow v) pressed?> or <(STICK X) < [-0.5]>> then\n                set [xvel v] to [8]\n                set [yvel v] to [8]\n            end\n        else\n            set [xvel v] to [0]\n            if <<key (right arrow v) pressed?> or <(STICK X) > [0.5]>> then\n                set [xvel v] to [-8]\n                set [yvel v] to [8]\n            end\n        end\n    end\nend\n\ndefine Platform Physics Y (jump height) (gravity)\nchange y by (YVel)\nif <touching (platforms v)?> then\n    repeat ([abs v] of (YVel) )\n        if <touching (platforms v)?> then\n            change y by ((([abs v] of (YVel) ) / (YVel)) * (-1))\n        end\n    end\n    if <<<key (up arrow v) pressed?> or <(STICK Y) > [0.5]>> and <not <(YVel) > [0]>>> then\n        set [yvel v] to [14]\n    else\n        set [yvel v] to [0]\n    end\nelse\n    change [yvel v] by (gravity)\nend\n\nwhen flag clicked\nforever\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nforever\n    if <(x position) > [235]> then\n        reset\n        change [level v] by (1)\n    end\nend\n\ndefine reset\ngo to x: (-200) y: (-52)\n\nwhen flag clicked\nforever\n    if <touching (danger v)?> then\n        reset\n    end\nend\n\n@Platforms\n\nwhen flag clicked\nswitch costume to (1 v)\nforever\n    switch costume to (level)\nend\n\n@Danger\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [level v] to [1]\nshow\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@Control Stick\n\nwhen flag clicked\ngo to [front v] layer\nset size to (145) %\nset [myself v] to [Control Stick]\nset [max stick v] to ((size) / (4))\nset [stick direction v] to [90]\nswitch costume to (base v)\nset [ghost v] effect to (60)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nswitch costume to (stick v)\ngo [forward v] (1) layers\nset [ghost v] effect to (25)\nforever\n    set [stick power v] to []\n    set [stick x v] to [0]\n    set [stick y v] to [0]\n    repeat until <mouse down?>\n        go to (myself)\n    end\n    if <(distance to [mouse-pointer v]) < ((size) * (0.6))> then\n        Stick Drag\n    else\n        wait until <not <mouse down?>>\n    end\nend\n\ndefine Stick Drag\nrepeat until <not <mouse down?>>\n    go to (mouse-pointer v)\n    point towards (myself)\n    turn right (180) degrees\n    set [stick direction v] to (direction)\n    set [stick power v] to (distance to [(myself) v])\n    if <(STICK POWER) > (max stick)> then\n        move ((max stick) - (STICK POWER)) steps\n        set [stick power v] to (max stick)\n    end\n    set [stick power v] to ((STICK POWER) / (max stick))\n    set [stick x v] to ((STICK POWER) * ([sin v] of (STICK DIRECTION) ))\n    set [stick y v] to ((STICK POWER) * ([cos v] of (STICK DIRECTION) ))\nend\n\n@Sprite1\n\n@ThumbnailSprite2\n\nwhen flag clicked\nforever\n    show\n    go to [front v] layer\n    set [ghost v] effect to (100)\n    go to x: (36) y: (28)\nend\n\n