Hi !
I'm trying to use the accelerometer to move a UIImage. I works well but my problem is that with my code
self.character.center = CGPointMake(160+acceleration.x*175, 230-acceleration.y*175);
my picture moves even on a stable surface because of the precision of the acceleration.x value. So I decided to use a workaround by multiplying it with a value, casting it to an INT and then dividing it and cast it to a float (i.e i just remove some numbers after the coma)
self.character.center = CGPointMake(160+(float)((int)((acceleration.x*100000))/100000)*175, 230-(float)((int)((acceleration.y*100000))/100000)*175);
But after i use this code, my little picture isn't moving anymore.
So my question is : do you know why it doesn't work anymore ? Is there a proper way to remove numbers after the coma in a float ?
Thanks a lot Fred.