私は、これはあなたが探している答えがあるかどうかわからないんだけど、
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:x];
[UIView setAnimationDelegate:self];
[UIView setAnimationRepeatCount:y];
imageX.transform = CGAffineTransformMakeTranslation(5,0);
[UIView commitAnimations];
これは、あなたができる、一定の時間のためにあなたの画像移動を行います:あなたは何ができるかを移動する背景には、本当に広い画像を作成し、次のようなものを使用してプログラムで、そのイメージを移動しているためあなたが望むならそれを繰り返すように設定してください。
Anotときに何かをするためにプレーヤーを伝えるために
imageX.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"img1.png"], //You would go all the way up to 20
[UIImage imageNamed:@"img2.png"],
[UIImage imageNamed:@"img3.png"],
[UIImage imageNamed:@"img4.png"], nil];
[imageX setAnimationDuration:x];
[imageX setAnimationRepeatCount:20];
[imageX startAnimating];
:彼女のアプローチは、例えば、あなたが背景アニメーションのための20枚の画像を作成し、次のようなものを使用し、作成したいアニメーションのフレームを作ることです彼は次のようなものを使うことができる別のオブジェクトに触れます:
if (CGRectIntersectsRect(player.frame, enemy.frame)) {
//Collision Detected
//Code Goes Here
}