ios植物大战僵尸设计含代码.docx

  1. 1、本文档共8页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
ios植物大战僵尸设计含代码

项目总结1.项目概述我们的项目是初级版的植物大战僵尸,植物大战僵尸是一款极富策略性的小游戏,游戏的规则是:玩家控制植物,抵御僵尸的进攻,保护这片草坪防止僵尸进入房间。 在这个项目开发过程中,通过小组讨论,我们确定了该项目的基本功能,包括产生僵尸、消灭僵尸、游戏失败时的提示、计数以及音效等方面的内容,其中和僵尸有关的是加载僵尸、僵尸的移动和消除。开发过程中,我们使用了试图控制器以及视图来实现界面,学会了关联控件、为可变数组添加新元素,了解并能使用UILabel、UIImageView、UIViewController等基本UI控件实例化出僵尸,能实现僵尸的移动。2.系统主要功能截图(1)游戏视图(2)信息提示3.系统主要代码-(void)zoomMove{ for (ZoomImageView *zoomImage in zoomArray) { [zoomImage move]; //[self zoomMiss:zoomImage]; NSLog(@zoomImage move:%f,zoomImage.center.x); if (zoomImage.center.x -20) { int zoomx=x[arc4random()%6]; int zoomy=y[arc4random()%6]; zoomImage.center=CGPointMake(zoomx,zoomy); homecount++; [self.homelabel setText:[NSString stringWithFormat:@%d,homecount]]; if(homecount==10) { isLose = YES; [zoomTimer invalidate]; UIImageView *imageview=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)]; [imageview setImage:[UIImage imageNamed:@ZombiesWon.png]]; imageview.tag = 100; [self.view addSubview:imageview]; NSString *file=[[NSBundle mainBundle] pathForResource:@lose ofType:@.mp3]; NSURL *url=[NSURL fileURLWithPath:file]; AVAudioPlayer *player=[[AVAudioPlayer alloc]initWithContentsOfURL:url error:nil]; [player play]; UIAlertView *zoomAlertView=[[UIAlertView alloc]initWithTitle:@Game Overmessage:@失败! delegate:self cancelButtonTitle:@确定 otherButtonTitles:nil, nil]; [zoomAlertView show]; [self addButton]; } } }}-(void)image{ zoomArray=[[NSMutableArray alloc]init]; for(int i=0;i8;i++) { ZoomImageView *imageView=[[ZoomImageView alloc]initWithFrame:CGRectMake(0,0,40,40)]; NSString *stringimage=[NSString stringWithFormat:@zombie%d.tiff,i%6]; UIImage *image=[UIImage imageNamed:stringimage]; [imageView setImage:image]; [zoomArray addObject:imageView]; x[i]=310+60*(i); y[i]=60+50*(i); [imageView setUserInteractionEnabled:YES]; } [self setImageCenter]; zoomTimer=[NSTimer scheduledTimerWithTimeInterval:0.03 target:self selector:@selector(zoomMove) userInfo:nil repeats:YES]; }-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *to

文档评论(0)

153****9595 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档