在前面的博客中已经讲解了推箱子游戏的菜单和各种对话框的实现,下面对推箱子游戏的核心算法设计和实现进行讲解 地图文件读取模块,主要负责将地图文件进行读取,并把相应的文件数据转换成地图显示出来,其设计步骤如下 1:读取当前文件夹中的地图文件 2:判断当前选择关口是否在文件中存在 3:如果存在则把当前关口的地图信息放置到地图数组中 其实现代码如下 void CBoxManDlg::loadMap(int iMissionNum) { CString str; str.Format("[%d]", iMissionNum); FILE *pFile = fopen("map.txt", "rb"); if (pFile == NULL) return; char cTmp[20]; fgets(cTmp, 20, pFile); while (strncmp(cTmp, str, 3) != 0) { fgets(cTmp, 20, pFile); } for (int i = 0; i < 14; i++) fgets(m_cMap[i], 20, pFile);...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with char
Contact char, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack