DOT DODGE PLATFORMER [mobile version]

Instructions: WELCOME TO:\nD O T   D O D G E!\n\nUse the joystick (see credits) positioned in the lower right corner to manoeuvre the ball out of the way of the obstacles. Careful though the obstacles will pick up speed the longer you survive.

@Stage\n\nwhen flag clicked\n\nwhen I receive [delete joystick clones v]\n\n@Joystick Engine\n\ndefine Get Direction From x: (x2) y: (y2) To x: (x) y: (y)\nset [dir v] to (((90) - ([atan v] of (((y) - (y2)) / ((x) - (x2))) )) + (<((x) - (x2)) < [0]> * (180)))\n\ndefine Joystick at x: (x) y: (y) Size: (size)\nbroadcast (Delete Joystick Clones v) and wait\nswitch costume to (joy v)\nset size to (size) %\nshow\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\ngo to [front v] layer\ngo [backward v] (1) layers\n\nwhen I receive [delete joystick clones v]\nrepeat (5)\n    delete this clone\nend\nhide\n\nwhen I start as a clone\nswitch costume to (stick v)\nset size to (([size v] of [joystick engine v]) / (2)) %\nforever\n    go to x: ([x position v] of [joystick engine v]) y: ([y position v] of [joystick engine v])\n    set [touching? v] to [0]\n    wait until <mouse down?>\n    if <(GhostEffect) = [20]> then\n        set [touching? v] to [1]\n        repeat until <not <mouse down?>>\n            go to x: (mouse x) y: (mouse y)\n            Get Direction From x: ([x position v] of [joystick engine v]) y: ([y position v] of [joystick engine v]) To x: (x position) y: (y position)\n            change x by (([sin v] of (Dir) ) * (2))\n            change y by (([cos v] of (Dir) ) * (2))\n            if <not <touching (joystick engine v)?>> then\n                go to x: (([x position v] of [joystick engine v]) + (([sin v] of (Dir) ) * ((size) * (0.3)))) y: (([y position v] of [joystick engine v]) + (([cos v] of (Dir) ) * ((size) * (0.3))))\n            end\n            change x by ((([sin v] of (Dir) ) * (2)) * (-1))\n            change y by ((([cos v] of (Dir) ) * (2)) * (-1))\n            Direction -> Controls Script HERE\n        end\n    end\nend\n\nwhen flag clicked\nJoystick at x: [159] y: [-100] Size: [300]\nforever\n    switch costume to (joy v)\n    if <<(distance to [mouse-pointer v]) < ((size) / (5))> or <(Touching?) = [1]>> then\n        set [ghosteffect v] to [20]\n    else\n        set [ghosteffect v] to [90]\n    end\n    set [ghost v] effect to (GhostEffect)\nend\n\nwhen I start as a clone\nforever\n    show\n    set [ghost v] effect to ((GhostEffect) - (5))\n    go to [front v] layer\nend\n\ndefine Direction -> Controls Script HERE\nchange [playerx v] by (([sin v] of (Dir) ) * ((distance to [joystick engine v]) / ((size) / (20))))\nchange [playery v] by (([cos v] of (Dir) ) * ((distance to [joystick engine v]) / ((size) / (20))))\n\nwhen flag clicked\ngo to [front v] layer\nwait (1) seconds\nhide\n\nwhen I receive [kill game v]\nhide\n\n@Ball\n\nwhen flag clicked\nset [playerx v] to [0]\nset [playery v] to [0]\nforever\n    point in direction (90)\n    go to x: (PlayerX) y: (PlayerY)\n    if on edge, bounce\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\nwait (1) seconds\nhide\n\nwhen I receive [done v]\nshow\nforever\n    if <<touching (sprite1jjj v)?> or <touching (sprite1jjj2 v)?>> then\n        hide variable [☁ hi score v]\n        hide variable [☁ score v]\n        hide variable [speed v]\n        broadcast (Ya huh v)\n        broadcast (KILL GAME v)\n        hide\n        play sound [pacman_death v] until done\n    end\nend\n\n@Back Ground\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nset [ghost v] effect to (0)\ngo to [front v] layer\n\nwhen I receive [play v]\nshow\ngo to [back v] layer\nrepeat (10)\n    change [ghost v] effect by (-1)\n    wait (0.01) seconds\nend\n\n@Sprite1jjj\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nswitch costume to (costume2 v)\nshow\nwait (1) seconds\nhide\n\nwhen I receive [done v]\nshow\nswitch costume to (costume2 v)\nset [speed v] to [1]\nset [speed v] to [10]\ngo to x: (20) y: (148)\nglide (speed) secs to x: (7) y: (-133)\nstart sound [8-bit Sound Effect v]\nhide\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\ngo to x: (20) y: (148)\nset [costume v] to (pick random (1) to (6))\nif <(Costume) = [1]> then\n    switch costume to (costume1 v)\nelse\n    if <(Costume) = [2]> then\n        switch costume to (costume2 v)\n    else\n        if <(Costume) = [3]> then\n            switch costume to (costume3 v)\n        else\n            if <(Costume) = [4]> then\n                switch costume to (costume3 v)\n            else\n                if <(Costume) = [5]> then\n                    switch costume to (costume5 v)\n                else\n                    if <(Costume) = [6]> then\n                        switch costume to (costume6 v)\n                    end\n                end\n            end\n        end\n    end\nend\nglide (speed) secs to x: (7) y: (-133)\nchange [☁ score v] by (1)\nplay sound [8-bit Sound Effect v] until done\ncreate clone of (_myself_ v)\ndelete this clone\n\nwhen I receive [kill game v]\nhide\nstop [other scripts in sprite v]\n\n@Sprite1\n\nwhen flag clicked\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\nwait (1) seconds\nrepeat (25)\n    change [ghost v] effect by (-4)\n    wait (0.01) seconds\nend\n\nwhen this sprite clicked\nhide\nbroadcast (Loading Screen v)\n\n@Sprite2\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\nwhen I receive [loading screen v]\nrepeat (100)\n    change [ghost v] effect by (-1)\nend\nbroadcast (Spin v)\n\nwhen I receive [play v]\nrepeat (100)\n    change [ghost v] effect by (1)\n    wait (0.01) seconds\nend\nbroadcast (Done v)\n\nwhen I receive [done v]\nforever\n    wait (10) seconds\n    change [speed v] by (-1)\n    change [speed v] by (1)\nend\n\nwhen flag clicked\nset [☁ score v] to [0]\nforever\n    if <(☁ Score) > (☁ HI SCORE)> then\n        say (join [YOU SET A NEW HI SCORE OF ] (☁ Score)) for (2) seconds\n        set [☁ hi score v] to (☁ Score)\n    end\nend\n\nwhen I receive [kill game v]\nrepeat (100)\n    change [ghost v] effect by (-1)\nend\n\nwhen I receive [done v]\nforever\n    if <(Speed) = [10]> then\n        set [speed v] to [0.01]\n        set [speed v] to [ULTRA MODE!!!]\n    end\nend\n\n@Sprite4\n\nwhen flag clicked\nhide\nset [song v] to (pick random (0) to (2))\nif <(Song) = [1]> then\n    forever\n        play sound [A Night Of Dizzy Spells v] until done\n    end\nelse\n    forever\n        play sound [Come and Find Me v] until done\n    end\nend\n\nwhen I receive [kill game v]\nshow\nset [ghost v] effect to (100)\nrepeat (100)\n    change [ghost v] effect by (-1)\n    wait (0.01) seconds\nend\nset [speed v] to [0]\nset [speed v] to [10]\nsay (join [Your score was ] (☁ Score)) for (2) seconds\n\nwhen I receive [kill game v]\nstop [other scripts in sprite v]\n\n@Sprite5\n\nwhen I receive [loading screen v]\nhide\n\nwhen flag clicked\nhide variable [☁ hi score v]\nhide variable [☁ score v]\nhide variable [speed v]\n\nwhen I receive [done v]\nhide\nshow variable [☁ hi score v]\nshow variable [☁ score v]\nshow variable [speed v]\n\n@Sprite1jjj2\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nswitch costume to (costume2 v)\nshow\nwait (1) seconds\nhide\n\nwhen I start as a clone\nshow\ngo to x: (7) y: (-133)\nset [costume v] to (pick random (0) to (6))\nif <(Costume) = [1]> then\n    switch costume to (costume1 v)\nelse\n    if <(Costume) = [2]> then\n        switch costume to (costume2 v)\n    else\n        if <(Costume) = [3]> then\n            switch costume to (costume3 v)\n        else\n            if <(Costume) = [4]> then\n                switch costume to (costume3 v)\n            else\n                if <(Costume) = [5]> then\n                    switch costume to (costume5 v)\n                else\n                    if <(Costume) = [6]> then\n                        switch costume to (costume6 v)\n                    end\n                end\n            end\n        end\n    end\nend\nglide (speed) secs to x: (20) y: (148)\nchange [☁ score v] by (1)\nplay sound [8-bit Sound Effect v] until done\ncreate clone of (_myself_ v)\ndelete this clone\n\nwhen I receive [kill game v]\nhide\nstop [other scripts in sprite v]\n\nwhen flag clicked\nset [speed v] to [1]\nset [speed v] to [10]\nbroadcast (Double v)\nforever\n    if <(Speed) = [5]> then\n        show\n        switch costume to (costume2 v)\n        go to x: (7) y: (-133)\n        glide (speed) secs to x: (20) y: (148)\n        play sound [8-bit Sound Effect v] until done\n        hide\n        create clone of (_myself_ v)\n    end\nend\n\nwhen [space v] key pressed\nset [speed v] to [5]\n\n@Back Ground2\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nset [ghost v] effect to (0)\ngo to [back v] layer\nset [color v] effect to (0)\n\nwhen I receive [loading screen v]\nrepeat (100)\n    change [ghost v] effect by (1)\n    wait (0.01) seconds\nend\n\n@Sprite3\n\nwhen flag clicked\nhide\n\nwhen I receive [spin v]\nshow\nforever\n    change [color v] effect by (4)\nend\n\nwhen I receive [spin v]\nInstall from server [E35b]\nFrom E35b import game\nwait (0) seconds\nbroadcast (Play v)\nhide\n\ndefine Install from server (e35b)\n\ndefine From E35b import game\n\n@Sprite6\n\nwhen flag clicked\nhide\n\n