hello construct2 fellas,
i want to detect if the user is "shaking" the mobile device, like for shaking cards.
Using the accelormeter built it wont work, because if hold the mobile device for example at 45degrees on the X-axe, the X-acceloremeter just keeps its current value.
Is there a build in function to get the delta? Otherwise i'd maybe write my own plugin or script to detect it with acceloremeterDeltaX and some threshold value - or does there exist such an event? well, thanks
Develop games in your browser. Powerful, performant & highly capable.
sharing is caring.
due to the good support and ideas i want to present my solution on this topic - all done with no extra plugins except for the Touch one and system events.
the deal is, to detect a "real" shake.
I'm using this import variables and constants(all other are just some mechanics for our game).
Note that this is only for the X-Accelormeter, which is enough. i didn't expermine with Y/Z on this, but it's working as intended. so no need to add Y/Z.
you may notice the else block: there's a 0.8 seconds delay, which is another delay for an aftershake effect. its mostly used to play the "end"-shake value.
when the game is on the store, i'll notice you, so you can imagine a better way for what this whole thing is used.
just see the image for full details on that shaking.
wolfomat would you care to share a capx? im really having trouble setting it up!
Thanks so much for the explanation anyways!