Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 09-30-2008, 09:36 PM   #1 (permalink)
Kenrik
New Member
 
Join Date: Sep 2008
Posts: 279
Default Error.. Kills app.

Ok so I have a time animated bad guy & a missile that shoots at him.

I use this for collision detection..

Code:
if (CGRectContainsRect([myBub1 frame], [missile frame]))
	{
	[myBub1 removeFromSuperview];
	[bubMoveTimer1 invalidate];
	[missileTimer invalidate];
	missile.center = bubView.center;
	missileButtonPressed = NO;
	missile.hidden = YES;
	}
it removes my bad guy, invalidates the movement timers and moves the missile back to my good guy to be fired again.

well that all works perfect but my problem is that when I fire again at the same spot that I killed the last bad guy the missile hits something at the same spot that the bad guy was at and it crashes my app..

It's like my badguy leaves behind his frame when I remove him from the superview & when it goes to remove him again it kills the app (because he's already been removed)

Any ideas??
Kenrik is offline   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 23,920
Threads: 38,707
Posts: 169,887
Top Poster: smasher (2,554)
Welcome to our newest member, neelkamalgarg
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:34 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.