272 int x = ((j*32)/(int)hatSprite.size.height)*32; |
272 int x = ((j*32)/(int)hatSprite.size.height)*32; |
273 int y = (j*32)%(int)hatSprite.size.height; |
273 int y = (j*32)%(int)hatSprite.size.height; |
274 UIImage *hatSpriteFrame = [hatSprite cutAt:CGRectMake(x, y, 32, 32)]; |
274 UIImage *hatSpriteFrame = [hatSprite cutAt:CGRectMake(x, y, 32, 32)]; |
275 UIImage *hogSpriteFrame = [hogSprite cutAt:CGRectMake(x, y, 32, 32)]; |
275 UIImage *hogSpriteFrame = [hogSprite cutAt:CGRectMake(x, y, 32, 32)]; |
276 UIImage *hogWithHat = [hogSpriteFrame mergeWith:hatSpriteFrame atPoint:CGPointMake(0, 5)]; |
276 UIImage *hogWithHat = [hogSpriteFrame mergeWith:hatSpriteFrame atPoint:CGPointMake(0, 5)]; |
277 [animation addObject:hogWithHat]; |
277 if (hogWithHat) { |
|
278 [animation addObject:hogWithHat]; |
|
279 } |
278 } |
280 } |
279 [hatSprite release]; |
281 [hatSprite release]; |
280 [hatFile release]; |
282 [hatFile release]; |
281 |
283 |
282 UIImageView *hog = [[UIImageView alloc] initWithImage:[animation objectAtIndex:0]]; |
284 UIImageView *hog = [[UIImageView alloc] initWithImage:[animation firstObject]]; |
283 hog.animationImages = animation; |
285 hog.animationImages = animation; |
284 hog.animationDuration = 3; |
286 hog.animationDuration = 3; |
285 [animation release]; |
287 [animation release]; |
286 |
288 |
287 int x = 20*i+arc4random_uniform(128); |
289 int x = 20*i+arc4random_uniform(128); |