Help test my joystick functionality? Windows & Mobile | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

Help test my joystick functionality? Windows & Mobile

here's the code https://code.sololearn.com/WaqGLukwdd5x/?ref=app Need to know if it works on everyone's phone/Pc, or if I will need to add some more code. Any other info about glitches would be helpful but really just want to know if the joystick works on your phone type or os type specifically. EDIT If I doesn't work for you, please run this code https://code.sololearn.com/W5BWySF5Jlde/?ref=app and post what you get as your navigator.platform so I can work on updates.

22nd May 2017, 12:55 AM
Russel Reeder
Russel Reeder - avatar
14 Answers
+ 7
After further testing If i just touch the joystick by hardly dragging it itll move the character accordingly. If I drag it anywhere near the edge of the circle it won't do much though. So I think it could be more of a problem with the circle / area of the joystick rather than the functionality of the joystick itself.
22nd May 2017, 1:25 AM
Rrestoring faith
Rrestoring faith - avatar
+ 9
Yep, not on mobile.
22nd May 2017, 1:15 AM
J.G.
J.G. - avatar
+ 7
document.getElementById("JoyStickMotion").addEventListener("mousemove", joyStickControls); ------> document.getElementById("JoyStickMotion").addEventListener("touchmove", joyStickControls); <----- I was missing this line. I only had the first line. This is why it didn't work on mobile. I encourage you all to try it again if it didn't work for you the first time. EDIT: It seems to work a lot better if slightly more pressure is applied to joystick than may be natural
22nd May 2017, 10:47 PM
Russel Reeder
Russel Reeder - avatar
+ 7
Wow it works great now! It's a little bit buggy but that may just be because SoloLearn sometimes tries to swipe the page to the JS instead of Output.
22nd May 2017, 10:52 PM
Rrestoring faith
Rrestoring faith - avatar
+ 7
yeah, I've thought about centering it for that reason. Thanks for the feedback.
22nd May 2017, 10:53 PM
Russel Reeder
Russel Reeder - avatar
+ 6
yeah, definitely got some bugs to work out with the touchmove functionality. Thanks for the feedback folks EDIT as it based on my phone resolution, might not be compatible with your phone... damn.
22nd May 2017, 1:26 AM
Russel Reeder
Russel Reeder - avatar
+ 6
try using like a d- pad, thats what ive had to do on mobile.
22nd May 2017, 4:14 AM
Russel Reeder
Russel Reeder - avatar
+ 5
Thanks. https://code.sololearn.com/W5BWySF5Jlde/?ref=app Could u tell me what this code shows as your navigator platform? I may be able to get it working for y'all
22nd May 2017, 1:18 AM
Russel Reeder
Russel Reeder - avatar
+ 5
so far the best joystick design seen on SL, unfortunately doesnt work. (Linux aarch64 in the android app)
22nd May 2017, 4:12 AM
seamiki
seamiki - avatar
+ 4
Joystick didn't work for me. LG/Android. Great game!
22nd May 2017, 1:13 AM
Rrestoring faith
Rrestoring faith - avatar
+ 4
"The platform property returns the browser platform (operating system): navigator.platform is Linux aarch64"
22nd May 2017, 1:20 AM
Rrestoring faith
Rrestoring faith - avatar
+ 4
hmm... shud be working then. Back to drawing board... EDIT, does work on mine, same nav platform. Wonder why it doesn't work.
22nd May 2017, 1:21 AM
Russel Reeder
Russel Reeder - avatar
+ 4
I made this vector based joystick using p5js. maybe it can be useful to you. https://code.sololearn.com/WLuKXEpBoGwx/?ref=app
23rd May 2017, 5:53 AM
seamiki
seamiki - avatar