Joystick Platformer 

Instructions: joystick to move\nworks on all devices \n

@Stage\n\n@Cat\n\nwhen I receive [reset v]\ngo to x: (-160) y: (-40)\n\nwhen flag clicked\n\nwhen flag clicked\nset rotation style [left-right v]\nshow\nswitch costume to (コスチューム3 v)\ngo to [front v] layer\npoint in direction (-90)\ngo to x: (-160) y: (-40)\nforever\n    change [y v] by (-1)\n    if <[-2.5] > (Joystick_x_velocity)> then\n        point in direction (-90)\n        change [x v] by (-1)\n    end\n    if <(Joystick_x_velocity) > [2.5]> then\n        point in direction (90)\n        change [x v] by (1)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching color (#000000)?> then\n        change y by (1)\n        if <touching color (#000000)?> then\n            change y by (1)\n            if <touching color (#000000)?> then\n                change y by (2)\n                if <touching color (#000000)?> then\n                    change y by (2)\n                    if <touching color (#000000)?> then\n                        change y by (-4)\n                        change x by ((x) * (-1.1))\n                        if <(Joystick_y_velocity) > [5.5]> then\n                            set [y v] to [12]\n                            if <([abs v] of (x) ) = (x)> 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    change y by (y)\n    if <touching color (#000000)?> then\n        change y by ((y) - ((y) * (2)))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <touching color (#000000)?> then\n        if <(Joystick_y_velocity) > [5.5]> then\n            set [y v] to [12]\n        end\n    end\n    change y by (1)\n    if <touching color (#ff0000)?> then\n        go to x: (-198) y: (-115)\n    end\n    if <key (r v) pressed?> then\n        broadcast (reset v)\n    end\n    if <touching color (#2eff00)?> then\n        broadcast (next v)\n        wait until <not <touching color (#2eff00)?>>\n    end\nend\n\nwhen flag clicked\n\nwhen flag clicked\n\nwhen I receive [next v]\ngo to x: (-160) y: (-40)\n\nwhen I receive [next v]\ngo to x: (-160) y: (-40)\n\nif <[] = [1]> then\n\nwhen I receive [next v]\ngo to x: (-198) y: (-115)\n\n@Joystick\n\ndefine Render Joystick\npen up\nerase all\ngo to x: (Joystick_x_position) y: (Joystick_y_position)\nset pen size to (Joystick_size)\nSet pen color [140] [140] [140] [200]\npen down\npen up\nSet pen color [200] [200] [200] [200]\nset pen size to (Joystickknob_size)\nif <(distance to [mouse-pointer v]) < (((Joystick_size) / (2)) - ((Joystickknob_size) / (2)))> then\n    go to (mouse-pointer v)\nelse\n    point towards (mouse-pointer v)\n    move (((Joystick_size) / (2)) - ((Joystickknob_size) / (2))) steps\nend\npen down\npen up\nset [joystick_x_velocity v] to ((((x position) - (Joystick_x_position)) / (((Joystick_size) / (2)) - ((Joystickknob_size) / (2)))) * (Joystick_x_max_velocity))\nset [joystick_y_velocity v] to ((((y position) - (Joystick_y_position)) / (((Joystick_size) / (2)) - ((Joystickknob_size) / (2)))) * (Joystick_y_max_velocity))\n\ndefine Set pen color (r) (g) (b) (a)\nset pen color to (((((((a) * (256)) + (r)) * (256)) + (g)) * (256)) + (b))\n\nwhen flag clicked\ngo [backward v] (9999999999999999) layers\nset [joystick_size v] to [100]\nset [joystickknob_size v] to [35]\nset [joystick_x_max_velocity v] to [10]\nset [joystick_y_max_velocity v] to [10]\nforever\n    if <mouse down?> then\n        if <(First_Position_set?) = [0]> then\n            set [joystick_x_position v] to (mouse x)\n            set [joystick_y_position v] to (mouse y)\n            set [first_position_set? v] to [1]\n        end\n        Render Joystick\n    else\n        set [joystick_x_velocity v] to ((Joystick_x_velocity) * (.2))\n        set [joystick_y_velocity v] to ((Joystick_y_velocity) * (.9))\n        set [first_position_set? v] to [0]\n        erase all\n    end\nend\n\nRender Joystick\n\n@Sprite1\n\nwhen flag clicked\ngo to [back v] layer\nswitch costume to (costume1 v)\n\nwhen I receive [next v]\nnext costume\n\n