捕鱼达人项目开发过程文档一、游戏资源文件image图片:包括火炮,鱼,子弹,渔网,金币,数字,背景图片以及其它UI图片CCFish类:实现鱼的曲线路线的移动与各种鱼捕捉概率的设置UINumber类与UIRollNumber类二、游戏基本结构确定及搭建图1.1依次在项目中创建如有图类完成项目结构,在总体上把握项目实现内容三、详细设计与各功能模块的实现程序编写流程1.系统菜单场景:1)添加初始化方法2)添加菜单3)添加菜单选项方法2.游戏场景1)添加初始化方法2)添加纹理图集载入方法3)添加UI设计方法4)添加触摸事件处理方法5)添加自动补充鱼更新方法6)添加碰撞检测方法3.设置页面4.帮助场景游戏重要模块详细实现1.纹理图集的使用与加载要点:精灵处于界面中的层次关系,如下为纹理图集加载代码[[CCSpriteFrameCachesharedSpriteFrameCache]addSpriteFramesWithFile:@"fish.plist"];fishSheet=[CCSpriteBatchNodebatchNodeWithFile:@"fish.png"];[selfaddChild:fishSheetz:100];2.UI设计的细节实现要点:各个UI部件(精灵)的层次,位置调整以及武器的更换动作设置,下面为UI实现代码-(void)initUI{SysMenu(scene)GameMain(scene)Setting(layer)Help(scene)CGSizewinSize=[[CCDirectorsharedDirector]winSize];CCSprite*background=[CCSpritespriteWithFile:@"bj00.jpg"];background.position=ccp(winSize.width*0.5,winSize.height*0.5);[selfaddChild:backgroundz:0];//添加能量槽CCSprite*engryBox=[CCSpritespriteWithFile:@"ui_2p_004.png"];engryBox.anchorPoint=ccp(0.5,0.5);engryBox.position=ccp(winSize.width/2,10);[selfaddChild:engryBoxz:10];//添加能量箭头energyPointer=[CCSpritespriteWithFile:@"ui_2p_005.png"];energyPointer.anchorPoint=ccp(0.5,0.5);energyPointer.position=ccp(winSize.width/2,10);energyPointer.rotation=minEnergyRotation;[selfaddChild:energyPointerz:12];//添加顶部框体CCSprite*bgExp=[CCSpritespriteWithFile:@"ui_box_01.png"];bgExp.position=ccp(winSize.width/2,winSize.height);bgExp.anchorPoint=ccp(0.5f,1.0f);[selfaddChild:bgExpz:101];//添加底框CCSprite*bgNum=[CCSpritespriteWithFile:@"ui_box_02.png"];bgNum.position=ccp(bgNum.contentSize.width/2,0);bgNum.anchorPoint=ccp(0.5f,0);[selfaddChild:bgNumz:101];//添加武器cannnon=[CCCannonspriteWithSpriteFrameName:[NSStringstringWithFormat:@"actor_cannon1_%i1.png",1]];cannnon.cannonLevel=1;cannonLevel=1;cannnon.anchorPoint=ccp(0.5f,0.5f);cannnon.position=ccp(winSize.width/2,30);cannnon.scale=cannon_scale;cannnon.cannonType=nomal;[cannonSheetaddChild:cannnon];//添加“+”,“-”按钮(待改)[CCMenuItemFontsetFontSize:32];[CCMenuItemFontsetFontName:@"Arial"];CCMenuItem*addItem=[CCMenuItemFontitemFromString:@"+"target:selfelector:@selector(addCannonLeave)];//addItem.scale=1.5;CCMenu*addMenu=[CCMenumenuWithItems:addItem,nil];addMenu.position=ccp(winSize.width*0.5+30,10);[addMenualignItemsVertically];[selfaddChild:addMenuz:102];CCMenuItem*reduceItem=[CCMenuItemFontitemFromString:@"-"target:selfselector:@selector(reduceCannonLeave)];CCMenu*reduceMenu=[CCMenumenuWithItems:reduceItem,nil];reduceMenu.position=ccp(winSize.width*0.5-30,10);[reduceMenualignItemsVertically];[selfaddChild:reduceMenuz:102];//初始化金币数gold=[[UIRollNumberalloc]init];[goldsetNumber:originGold];[goldsetPosition:ccp(168,10)];[selfaddChild:goldz:102];}-(void)addCannonLeave{CGSizewinSize=[[CCDirectorsharedDirector]winSize];cannonLevel++;If(cannonLevel==8)cannonLevel=1;//removecannonCCScaleTo*narrow=[CCScaleToactionWithDuration:0.1fscale:0.1];CCCallFuncO*removeCannon=[CCCallFuncOactionWithTarget:selfselector:@selector(removeCannon:)object:cannnon];CCSequence*bowDismissSeq...