[2006-05-07]打算编个超傻的AI,只会来回走动的,却发现已经接近24点
听从了James关于无聊的猎杀潜艇游戏的建议打算加入会动的敌人,提高游戏性加入“战争迷雾”可谓小菜一碟而给敌人加上个最弱智的AI也不算太高难利用我擅长的INI文件处理,不难办到不过以后的地图文件会大很多[0]type=1x0=1y0=8x1=2y1=8x2=3y2=8文件后部分会出现很多这样的AI Script读取信息的函数也已经编好,下一步就是在游戏界面中实现了,明天中午GOGOGO
void CMarineDlg::GetItemInfo(int stage){ char* path=new char[240]; char file[MAX_PATH],number[3]; GetCurrentDirectory(240,path); strcpy(file,path); strcat(file,"\\map\\map"); itoa(stage+1,number,10); strcat(file,number); strcat(file,".thi"); char temp[10],temp2[15],temp3[10]; int i,j; for(i=0;i<256;i++){ itoa(i,temp,10); m_OnGame.ItemInfo[i].type=GetPrivateProfileInt(temp,"type",0,file); if(m_OnGame.ItemInfo[i].type==0){ m_OnGame.ItemInfo[i].bIsExisted=FALSE; break; } else{ for(j=0;i<16;j++) { strcpy(temp2,"x"); itoa(j,temp3,10); strcat(temp2,temp3); m_OnGame.ItemInfo[i].step[j].x =GetPrivateProfileInt(temp,temp2,100,file); strcpy(temp2,"y"); itoa(j,temp3,10); strcat(temp2,temp3); m_OnGame.ItemInfo[i].step[j].y =GetPrivateProfileInt(temp,temp2,100,file); if(m_OnGame.ItemInfo[i].step[j].x==100 || m_OnGame.ItemInfo[i].step[j].y==100){ m_OnGame.ItemInfo[i].bIsExisted=FALSE; break; } else{ m_OnGame.ItemInfo[i].bIsExisted=TRUE; m_OnGame.ItemInfo[i].now.x=m_OnGame.ItemInfo[i].step[j].x; m_OnGame.ItemInfo[i].now.y = m_OnGame.ItemInfo[i].step[j].y; } } } } delete path; return;}