Sonic Platformer Physics
@Stage\n\n@Sprite1\n\nwhen flag clicked\npoint in direction (-90)\ngo to x: (24) y: (-19)\nset rotation style [left-right v]\nswitch costume to (idle \(l\) v)\nset size to (150) %\nset [yv v] to [0]\nset [xv v] to [0]\nset [falling v] to [10]\nforever\n    switch costume to (hitbox v)\n    change [yv v] by (-1.5)\n    change y by (Yv)\n    Touch Ground <(Yv) > [0]>\n    set [xv v] to ((Xv) * (0.85))\n    if <key (a v) pressed?> then\n        change [xv v] by (-2)\n    end\n    if <key (d v) pressed?> then\n        change [xv v] by (2)\n    end\n    if <(Xv) < [-.1]> then\n        Walk (-90) (Xv)\n    else\n        if <(Xv) > [.1]> then\n            Walk (90) (Xv)\n        else\n            if <(falling) < [3]> then\n                set [frame v] to [0]\n            end\n        end\n    end\n    if <key (w v) pressed?> then\n        if <<(jump) = [0]> and <(falling) < [3]>> then\n            set [yv v] to [18]\n            set [falling v] to [6]\n            set [jump v] to [1]\n            start sound [jump v]\n        end\n    else\n        set [jump v] to [0]\n    end\n    Set Costume\nend\n\ndefine Touch Ground <>\nchange [falling v] by (1)\nrepeat until <not <touching color (#000000)?>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling v] to [0]\n    end\n    set [yv v] to [0]\nend\n\ndefine Set Costume\nif <(falling) < [6]> then\n    if <(frame) = [0]> then\n        switch costume to (idle \(l\) v)\n    else\n        switch costume to ([floor v] of ((2) + ((frame) mod (8))) )\n    end\nelse\n    change [frame v] by (1.5)\n    switch costume to ([floor v] of ((10) + ((frame) mod (7))) )\nend\n\ndefine None\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching color (#000000)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\nend\nif <(falling) < [3]> then\n    if <(speed) > [0]> then\n        change [frame v] by ((speed) / (-8))\n    else\n        change [frame v] by ((speed) / (8))\n    end\nend\n\nwhen flag clicked\nforever\n    play sound [01-01- Windfall.mp3 v] until done\nend\n\n@Sprite2\n\nwhen I start as a clone\ngo to [front v] layer\nshow\nrepeat until <(distance to [sprite1 v]) < [35]>\n    switch costume to (ringsmallani1 v)\n    repeat (3)\n        next costume\n        if <(distance to [sprite1 v]) > [34]> then\n            wait (0.04) seconds\n        end\n    end\nend\nstart sound [ring v]\nswitch costume to (glint v)\nset size to (70) %\nrepeat (5)\n    change y by (2)\nend\ndelete this clone\n\ndefine Clone\nrepeat (3)\n    create clone of (_myself_ v)\n    change x by (40)\nend\n\nwhen flag clicked\nhide\nset size to (170) %\ngo to x: (-200) y: (-84)\nClone\ngo to x: (135) y: (-83)\nClone\n\n