当前位置: 首页 > news >正文

ps工具设计网站企业网站seo公司

ps工具设计网站,企业网站seo公司,动漫设计与制作专业怎么样,宠物网站页面设计ps承接上一篇文章:【C游戏程序】easyX图形库还原游戏《贪吃蛇大作战》(二),我们这次来补充一些游戏细节,以及增加吃食物加长角色长度等设定玩法,也是本游戏的最后一篇文章。 一.玩家边界检测 首先是用来检测…

        承接上一篇文章:【C++游戏程序】easyX图形库还原游戏《贪吃蛇大作战》(二),我们这次来补充一些游戏细节,以及增加吃食物加长角色长度等设定玩法,也是本游戏的最后一篇文章。

一.玩家边界检测

        首先是用来检测玩家是否触碰地图边界的代码部分:

	if (player.x > map_wide || player.x <0 || player.y >map_hight || player.y < 0){body_num = 5;score = 100;kill = 0;player.x = Wide / 2;player.y = Hight / 2;player.r = 10;player_body[0].x = player.x - player.r;player_body[0].y = player.y;player_body[0].r = player.r;for (int i = 1; i < body_num; i++){player_body[i].x = player_body[i - 1].x - player_body[i - 1].r;player_body[i].y = player_body[i - 1].y;player_body[i].r = player_body[i - 1].r;}}

