Burning Sands - Platformer

Instructions: Escape the desert before you get burned!\nArrow keys or WASD to move!\nPlease love, favorite, and follow me for more!\nHave fun!\nSTAY SAFE GUYS!\n:D\n

@Stage\n\n@Sprite1\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\nwhen flag clicked\nforever\n    play sound [Boom Kitty - Burning Sands \[Beat Saber Soundtrack\] v] until done\nend\n\ngo to (random position v)\n\npoint in direction (90)\n\n@Sprite2\n\nwhen flag clicked\ngo to [back v] layer\nset [ghost v] effect to (15)\ngo to x: (250) y: (-115)\nforever\n    repeat (500)\n        change x by (-1)\n    end\n    repeat (500)\n        change x by (1)\n    end\nend\n\n@Sprite3\n\ndefine Platformer engine\nif on edge, bounce\nchange [y v] by (-0.5)\nif <key (left arrow v) pressed?> then\n    change [x v] by (-1)\nend\nif <key (right arrow v) pressed?> then\n    change [x v] by (1)\nend\nset [x v] to ((x) * (0.9))\nchange x by (x)\nif <touching (ground v)?> then\n    change y by (1)\n    if <touching (ground v)?> then\n        change y by (1)\n        if <touching (ground v)?> then\n            change y by (1)\n            if <touching (ground v)?> then\n                change y by (1)\n                if <touching (ground v)?> then\n                    change y by (1)\n                    if <touching (ground v)?> then\n                        change y by (1)\n                        if <touching (ground v)?> then\n                            change y by (-6)\n                            change x by ((x) * (-1))\n                            if <key (up arrow v) pressed?> then\n                                set [y v] to [10]\n                                if <(x) > [0]> then\n                                    set [x v] to [-10]\n                                else\n                                    set [x v] to [10]\n                                end\n                            else\n                                set [x v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange y by (y)\nif <touching (ground v)?> then\n    change y by ((y) * (-1))\n    set [y v] to [0]\nend\nchange y by (-0.5)\nif <<touching (ground v)?> and <key (up arrow v) pressed?>> then\n    set [y v] to [10]\nend\nchange y by (0.5)\nif <touching (ground v)?> then\n    go to x: (X Spawn) y: (Y Spawn)\nend\nif <touching (ground v)?> then\n    set [y v] to [16]\nend\n\nwhen flag clicked\npoint in direction (90)\ngo to x: (-200) y: (100)\nset [y spawn v] to [-129]\nset [x spawn v] to [-218]\ngo to x: (X Spawn) y: (Y Spawn)\nshow\nset size to (75) %\nset [x v] to [0]\nset [y v] to [0]\nforever\n    Platformer engine\nend\n\nwhen flag clicked\nforever\n    point in direction (90)\nend\n\nwhen flag clicked\nforever\n    if <touching (end v)?> then\n        broadcast (next v)\n        go to x: (-218) y: (-128)\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching color (#f5711e)?> then\n        go to x: (-218) y: (-128)\n    end\nend\n\n@ground\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\n\nwhen I receive [next v]\nnext costume\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [11]> then\n        show variable [time v]\n    end\nend\n\nwhen flag clicked\nhide variable [time v]\nset [time v] to [0]\nrepeat until <(costume [number v]) = [11]>\n    wait (1) seconds\n    change [time v] by (1)\nend\n\n@Sprite4\n\nwhen flag clicked\ngo to [front v] layer\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\n\nwhen I receive [next v]\nnext costume\n\n@end\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\n\nwhen I receive [next v]\nnext costume\n\n