Accelerometer

VmlwebVmlweb Member Posts: 427
edited November -1 in Working with GS (Mac)
Hey,

I'm making a sniper style game and I'm having some trouble with the accelerometer.
I need it to move in every direction according to which direction the accelerometer is in.

At the moment it only goes left right up down and cannot more in more than one direction at once. I have thought and thought about it but I don't know how to get it to fully work.

Here is the project could someone pls have a look at it.
http://download611.mediafire.com/omej2x927myg/ymmzz1ohzud/TargetTest.zip

Thanks a lot,
Vmlweb

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    when you use move in works as an either or kind of thing. When you use accelerate you can have a situation where an object has an acceleration angle of 0 and a second acceleration of 90 so the object will move at 45 (assuming both accel speeds are the same). You may want to play around with an acceleration behavior and a max speed so it can't keep accelerating to an uncontrollable speed. play with drag as well (I've never gotten a good feel for drag - I just play around until it works the way I think it should).
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    If you use something like this as the accel speed it will move faster the more you tip the iphone.

    max(100,min(500,500*abs( game.Accelerometer.X )))
  • PhoticsPhotics Member Posts: 4,172
    What? Is that right? If the Space Rocks demo was exported to the iPhone, or controls similar to Tshirtbooth's tutorial video, you couldn't turn and thrust at the same time?
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    you know, I was thinking about my last post and now am second guessing myself. When I tested it I was using the keyboard and what I posted is accurate for that. I'll test it on an iphone and repost. I know accelerate will work at different angles because I have it in one of my games, but maybe the keyboard does not allow two keys to be down at a time (though it worked fine using accelerate).
  • VmlwebVmlweb Member Posts: 427
    The accelerator did the trick
    I can't believe I didn't think about it in the first place

    THanks
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    glad you got it working!
Sign In or Register to comment.