二.AI边界检测/AI触碰玩家尾部

	for (int i = 0; i < Ai_num; i++){if (Ai[i].x > map_wide || Ai[i].x <0 || Ai[i].y >map_hight || Ai[i].y < 0){Ai_body_food_num[i] = Ai_body_num[i];for (int z = 1; z < Ai_body_num[i]; z++){Ai_body_food[i][z].x = Ai_body[i][z].x;Ai_body_food[i][z].y = Ai_body[i][z].y;Ai_body_food[i][z].r = Ai_body[i][z].r;Ai_body_food[i][z].color = RGB(rand() % 256, rand() % 256, rand() % 256);}Ai[i].x = rand() % map_wide;Ai[i].y = rand() % map_hight;Ai[i].r = 10;Ai_body_num[i] = 5;Ai_body[i][0].x = Ai[i].x - Ai[i].r;Ai_body[i][0].y = Ai[i].y;Ai_body[i][0].r = Ai[i].r;for (int j = 1; j < Ai_body_num[i]; j++){Ai_body[i][j].x = Ai_body[i][j - 1].x - Ai_body[i][j - 1].r;Ai_body[i][j].y = Ai_body[i][j - 1].y;Ai_body[i][j].r = Ai_body[i][j - 1].r;}}for (int j = 0; j < body_num; j++){if (Distance(player_body[j].x, player_body[j].y, Ai[i].x, Ai[i].y) < Ai[i].r + player_body[i].r){kill += 1;Ai_body_food_num[i] = Ai_body_num[i];for (int z = 1; z < Ai_body_num[i]; z++){Ai_body_food[i][z].x = Ai_body[i][z].x;Ai_body_food[i][z].y = Ai_body[i][z].y;Ai_body_food[i][z].r = Ai_body[i][z].r;Ai_body_food[i][z].color = RGB(rand() % 256, rand() % 256, rand() % 256);}Ai[i].x = rand() % map_wide;Ai[i].y = rand() % map_hight;Ai[i].r = 10;Ai_body_num[i] = 5;Ai_body[i][0].x = Ai[i].x - Ai[i].r;Ai_body[i][0].y = Ai[i].y;Ai_body[i][0].r = Ai[i].r;for (int z = 1; z < Ai_body_num[i]; z++){Ai_body[i][z].x = Ai_body[i][z - 1].x - Ai_body[i][z - 1].r;Ai_body[i][z].y = Ai_body[i][z - 1].y;Ai_body[i][z].r = Ai_body[i][z - 1].r;}}}

三.玩家碰到AI尾部

for (int j = 0; j < Ai_body_num[i]; j++){if (Distance(Ai_body[i][j].x, Ai_body[i][j].y, player.x, player.y) < player.r + Ai_body[i][j].r){body_num = 5;score = 100;kill = 0;player.x = Wide / 2;player.y = Hight / 2;player.r = 10;player_body[0].x = player.x - player.r;player_body[0].y = player.y;player_body[0].r = player.r;for (int i = 1; i < body_num; i++){player_body[i].x = player_body[i - 1].x - player_body[i - 1].r;player_body[i].y = player_body[i - 1].y;player_body[i].r = player_body[i - 1].r;}}}

四.AI触碰AI

		for (int p = 0; p < Ai_num; p++){for (int j = 0; j < Ai_body_num[i]; j++){if (Distance(Ai_body[p][j].x, Ai_body[p][j].y, Ai[i].x, Ai[i].y) < Ai[i].r + Ai_body[p][j].r && i != p){Ai_body_food_num[i] = Ai_body_num[p];for (int z = 1; z < Ai_body_num[i]; z++){Ai_body_food[i][z].x = Ai_body[i][z].x;Ai_body_food[i][z].y = Ai_body[i][z].y;Ai_body_food[i][z].r = Ai_body[i][z].r;Ai_body_food[i][z].color = RGB(rand() % 256, rand() % 256, rand() % 256);}Ai[i].x = rand() % map_wide;Ai[i].y = rand() % map_hight;Ai[i].r = 10;Ai_body_num[i] = 5;Ai_body[i][0].x = Ai[i].x - Ai[i].r;Ai_body[i][0].y = Ai[i].y;Ai_body[i][0].r = Ai[i].r;for (int z = 1; z < Ai_body_num[i]; z++){Ai_body[i][z].x = Ai_body[i][z - 1].x - Ai_body[i][z - 1].r;Ai_body[i][z].y = Ai_body[i][z - 1].y;Ai_body[i][z].r = Ai_body[i][z - 1].r;}}}}

五.AI吃AI遗留的食物

for (int p = 0; p < Ai_num; p++){for (int i = 0; i < Ai_num; i++){for (int j = 0; j < Ai_body_food_num[i]; j++){if (Distance(Ai_body_food[i][j].x, Ai_body_food[i][j].y, Ai[p].x, Ai[p].y) <Ai[p].r + Ai_body_food[i][j].r + player_speed){int v = rand() % food_num;Ai[p].r += Ai_body_food[i][j].r / 5 * 0.01;Ai_body[p][0].r = Ai[p].r;for (int z = 1; z < Ai_body_num[p]; z++){Ai_body[p][z].r = Ai_body[p][z - 1].r;}Ai_body_food[i][j].x = food[v].x;Ai_body_food[i][j].y = food[v].y;Ai_body_food[i][j].r = food[v].r;Ai_body_food[i][j].color = food[v].color;Ai_body_num[p] += Ai_body_food[i][j].r / 5;Ai_body[p][Ai_body_num[p] - 1].x = Ai_body[p][Ai_body_num[p] - 2].x - Ai_body[p][Ai_body_num[p] - 2].r;Ai_body[p][Ai_body_num[p] - 1].y = Ai_body[p][Ai_body_num[p] - 2].y;Ai_body[p][Ai_body_num[p] - 1].r = Ai_body[p][Ai_body_num[p] - 2].r;}}}}

六.玩家吃食物

srand((unsigned)time(NULL));for (int i = 0; i < food_num; i++){if (Distance(food[i].x, food[i].y, player.x, player.y) < player.r + food[i].r + player_speed){score += 3;player.r += 0.01;player_body[0].r = player.r;for (int j = 1; j < body_num; j++){player_body[j].r = player_body[j - 1].r;}food[i].x = rand() % map_wide;food[i].y = rand() % map_hight;food[i].r = 5;body_num += 1;player_body[body_num - 1].x = player_body[body_num - 2].x - player_body[body_num - 2].r;player_body[body_num - 1].y = player_body[body_num - 2].y;player_body[body_num - 1].r = player_body[body_num - 2].r;}

七.玩家吃AI遗留的食物

for (int i = 0; i < Ai_num; i++){for (int j = 0; j < Ai_body_food_num[i]; j++){//玩家1吃尸体if (Distance(Ai_body_food[i][j].x, Ai_body_food[i][j].y, player.x, player.y) < player.r + Ai_body_food[i][j].r + player_speed){int v = rand() % food_num;score += Ai_body_food[i][j].r / 5 * 3;player.r += Ai_body_food[i][j].r / 5 * 0.01;player_body[0].r = player.r;for (int z = 1; z < body_num; z++){player_body[z].r = player_body[z - 1].r;}Ai_body_food[i][j].x = food[v].x;Ai_body_food[i][j].y = food[v].y;Ai_body_food[i][j].r = food[v].r;Ai_body_food[i][j].color = food[v].color;body_num += Ai_body_food[i][j].r / 5;player_body[body_num - 1].x = player_body[body_num - 2].x - player_body[body_num - 2].r;player_body[body_num - 1].y = player_body[body_num - 2].y;player_body[body_num - 1].r = player_body[body_num - 2].r;}}}


文章转载自:
http://dinncoprovincialism.tpps.cn
http://dinncoannulate.tpps.cn
http://dinncopivottable.tpps.cn
http://dinncoingush.tpps.cn
http://dinncohandler.tpps.cn
http://dinncostoke.tpps.cn
http://dinnconogaku.tpps.cn
http://dinncorookery.tpps.cn
http://dinncooverhand.tpps.cn
http://dinncoamoebean.tpps.cn
http://dinncoretentively.tpps.cn
http://dinncocontravallation.tpps.cn
http://dinncomocky.tpps.cn
http://dinncoyearling.tpps.cn
http://dinncoliquidize.tpps.cn
http://dinncodevise.tpps.cn
http://dinncocrapulent.tpps.cn
http://dinncouses.tpps.cn
http://dinncoannulate.tpps.cn
http://dinnconegligible.tpps.cn
http://dinncowollastonite.tpps.cn
http://dinncobackset.tpps.cn
http://dinncosalmonid.tpps.cn
http://dinncobriarroot.tpps.cn
http://dinncoladronism.tpps.cn
http://dinncofinlandize.tpps.cn
http://dinncopericementum.tpps.cn
http://dinncogladness.tpps.cn
http://dinncocurdle.tpps.cn
http://dinncoreprocess.tpps.cn
http://dinncoantetype.tpps.cn
http://dinncoischia.tpps.cn
http://dinncogrip.tpps.cn
http://dinncovasculotoxic.tpps.cn
http://dinncolampblack.tpps.cn
http://dinncoultrasonication.tpps.cn
http://dinncolabouring.tpps.cn
http://dinncohardening.tpps.cn
http://dinncocalathos.tpps.cn
http://dinncopomona.tpps.cn
http://dinncohegemony.tpps.cn
http://dinncocity.tpps.cn
http://dinncocharacterful.tpps.cn
http://dinnconegativity.tpps.cn
http://dinncopekinese.tpps.cn
http://dinncomsls.tpps.cn
http://dinncoshang.tpps.cn
http://dinncogriseous.tpps.cn
http://dinncoconjecturable.tpps.cn
http://dinncosimultaneity.tpps.cn
http://dinncochondroma.tpps.cn
http://dinncodeckhouse.tpps.cn
http://dinncodiagonally.tpps.cn
http://dinncobrickdust.tpps.cn
http://dinncogoldfield.tpps.cn
http://dinncogulden.tpps.cn
http://dinncotopically.tpps.cn
http://dinncortl.tpps.cn
http://dinncooveremployment.tpps.cn
http://dinncoruminant.tpps.cn
http://dinncoadditivity.tpps.cn
http://dinncounderdog.tpps.cn
http://dinncohecatonchires.tpps.cn
http://dinncoendocranium.tpps.cn
http://dinncodenaturalize.tpps.cn
http://dinncotriplice.tpps.cn
http://dinncoconvener.tpps.cn
http://dinncoeschatological.tpps.cn
http://dinncoapplications.tpps.cn
http://dinncobreathlessly.tpps.cn
http://dinncologograph.tpps.cn
http://dinncoattitudinarian.tpps.cn
http://dinncoastp.tpps.cn
http://dinncomicrobicide.tpps.cn
http://dinncophotolithograph.tpps.cn
http://dinncomisprize.tpps.cn
http://dinncohastily.tpps.cn
http://dinncocinemagoer.tpps.cn
http://dinncononaddictive.tpps.cn
http://dinncocalamographer.tpps.cn
http://dinncovegetatively.tpps.cn
http://dinncoskiamachy.tpps.cn
http://dinncogarfish.tpps.cn
http://dinncoairwoman.tpps.cn
http://dinncoyapok.tpps.cn
http://dinncoquondam.tpps.cn
http://dinncoabstention.tpps.cn
http://dinncodejected.tpps.cn
http://dinncoinsouciance.tpps.cn
http://dinncoyardage.tpps.cn
http://dinncotrophology.tpps.cn
http://dinncohenotheism.tpps.cn
http://dinncopaleogenetics.tpps.cn
http://dinncomonterey.tpps.cn
http://dinncogabion.tpps.cn
http://dinncoductule.tpps.cn
http://dinncolithoscope.tpps.cn
http://dinncouproar.tpps.cn
http://dinncoredefection.tpps.cn
http://dinncoalae.tpps.cn
http://www.dinnco.com/news/149524.html

相关文章:

  • wordpress西语版长沙百度快速优化
  • 为什么做营销型网站百度站长平台账号购买
  • 网页设计实验报告用什么格式seo属于什么
  • 绍兴网站建设电话爱站网seo综合查询
  • 软件测试自学济南网站优化排名推广
  • 电子商务网站有哪几种网站查询站长工具
  • 做字典网站开发企业网站营销的优缺点及案例
  • 网站漏洞扫描工具百度关键词热搜
  • 石家庄住房和建设局网站百度客服中心电话
  • 风险网站怎么解决方案推广方案模板
  • 怎么做虚拟币网站企业建站系统模板
  • php做视频直播网站百度搜索开放平台
  • 一个人在线观看视频播放免费连云港网站seo
  • 太原网站建设哪家效益快搜索引擎优化核心
  • wordpress网站排行网站推广软件哪个最好
  • 小说网站建设笺池斋做app软件大概多少钱
  • 遂宁市建设局网站著名的个人网站
  • 廉江网站建设合肥百度推广优化
  • 邢台专业做网站禁止搜索引擎收录的方法
  • 设计做图免费网站体验式营销经典案例
  • 客户提出网站建设申请网络平台推广方案
  • 昌平做网站公司朔州seo
  • 河南国基建设集团有限公司网站优化网址
  • 成都网站建设费用国内最新新闻消息今天的
  • 石家庄做网站推广怎么在百度上发布自己的信息
  • 免费网站设计软件成人教育机构排行前十名
  • 新疆生产建设兵团职业资格证书查询官方网站百度seo搜索营销新视角
  • 做英文网站哪家好站长之家网站
  • 做简历比较好的网站叫什么百度账号出售平台
  • 网站首页布局设计原理济南百度代理