Send to a Friend

joeysefika's avatar

Deleting Sprites from frame (Xcode for iPhone)

Asked by joeysefika (3098points) March 18th, 2010

So, my first iPhone app is going pretty well, It is a pretty basic game, a space ship at the bottom of the screen that scrolls left or right, and random space junk that falls from the sky. The aim is to dodge it. All i need now is to be able to delete sprites as they either intersect with the player at the bottom of the screen, or as the intersect with an invisible bar at the bottom of the screen.
The bar at the bottom of the screen is how I determine score; has it hit the player or not.

My sprite is called ‘SpaceJunk’
Would it be something like;
if(CGRectIntersectsRect(SpaceJunk.frame,player.frame)) {
SpaceJunk = delete
}

I Know it wont be as simple as that but can you offer advice.
Thanks in advance

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.