Nicolas HD Posted March 25, 2021 Share Posted March 25, 2021 Hi everyone, I hope you're all doing great ! I am currently learning code in order to create my own mobile game. I know how much times and investment this kind of projet will ask me. However, I am determine as never. ? Actually, I am looking for the best solution / tool to dev a mobile game 2D in order start learning how it works. PixiJS looks great ! However, my game will need a distance counter (km otherwise steps) feature. -> Is it easy to get this kind of feature with PixiJS ? Through an API i guesss ? To be more explicit, the "user story" of this feature would be :- as a gamer, - I need that my mobile game counts the distance i made (by walking or running) in real life, - in order to avance in the story of my game. Exemple : the gamer has to walk 3 km to get access to a new part of the story that his hero is following. Thanks in advance for your inlights about this subject ! NHD Quote Link to comment Share on other sites More sharing options...
b10b Posted March 28, 2021 Share Posted March 28, 2021 Pixi aside, I think this task splits into a few questions: Can we use JS to measure "steps" Can we run JS run when the screen is locked / device is in pocket / player is walking Should we do this with pure JS? "1" is certainly "yes", and there is existing code to do this by measuring the rhythm of motionevents over time (http://sebastien.menigot.free.fr/pedometer_explanations.html). "2" is a limited "yes" for a period of time after the screen is locked, by using service worker hacks or audio events. "3" is almost definately "no" - because there are better approaches, and imagine what any website could do while in your pocket if such processing was viable! Some alternatives directions: Test out the Cordova pedometer plugin (https://github.com/leecrossley/cordova-plugin-pedometer), does it work for your user base? If so that's probably a good start? Targetting wearables specifically. For example making a web app for Tizen / Samsung Watch that links directly to the pedometer sensor? Other vendors may have similar? Connecting to other web APIs that are already measuring the user's distance. For example Google's geo. Quote Link to comment Share on other sites More sharing options...
Nicolas HD Posted April 1, 2021 Author Share Posted April 1, 2021 Thanks b10b for your time and your meaningful answer ! ? I will take the time to explore the alternative directions. Thanks again ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.