developing game using window or view based application in iphone
HI to all, I am new in game developing part .Can any one help me out how to develop the game .Because Til开发者_运维技巧l toady i am on the normal iphone application developing .Can i develop the game by choosing window or view based application .If yes then give me some kind of sample code or link for that. Thanks in advance
Its better to use a game engine like cocos2d. But u can make games by choosing view based application also. Refer "Apress Beginning iPhone Games Development" it helps u a lot.
you're probably best off using a games engine (google cocos2d) or similar to be honest. They come with their own starting templates that you can use, rather than using a view or window based application.
You should make the object with help of sprite class.You can make Sprite and AtlasSprite classes with help of Apress book. and read all about these classes before use.
Sprite *obj; (in .h file)
//in .m file
obj = [AtlasSprite fromFile:@"img.png" withRows:1 withColumns:1];
//now set the properties of the obj.
//for moving set
obj.x = 20; obj.y = 25; //by default x,y is 0,0
obj.speed = 120; //120 is just for example
obj.angle = 0; //for left to right movement
obj.angle = 180; //for right to left movement
timer = [NSTimer scheduledWithTimeInterval:1/10 target:self selector:@selector(func) userInfo:nil repeats:YES];
-(void)func {
[obj tic:1/20]; //for moving obj. 1/20 is just for example
}
精彩评论