Hello.
I have a short program in iPhone that has both static and dynamic views.
The dynamic views are simply colored boxes that fall with gravity.
I would like to be able to move the static view around manually. I believe the documentation
says this is possible.
I've tried adding this code just to see if I can make it move...
staticView.center = CGPointMake( staticView.center.x + 5.0, staticView.center.y);
and I've also tried to move it with touches...
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
staticView.center = location;
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[self touchesBegan:touches withEvent:event];
}
Nothing happens except when a touch is attempted, there is a flickering.
Ideally I would like to have a view that can be manually moved and responds to
collision detection but not gravity.
I've also tried using a kinematic body instead of a static body with no luck
I have a short program in iPhone that has both static and dynamic views.
The dynamic views are simply colored boxes that fall with gravity.
I would like to be able to move the static view around manually. I believe the documentation
says this is possible.
I've tried adding this code just to see if I can make it move...
staticView.center = CGPointMake( staticView.center.x + 5.0, staticView.center.y);
and I've also tried to move it with touches...
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
staticView.center = location;
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[self touchesBegan:touches withEvent:event];
}
Nothing happens except when a touch is attempted, there is a flickering.
Ideally I would like to have a view that can be manually moved and responds to
collision detection but not gravity.
I've also tried using a kinematic body instead of a static body with no luck