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 01-29-2010, 03:14 PM   #6 (permalink)
iPhoneDevelopment
Banned
 
Join Date: Dec 2009
Posts: 61
Default

This having worked before, I am mystified as to why it is not now :S.

Code:
- (void)viewDidLoad {
    [super viewDidLoad];
	self.gameState = kGameStatePaused;
	[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(moveBlocks) userInfo:nil repeats:YES];
}

-(void)createBlocks{
	
    if (blockArray==nil){
		blockArray = [[NSMutableArray alloc] init]; }
	
    UIImage *blockImage = [UIImage imageNamed:@"block.png"];
	UIImageView *block;
	
	for (int i = 0; i< 1; i++){
		block = [[UIImageView alloc] initWithImage: blockImage];
	
        int x = arc4random()%320; 
        int y = 500;
        block.center = CGPointMake (x,y);
		
        [self.view addSubview: block];
        [blockArray addObject: block];
        [block release];
    }
}
	
-(void)moveBlocks {
	
	if(gameState == kGameStateRunning) {
		
		for (UIImageView *block in blockArray) {
			
			//move new center down
			CGPoint newCenter = block.center;
			newCenter.y = newCenter.y +10;
			block.center = newCenter;
		}
	}
Thanks

Cam

(P.S. For all your help smasher, I' looking at purchasing your app !)
iPhoneDevelopment is offline   Reply With Quote
 

» Advertisements
» Online Users: 353
16 members and 337 guests
ADY, apatsufas, BdR, fiftysixty, F_Bryant, iDifferent, john love, jorge599, kampftrinker, ligerligerliger, mer10, mizzytheboy, nobre84, syver, themathminister
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,876
Threads: 89,225
Posts: 380,701
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jorge599
Powered by vBadvanced CMPS v3.1.0

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