accelerometer calibration???

scitunesscitunes Member, Sous Chef Posts: 4,047
edited November -1 in Working with GS (Mac)
Anyone figure this out yet? I'd love to have my game use the accelerometer at a 45 angle.

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    I posed this a few days ago:

    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
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Thanks! I love Z btw!
  • joebear218joebear218 Member Posts: 33
    Mulcahy,

    Were you able to post a sample game? If so what is the name?

    Thanks
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    not yet, i've been wrapped up in getting a big update for Z out the door, but I'll see if I can do it today during lunch.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Thanks! Looking Forward to it!
  • joebear218joebear218 Member Posts: 33
    Great thanks. I look forward to the update, free i hope :)
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    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.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Thanks, man! can't wait to get a peak!
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    ok here we go:
    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!
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Thanks so much! I can't wait to dig into this!
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Works great! Thanks a lot!
Sign In or Register to comment.