开发者

UIImageViews in NSMutable Arrays

I am in the process of making the game Avalanche for the iPod family. I have my random objects appearing at the top and dropping down with a set of lines that go like this :

[UIView setAnimationsDidStopSelector:@Selector(onAnimationComplete:finished:context:)];  
[UIView setAnimationDelegate:self];  
[UIView commitAnimations];

I have also created a UIImageView like so:

UIImageview* debrisView= [[UIImageView alloc] initWithImage: debris];

I want to put the debrisView in a array and iterate through to see the frame (or coordinates). I want to be able to compare the coordinates to where the player is to see if they touch and what not (therefore the game is over). How would I add multiple (more than 500) "debrisView" to an array, compare the frame within the array to a moveable UIImageView.. say named player to see if the coordinates of the falling debris are a match or touching with the player? And as far as memory goes, how do I get rid of "debrisView" in my array when the object touches the bottom screen? Could somebody please point me in the right direction or even explain this all to me? I am really new to Objective - C. Much appreciate开发者_开发百科d. Thanks in advance!

-Dustin


As far as memory goes, you probably shouldn't be using UIKit for this. Cocos2d is better for games, and you can use Box2d or chipmunk for physics.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