+ 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.
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.
+ 9
Yep, not on mobile.
+ 7
might help you with yours
https://code.sololearn.com/WJ9LwX59OBl2/?ref=app
https://code.sololearn.com/WaP916C3rK7t/?ref=app
+ 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
+ 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.
+ 7
yeah, I've thought about centering it for that reason. Thanks for the feedback.
+ 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.
+ 6
try using like a d- pad, thats what ive had to do on mobile.
+ 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
+ 5
so far the best joystick design seen on SL, unfortunately doesnt work.
(Linux aarch64 in the android app)
+ 4
Joystick didn't work for me. LG/Android.
Great game!
+ 4
"The platform property returns the browser platform (operating system):
navigator.platform is Linux aarch64"
+ 4
hmm... shud be working then. Back to drawing board...
EDIT, does work on mine, same nav platform. Wonder why it doesn't work.
+ 4
I made this vector based joystick using p5js. maybe it can be useful to you.
https://code.sololearn.com/WLuKXEpBoGwx/?ref=app