Hallo,
wie kann ich diesen Code in eine Schleife packen, die solange ausgeführt wird, bis das CollisionObejct auf ein anderes Object trifft und somit kollidiert ?
Alles anzeigen
wie kann ich diesen Code in eine Schleife packen, die solange ausgeführt wird, bis das CollisionObejct auf ein anderes Object trifft und somit kollidiert ?
Quellcode
- - (IBAction)START:(id)sender {
- do {
- CGRect frame = _CollisionObject.frame;
- frame.origin.x = 234;
- frame.origin.y = 194;
- [UIView beginAnimations:nil context:nil];
- [UIView setAnimationDuration:3.0];
- _CollisionObject.frame = frame;
- [UIView commitAnimations];
- if (_CollisionObject.center.x >233) {
- CGRect frame = _CollisionObject.frame;
- frame.origin.x = 36;
- frame.origin.y = 194;
- [UIView beginAnimations:nil context:nil];
- [UIView setAnimationDuration:3.0];
- _CollisionObject.frame = frame;
- [UIView commitAnimations];
- }