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 03-27-2009, 04:00 PM   #18 (permalink)
smasher
Senior Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,575
Default

Quote:
Originally Posted by LeopardDevX View Post
But.....

I cant get the newEnemy to move after its spawned.....

So how??

Thank you so much it all makes perfect sense to me now...
You probably have a moveEnemy method that is called every frame? That method now needs to look through the array of enemies, and move them all. That's what the array is for. This will loop through every enemy in the array, and move each one down and to the right:

Quote:
for (UIView *anEnemy in enemies){
int newX = anEnemy.center.x +5;
int newY = anEnemy.center.y +5;
anEnemy.center = CGPointMake(newX, newY);
}
__________________

Last edited by smasher; 03-27-2009 at 08:34 PM.
smasher is offline   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,272
Threads: 39,066
Posts: 171,312
Top Poster: smasher (2,575)
Welcome to our newest member, monady754
Powered by vBadvanced CMPS v3.1.0

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