Reputation: 2639
making a game like 'doodle jump' requires opengl or core animation is just enough? which is the poit from where one should consider using opengl?
Upvotes: 1
Views: 330
Reputation: 3664
If you don't have any existing experience with opengl and iphone development, I would recommend working out your basic game using quartz first since it will provide you with the easiest learning curve. For your needs, it might even perform well enough for the final game.
Here is a simple custom view that renders a single sprite with a 30fps animation loop.
@interface GameView : UIView{
NSTimer* animTimer;
UIImage* sprite;
}
- (void)animate:(NSTimer*)theTimer;
@end
@implementation GameView
- (id)initWithFrame:(CGRect)frame {
if((self=[super initWithFrame:frame])){
sprite=[[UIImage imageNamed:@"sprite.png"] retain];
animTimer=[[NSTimer scheduledTimerWithTimeInterval:1.0/30.0
target:self selector:@selector(animate:)
userInfo:nil repeats:YES] retain];
}
return self;
}
- (void)animate:(NSTimer*)theTimer{
[self setNeedsDisplay];
}
- (void)drawRect:(CGRect)rect {
[sprite drawAtPoint:CGPointMake(0,0)];
}
@end
Upvotes: 0
Reputation: 5629
This is my personal opinion, I think making game with CA is complicated. I recommend OpenGL.
In OpenGL based project, you should manually draw and move elements frame by frame to make animation. It requires bit longer code than CA, but you can easily sync screen and game status. It is hard to sync graphics and game strictly in using CA.
Course, performance of OpenGL is much better than CA. And, learning OpenGL is not much harder!
Upvotes: 1
Reputation: 1485
I've been toying with a small isometric 3D game for a few weeks now. I've first used CA, but switched to OpenGL. The reasoning for me was thus:
For me, that makes OpenGL a worthwhile investment.
YMMV
Upvotes: 1