need help with accelerometercontrol behavior in portrait mode
rdcube
Member Posts: 361
Hi y'all,
I've seen a couple of apps made with GS (Jumpo, and doodle crash to name a couple) that makes the character move by tilting the device left and right.
I followed some video that TSB made a couple of months ago on implementing accelerometer in your games.
There is also a couple of templates/demos that show this feature, as well as the wiki.
They all work and I managed to make them work on my device as well. X/Y (or left/right, up/down) tilt work perfect.
My main question/problem is, we always set X/Y to +/- 0.1 or something to that effect, which works perfectly if you have the device laying flat on it's back and you tilt around, so the 'ball' moves perfectly along the device/screen (granted you have set your friction, density, etc, accordingly).
What I want to do instead, is have the device straight up (completely standing up portrait position), have a character (let's call it 'ball') which will be positioned not completely down (about 1/4 of the bottom of the screen/device...I assume this is like a -1 for the Y)
What I would like to do, is that once the device is straight up ( | ), I need to tilt the device just about 10~20 degress ( / ) away from user ( something like this: | to this / ); once the device is tilt, have the 'ball' move 'up' and if you tilt back (or towards you) again, it slowly moves 'down' instead of just dropping (I played with gravity, but this affects the rest of my characters as wel).
Hope all this rumbling makes sense...I'm trying and trying with no luck.
If anybody could please wipe up a quick 'template/demo', or just provide some clear defined direction on how to do this, I would highly appreciate it.
Thanks
rdcube
I've seen a couple of apps made with GS (Jumpo, and doodle crash to name a couple) that makes the character move by tilting the device left and right.
I followed some video that TSB made a couple of months ago on implementing accelerometer in your games.
There is also a couple of templates/demos that show this feature, as well as the wiki.
They all work and I managed to make them work on my device as well. X/Y (or left/right, up/down) tilt work perfect.
My main question/problem is, we always set X/Y to +/- 0.1 or something to that effect, which works perfectly if you have the device laying flat on it's back and you tilt around, so the 'ball' moves perfectly along the device/screen (granted you have set your friction, density, etc, accordingly).
What I want to do instead, is have the device straight up (completely standing up portrait position), have a character (let's call it 'ball') which will be positioned not completely down (about 1/4 of the bottom of the screen/device...I assume this is like a -1 for the Y)
What I would like to do, is that once the device is straight up ( | ), I need to tilt the device just about 10~20 degress ( / ) away from user ( something like this: | to this / ); once the device is tilt, have the 'ball' move 'up' and if you tilt back (or towards you) again, it slowly moves 'down' instead of just dropping (I played with gravity, but this affects the rest of my characters as wel).
Hope all this rumbling makes sense...I'm trying and trying with no luck.
If anybody could please wipe up a quick 'template/demo', or just provide some clear defined direction on how to do this, I would highly appreciate it.
Thanks
rdcube
Comments
I also started wondering how this will affect the orientation, meaning, Apple now wants the games to rotate up/down or left/right while maintaining all same =S
anyone? please!!!
http://i43.tinypic.com/ofoq5g.png
the actor starts at the bottom of the screen
AWESOME.
I think the deal is that I was using 'accelerate' and ur using 'move to'...although, not as smooth move as I want, it seems to be getting the work done.
Do you mind letting me know the coordinate for X (left - right)?
Would I need a Y at all?
Any recommendation on friction, density and restition?
Thanks again.
this helped me a while back http://www.geekpedia.com/PageView3010_iPhone-Tutorial---Reading-the-Accelerometer.html
and having a new look in the apple iphone os reference library (wow it's good) search for AccelerometerGraph or similar!!