+ 4

Joystick in javascript

how can i add a joystick to move my element?

13th Feb 2018, 1:35 PM
Blizz
Blizz - avatar
7 Answers
+ 9
now no need to copy the codes, I m hosting the files through rawgit (link credits SILENT) directly from my github repository, just add this to ur html code <script src="https://rawgit.com/NeetishRaj/game-controller/master/game-controller.js"></script> and to use the controller just call this function inside Ur own <script> tag controller(ur DOM object that need to be controlled) like shown below https://code.sololearn.com/W12AigT6bMfs/?ref=app
15th Feb 2018, 1:34 PM
Morpheus
Morpheus - avatar
+ 12
i experimented a bit with a joystick implementation kinda abandoned it half way tho and never looked back not sure why xD https://code.sololearn.com/WaP916C3rK7t/?ref=app
16th Feb 2018, 9:56 AM
Burey
Burey - avatar
+ 7
so this is what it looks like now, just pass the Dom element that u want to move as argument in the controller function it should be applicable on any device , with touch or with mouse, if issues please comment I ll improve it hopefully someday soon I can host this as js library then just one CDN link would be enough to use this controller in ur code https://code.sololearn.com/Wezs3S1lWQK1/?ref=app
14th Feb 2018, 8:10 AM
Morpheus
Morpheus - avatar
+ 5
it ll be a nice challenge code, i wanted to mk something like that which I can use like API s for controlling any element , I ll post the controller API as soon as I am done with it,👍
14th Feb 2018, 7:33 AM
Morpheus
Morpheus - avatar
+ 4
@Burey, yep game controller are not that satisfying when dealing with actual gameplay experience, but I like this type of effect , (oops, looks like she changed the joystick , before it was click anywhere and joystick would appear kinda experience) although it has map moving but not the Object https://code.sololearn.com/WS66VmXSe8Y5/?ref=app
16th Feb 2018, 10:11 AM
Morpheus
Morpheus - avatar
+ 4
this is the one where object stays at same place , and only rotates , but the map moves on controller touch, giving the illusion of movement https://code.sololearn.com/WM69XHQC8dy2/?ref=app
17th Feb 2018, 10:08 AM
Morpheus
Morpheus - avatar
+ 3
@martin browser js doesn't but nodejs has,
16th Feb 2018, 10:53 AM
Morpheus
Morpheus - avatar