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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 02-07-2010, 01:46 AM   #34 (permalink)
smasher
Registered Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
smasher will become famous soon enough
Thumbs up

I don't mind a bit, that would be great. "Sean Maher" or "Smasher" is fine. Let me know when the game comes out.

The code you posted will probably work, but the blocks never get removed from the array. Eventually the game may still slow down as the stoppedBlocks array gets bigger. I'd do this:

Code:
for (int i=0; i<[stoppedBlocks count]; i++) {
	UIImageView *block = [stoppedBlocks objectAtIndex:i];
	block.transform = CGAffineTransformTranslate(block.transform, 0.0, 1.4);
	if (block.center.y > 600) {
		[block removeFromSuperview];
		[stoppedBlocks removeObject:block];
		i--;
	}
}
I changed the style of loop so that we could remove items from the array - the other style doesn't allow you to change the array while looping. Every time we remove an item we also subtract 1 from i so we don't skip any items.
__________________

Free Games!

Last edited by smasher; 02-07-2010 at 01:51 AM.
smasher is offline   Reply With Quote
 

» Advertisements
» Online Users: 500
7 members and 493 guests
Domele, GHuebner, manop_cs, Newbie123, nguyenhieu129, RockBaby, Thompson22
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,446
Threads: 94,031
Posts: 402,605
Top Poster: BrianSlick (7,978)
Welcome to our newest member, larueta13
Powered by vBadvanced CMPS v3.1.0

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