设为首页 加入收藏

TOP

C语言对对碰游戏源码分享(三)
2018-02-28 08:57:04 】 浏览:520
Tags:语言 游戏 源码 分享
T) { start = now; Time--; New(); if (Time <= 0) return; } } if(sign) { putimage(x1 - x1 % 60, y1 - y1 % 60, &img[int(gem[y1 / 60 + 1][x1 / 60])], SRCPAINT); continue; } if (y1 - y > 30 && y1 / 60 > 0) fx = 'u'; if (y - y1 > 30 && y1 / 60 < 7) fx = 'd'; if (x1 - x > 30 && x1 / 60 > 0) fx = 'l'; if (x - x1 > 30 && x1 / 60 < 7) fx = 'r'; x = y1 / 60 + 1; y = x1 / 60; x1 = y1 = 0; switch (fx) { case 'u':x1 = -1; break; case 'd':x1 = 1; break; case 'l':y1 = -1; break; case 'r':y1 = 1; break; case '\0':continue; } for (i = 0; i < 60;) { putimage(60 * y, 60 * (x - 1), &img[0]); putimage(60 * y, 60 * (x - 1), &img[0]); i += 1; putimage(60 * (y + y1) - i * y1, 60 * (x - 1 + x1) - i * x1, &img[int(gem[x + x1][y + y1])]); putimage(60 * y + i * y1, 60 * (x - 1) + i * x1, &img[int(gem[x][y])]); Sleep(2); } t = gem[x][y]; gem[x][y] = gem[x + x1][y + y1]; gem[x + x1][y + y1] = t; if (judge()) { draw(); if (!baidu()) Blank(); } else { for (i = 0; i < 60;) { putimage(60 * y, 60 * (x - 1), &img[0]); putimage(60 * y, 60 * (x - 1), &img[0]); i += 1; putimage(60 * (y + y1) - i * y1, 60 * (x - 1 + x1) - i * x1, &img[int(gem[x + x1][y + y1])]); putimage(60 * y + i * y1, 60 * (x - 1) + i * x1, &img[int(gem[x][y])]); Sleep(2); } t = gem[x][y]; gem[x][y] = gem[x + x1][y + y1]; gem[x + x1][y + y1] = t; } now = clock(); if (now - start >= CLOCKS_PER_SEC * MaxT / T) { start = now; Time--; New(); if (Time <= 0) return; } }while (true); } /****************主函数******************/ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { try { // 加载素材 load(); } catch (int) { ofstream fout("存档.dat"); fout < } // 打开界面 initgraph(640, 480); // 游戏过程 do { if (Music) mciSendString("play mymusic from 0 repeat", NULL, 0, NULL); play(); if (Music) mciSendString("stop mymusic", NULL, 0, NULL); Flag = false; }while (quit()); // 关闭游戏 ofstream fout("存档.dat"); fout < fout.close(); mciSendString("close mymusic", NULL, 0, NULL); closegraph(); return 0; } /**************THE END****************/

 

首页 上一页 1 2 3 4 下一页 尾页 3/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇C语言之十进制转为二进制的方法 下一篇C 分数矩阵题目描述和题解

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目