You are viewing our Forum Archives. To view or take place in current topics click here.
IOS Xcode, help with using accelerometer instead if UItouch
Posted:

IOS Xcode, help with using accelerometer instead if UItouchPosted:

TTGTRAMMELL
  • Christmas!
Status: Offline
Joined: Nov 17, 201112Year Member
Posts: 39
Reputation Power: 1
Status: Offline
Joined: Nov 17, 201112Year Member
Posts: 39
Reputation Power: 1
I am creating a game that allows an image to move left and right by touch the screen left or right, but I need help trying to figure out how I could do it by using the accelerometer instead of touching the screen.
My touch code for the touch movement:

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{

BallLeft = NO;
BallRight = NO;
StopSideMovement = YES;

}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
CGPoint point = [touch locationInView:self.view];

if (point.x < 160) {
BallLeft = YES;
}
else{
BallRight = YES;
}


}
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.