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 03-27-2009, 03:23 PM   #16 (permalink)
LeopardDevX
iPhone Developer
 
Join Date: Mar 2009
Posts: 222
Arrow Warnings!

Quote:
Originally Posted by smasher View Post
Same as the ball code above, except you don't need the loop if you're only creating one enemy. There's no way to "copy" the existing enemy, that I know of.

Code:
//spawn a new enemy, and add to the array:

UIImage *enemyImage = [UIImage imageNamed:@"enemy.png"];
UIImageView *newEnemy = [[UIImageView alloc] initWithImage: enemyImage];

//set X and Y of the new imageView
newEnemy.center = CGPointMake(150, 150);
		
//add to array
[enemies addObject:newEnemy];
		
//add to the view, so it gets displayed.
[self.view addSubview: newEnemy];





Code:
//spawn a new enemy, and add to the array:

UIImage *enemyImage = [UIImage imageNamed:@"enemy.png"];
UIImageView *newEnemy = [[UIImageView alloc] initWithImage: enemyImage];
Here Warning: warning: local decleration of "newEnemy"    hides instance variable.



//set X and Y of the new imageView
newEnemy.center = CGPointMake(150, 150);
		
//add to array
[enemies addObject:newEnemy];
		Here Warning: warning: local decleration of "newEnemy"    hides instance variable.
//add to the view, so it gets displayed.
[self addSubview: newEnemy];
Here Warning: warning: local decleration of "newEnemy"    hides instance variable.


What to do?
__________________
Thank You.
LeopardDevX is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,870
Threads: 89,225
Posts: 380,694
Top Poster: BrianSlick (7,129)
Welcome to our newest member, triclopus
Powered by vBadvanced CMPS v3.1.0

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