ok, I have the game package, but I can't upload it until I get home, the wireless network I usually hook my mac upto is down.
It's ripped right from my Z is for Zombie game, and shows you how I calibrate the phone, display the current calibration and how the player uses that information.
there is a limitation, it only works up to about a 60 degree angle from the top, after that the controls get screwy. I'm sure there is a way to fix it with a few extra rules, but I havn't actually attempted to yet.
Click on survival to see the game work without calibration. then click pause to exit back to the main screen to go into settings and calibration.
then go back to survival to see the updated settings.
you can poke around the settings, I also included how i turn off and on accelerometer control, as well as sound / music (but there are better ways of doing this, it was my first attempt)
Comments
I'm at work so I don't have my project in front of me, but I'm doing this in both my Z and V games.
It's not too difficult, just requires a few attributes. I created two attributes called calibratedX and calibratedY.
I then have a button called calibrate that has a rule on it, when touched it sets game.calibratedX to game.accelerometerX. Same thing for calibratedY.
then just update your move rules to use those values instead of the stock -0.1 or 0.1
I'll try and move my code into a sample project tonight.
wiki page:
http://gamesalad.com/wiki/how_tos:gsc_iphone_controls#how_do_i_make_use_of_the_iphone_ipod_touch_acceleromete
Were you able to post a sample game? If so what is the name?
Thanks
It's ripped right from my Z is for Zombie game, and shows you how I calibrate the phone, display the current calibration and how the player uses that information.
there is a limitation, it only works up to about a 60 degree angle from the top, after that the controls get screwy. I'm sure there is a way to fix it with a few extra rules, but I havn't actually attempted to yet.
http://gamesalad.com/game/play/30319
only the survival and settings buttons work.
Click on survival to see the game work without calibration. then click pause to exit back to the main screen to go into settings and calibration.
then go back to survival to see the updated settings.
you can poke around the settings, I also included how i turn off and on accelerometer control, as well as sound / music (but there are better ways of doing this, it was my first attempt)
let me know if you have any questions!