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

Thread: Random Rocks
View Single Post
Old 01-06-2010, 03:02 PM   #22 (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
Default

Quote:
Originally Posted by kdp8791 View Post
Thats what I am trying to do as well. I only want one image falling from the top at a time and when that image rolls off the screen another falls. But for some reason, when the view loads the images just appear on the screen as if they were placed there from Interface Builder in one solid location. No movement nothing. I have setup the NSTimer as well, so I am not sure what is wrong and why it's not moving.
If you only want one meteor, you should not create the array of meteors; you should just create one meteor "myRock". I also changed it to "y = 0" - if you're only making one rock it makes sense to put it at the top of the screen, not far off the top like the other code.

Code:
-(void)createMeteors{
	
	UIImage *meteorImage = [UIImage imageNamed:@"flake.png"];
	
	myRock= [[UIImageView alloc] initWithImage: meteorImage];
	
	//pick a position *above* the top of the screen
	int x = arc4random()%320; 
	int y = 0; // place at top of the screen
	myRock.center = CGPointMake (x,y);
	
	[self.view addSubview: myRock]; //adds meteors as subviews
	[myRockrelease];	
}
__________________

Free Games!
smasher is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,427
Threads: 94,023
Posts: 402,573
Top Poster: BrianSlick (7,978)
Welcome to our newest member, shakiraeb60
Powered by vBadvanced CMPS v3.1.0

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