
Gyroscope access on mobile
Moderator: Klaus
Gyroscope access on mobile
Coding tilt control into apps requires access to the gyroscope, but - as far as I'm aware - we don't have this yet 

LiveCode Development & Training : http://splash21.com
Re: Gyroscope access on mobile
using the accelerometer works fine. I have a simple stack that runs on my kindle that rolls a ball around the screen using tilt. Works pretty well.
Re: Gyroscope access on mobile
Thanks, Sturgis. The last time I tried using the accelerometer (some time ago!) I was sure that the accelerometer only gave you rate of change and reset to 0 when the device stopped moving, but after reading your reply, I gave it a quick test and it looks good! 

LiveCode Development & Training : http://splash21.com
Re: Gyroscope access on mobile
Works pretty darn well actually, and has some interesting affects too. (like an inertial affect.. if I push it straight sideways hard, the ball moves opposite (in relation to the kindle surface) as if it actually has some real mass and wishes to stay at rest. Hmm. wishes? Well you know what I mean. And yeah, no return to zero because (to steal a line from fraggle rock) "gravity works!"
Re: Gyroscope access on mobile
LiveCode Development & Training : http://splash21.com
Re: Gyroscope access on mobile
That is working SO nice.
So, the background. Is it 1 big graphic? Set the angle, calc the scroll values to keep the right spot under the flyer? Or individual blocks stitched together, all with angle set and position calced? Or a combination maybe? Either way, its nice and smooth!
Also like that your intersect/clipping stuff works so well.
So, the background. Is it 1 big graphic? Set the angle, calc the scroll values to keep the right spot under the flyer? Or individual blocks stitched together, all with angle set and position calced? Or a combination maybe? Either way, its nice and smooth!
Also like that your intersect/clipping stuff works so well.
Re: Gyroscope access on mobile
The map is a 1000x1000 grid - each grid square is 64x64 pixels. There are 100 image objects - every time a new frame is to be drawn, the objects from the map (a 1000x1000 array) that will be on screen are calculated and then the image objects are used 1 by 1 to create the scene - unused images are hidden. All objects are redrawn with angle and position recalculated relative to the ships position and heading. Using this approach, a much bigger map can be loaded and run at the same speed with no additional overhead.
B)
B)
LiveCode Development & Training : http://splash21.com
Re: Gyroscope access on mobile
That is snazzy. Kinda like the datagrid, only render the onscreen stuff.
Don't suppose you're going to create a library/3rd party addon out of your project? It works really well!
Don't suppose you're going to create a library/3rd party addon out of your project? It works really well!