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 07-28-2010, 03:47 PM   #19 (permalink)
Ubermatik
Registered Member
 
Join Date: Jul 2010
Posts: 19
Default

Code:
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	self.gameState = kGameStatePaused;
	pucVelocity = CGPointMake(kPucSpeedX,KPucSpeedY);
	[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(gameLoop) userInfo:nil repeats:YES];
}

-(void) gameLoop {
	if(gameState == kGameStateRunning) {
		
		puc.center = CGPointMake(puc.center.x + pucVelocity.x , puc.center.y + pucVelocity.y);
		
		if(puc.center.x > self.view.bounds.size.width || puc.center.x < 0) {
			pucVelocity.x = -pucVelocity.x;
		}
		
		if(puc.center.y > self.view.bounds.size.height || puc.center.y < 0) {
			pucVelocity.y = -pucVelocity.y;
		}
	} else {
		if (tapToBegin.hidden) {
			tapToBegin.hidden = NO;
		}
	}
	
		if (CGRectIntersectsRect(puc.frame,paddleblue.frame)) {
		if(puc.center.y < paddleblue.center.y) {
			pucVelocity.y = -pucVelocity.y;
			NSLog(@"%f %f",puc.center,paddlegreen.center);
			}
		}
	
		if (CGRectIntersectsRect(puc.frame,paddlegreen.frame)) {
			if(puc.center.y > paddlegreen.center.y) {
			pucVelocity.y = -pucVelocity.y;
			}
		}
		
		//Begin AI
		if (puc.center.y <= self.view.center.y) {
			if(puc.center.x < paddlegreen.center.x) {
				CGPoint compLocation = CGPointMake(paddlegreen.center.x - kCompMoveSpeed, paddlegreen.center.y);
				paddlegreen.center = compLocation;
			}
	
			if(puc.center.x > paddlegreen.center.x) {
				CGPoint compLocation = CGPointMake(paddlegreen.center.x + kCompMoveSpeed, paddlegreen.center.y);
				paddlegreen.center = compLocation;
			} //End AI
		}
	} //End of GameLoop
Again, the line the error comes up in is highlighted in red.
Ubermatik is offline   Reply With Quote
 

» Advertisements
» Online Users: 312
21 members and 291 guests
ADY, apatsufas, dacapo, Fit4him, HemiMG, ilmman, iosdevjtp, leahov, MarkC, marto1914, masc2279, morands, PsychoChris, sly24, sneaky, Sunny46, tgjorgoski, thh022, Thrillhouse1919, timle8n1, vogueestylee
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,877
Threads: 89,222
Posts: 380,718
Top Poster: BrianSlick (7,129)
Welcome to our newest member, peterkessler45
Powered by vBadvanced CMPS v3.1.0

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