I am making a game pretty much like canabalt but no where near as cool becuase I'm much newer. So I am using UIKit and am getting stuck. Literally. Here's my code
Code:
- (void)gameLogic:(NSTimer *)gameTimer {
blockyVelocity.y += gravity.y;
if (!(CGRectIntersectsRect(groundAnimation.frame, blocky.frame))){
if(!(blocky.center.y + 25 == groundAnimation.center.y)){
blocky.center = CGPointMake(blocky.center.x, blocky.center.y + blockyVelocity.y);
}
}
}
- (void)jump{
blockyVelocity.y += -kBlockJump;
}
- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
[self jump];
}
I can "jump" anytime before
blocky hits the ground but once it does it get's stuck. Any help is appreciated!