Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 09-30-2008, 10:36 PM   #1 (permalink)
Kenrik
Registered Member
 
Join Date: Sep 2008
Posts: 288
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
 

» Advertisements
» Stats
Members: 158,689
Threads: 89,161
Posts: 380,408
Top Poster: BrianSlick (7,110)
Welcome to our newest member, mikeslater113
Powered by vBadvanced CMPS v3.1.0

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