果蔬連連看最新版(連連看最新版游戲)


本站AI自動判斷提供您所需要的app下載:點我下載安裝,你懂的APP

《connect》為經(jīng)典的連連看玩法賦予了全新的意義,游戲的畫面更加精美、細(xì)膩;消除的造型也拜托了傳統(tǒng)的麻將牌式的長方塊,陸續(xù)推出了圓形、方形等其他幾何圖形,游戲圖案更是豐富多彩,既有美味可口的西式甜點,也有男性夢寐以求的各種汽車,既有花樣繁多的各國國旗,也有emoji和運動器材等其他圖案。可謂是繽彩紛呈,種類齊全。舒適的圖形、成熟的玩法,豐富的各種活動內(nèi)容,讓《connect》成為了一款讓絕大多數(shù)人都無法反對的游戲。


我們接著來實現(xiàn)窗口置頂?shù)捻憫?yīng)函數(shù)

歡迎轉(zhuǎn)行和學(xué)習(xí)編程的伙伴,利用更多的資料學(xué)習(xí)成長比自己琢磨更快哦!


在現(xiàn)實生活中,由于各種生活壓力,我們通常對于同事朋友笑臉相迎,但是對于家人往往生氣或者冷淡,總認(rèn)為家里人始終會不離不棄。其實家庭關(guān)系也需要用心經(jīng)營,多和家人溝通互動是非常有必要的,哪怕只是線上的互動,因此這款老少皆宜的休閑社交游戲很符合當(dāng)下的社會環(huán)境,全家福的家族系統(tǒng)能讓家人親密消除隔閡。

{

}

然后我們編譯運行看看,不能自動點擊開始了,并且發(fā)現(xiàn)鼠標(biāo)移動的位置不對,是因為SetCursorPos的坐標(biāo)是相對于屏幕的,而我們獲取到的坐標(biāo) 是相對于QQ連連看的,所以我們要獲取練練看窗口的位置,并加上它的偏移 最終代碼如下

mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);

效果圖展示:

連接路徑經(jīng)過的單元格所包含的圖片必須已經(jīng)消除

放學(xué)別跑是一款MOBA機制的競技對戰(zhàn)游戲,相較于很多同類游戲,這款游戲獨特性就是在于自由開放程度遠(yuǎn)超其他游戲,幾乎達(dá)到無視地形的情況,讓玩家又愛又恨。游戲打破傳統(tǒng)的舒服,采用自動射擊的戰(zhàn)斗,隨時隨地,只要靈活走位、合理釋放大招,即可體驗一場酣暢淋漓的戰(zhàn)斗!

游戲操作方面與其他類似游戲基本沒有區(qū)別,都是很簡單的連線消除。關(guān)卡數(shù)量比較多,前期只有少數(shù)幾種水果能夠輕松過關(guān)。隨著關(guān)卡的遞增,游戲難度越大,滿屏的彩色水果眼花繚亂。這時需要找到幾個合適的水果消除后打開局面,之后就會迎刃而解。

游戲開始時簡單的界面

(圖1)

那么今天的分享就到這里了,后續(xù)會更新更多精彩項目或者知識內(nèi)容的,大家要好好學(xué)C語言C++喲~

加載游戲后,點擊畫面中間的圖像即進入游戲狀態(tài)。使用鼠標(biāo)左鍵即可,點擊相同的兩張圖卡,用三根內(nèi)線連在一起就可以消除。只要我們在有限的時間里,用我們智慧消除相連卡片,就可以獲得最終的勝利。那么我們了解了規(guī)則之后,就動手來試試吧!

#include #include #include #include #include #pragma comment(lib,"winmm.lib") //150 150 12 7 21 易 //60 100 16 9 32 中 //100 120 14 8 28 難 #define leftedge 150 //游戲區(qū)距左邊框距離 #define topedge 150 //游戲區(qū)距上邊框距離 #define COL 12 //游戲區(qū)列數(shù) #define ROW 7 //游戲區(qū)行數(shù) #define GridNum 21 //游戲圖片數(shù)目 #define GridW 42 //游戲圖片的長 #define GridH 48 //游戲圖片的寬 #define N 555 //開屏大小(寬) #define M 785 //開屏大小(長) IMAGE image[GridNum + 1][2]; //圖片庫 IMAGE image2; //填充圖片 int GridID[ROW + 2][COL + 2]; //游戲圖紙 MOUSEMSG mouse; //記錄鼠標(biāo)信息 struct GridInfor //記入擊中圖片信息 { int idx,idy; //圖紙坐標(biāo) int leftx,lefty; //屏幕坐標(biāo) int GridID; //圖片類型 }pre,cur,dur; struct //記錄連線點 { int x; int y; }point[4]; static int pn; //記錄連線點個數(shù) void InitFace (); //初始化界面 void Shuffle (); //隨即打亂圖片 void ShowGrid (); //顯示圖片 void RandGrid (); //繪制地圖 void Link (); //連接兩圖 void Des_direct (); //直接相消 void Des_one_corner(); //一折相消 void Des_two_corner(); //兩折相消 void Load_picture (); //加載圖片 void Init_Grid (GridInfor& pre); //初始化格子信息 void Leftbottondown (MOUSEMSG mouse); //實現(xiàn)鼠標(biāo)左擊效果 void Draw_frame (int leftx,int lefty); //繪制邊框 void Mousemove (int leftx,int lefty); //實現(xiàn)鼠標(biāo)移動效果 bool Judg_val (int leftx,int lefty); //判斷鼠標(biāo)是否在游戲區(qū) void SeleReact (int leftx,int lefty); //顯示選中效果 void TranstoPhycoor (int* idx,int* idy); //圖紙坐標(biāo)轉(zhuǎn)變?yōu)槠聊蛔鴺?biāo) void GridPhy_coor (int& leftx,int& lefty); //規(guī)范物理坐標(biāo) void iPaint (long x1,long y1,long x2,long y2); //將直線銷毀 void DrawLine (int x1,int y1,int x2,int y2) ; //用直線連接兩圖 bool DesGrid (GridInfor pre,GridInfor cur); //判斷兩者是否能相消 bool Match_direct (POINT ppre,POINT pcur); //判斷兩者是否能夠直接相消 bool Match_one_corner (POINT ppre,POINT pcur); //判斷兩者是否能一折相消 bool Match_two_corner (POINT ppre,POINT pcur); //判斷兩者是否能兩折相消 void ExchaVal (GridInfor& pre,GridInfor& cur); //交換圖片信息 bool Single_click_judge (int mousex,int mousey); //判斷單擊是否有效 void RecordInfor (int leftx,int lefty,GridInfor &grid); //記錄選中的信息 void TranstoDracoor (int mousex,int mousey,int *idx,int *idy); //鼠標(biāo)坐標(biāo)轉(zhuǎn)化為圖紙坐標(biāo) void Explot (POINT point,int *left,int *right,int *top,int *bottel);//探索point點附近的空位置 void main() { initgraph(M,N); mciSendString("play game_begin.mp3 repeat", NULL, 0, NULL); InitFace(); while(1) { mouse = GetMouseMsg(); switch(mouse.uMsg) { case WM_MOUSEMOVE: Mousemove(mouse.x,mouse.y); break; case WM_LBUTTONDOWN: if(Single_click_judge(mouse.x,mouse.y)) { Leftbottondown(mouse); } break; default: break; } } closegraph(); } ////////////////////////////////////////生成操作////////////////////////////// void RandGrid() //產(chǎn)生圖片的標(biāo)記 { for(int iCount = 0, x = 1; x <= ROW; ++x ) { for( int y = 1; y <= COL; ++y ) { GridID[x][y] = iCount++ % GridNum + 1; } } } void Shuffle( ) //打亂棋盤 { int ix, iy, jx, jy, grid; for( int k = 0; k < 84; ++k ) { ix = rand() % ROW + 1; // 產(chǎn)生 1 - COL 的隨機數(shù) iy = rand() % COL + 1; // 產(chǎn)生 1 - ROW 的隨機數(shù) jx = rand() % ROW + 1; // 產(chǎn)生 1 - COL 的隨機數(shù) jy = rand() % COL + 1; // 產(chǎn)生 1 - ROW 的隨機數(shù) if( GridID[ix][iy] != GridID[jx][jy] ) //如果不相等就交換數(shù)據(jù) { grid = GridID[ix][iy]; GridID[ix][iy] = GridID[jx][jy]; GridID[jx][jy] = grid; } } } ////////////////////////////////初始化界面/////////////////////////////////////// void InitFace() { srand((unsigned)time(NULL)); Load_picture(); RandGrid(); IMAGE image3; loadimage(&image3,"res\\bg.bmp"); putimage(0,0,&image3); getimage(&image2,3 * 42,2 * 48,42, 48); Shuffle(); ShowGrid(); } void Load_picture() //加載圖片 { IMAGE image1,background; loadimage(&image1,"IMAGE","grids"); SetWorkingImage(&image1); for(int i = 1 ;i < GridNum + 1 ;i ++) for(int j = 0;j < 2;j++) getimage(&image[i][j],j * 42,i * 48,42, 48); loadimage(&background,"IMAGE","bg"); SetWorkingImage(&background); getimage(&image2,3 * 42,2 * 48,42, 48); SetWorkingImage(); putimage(0,0,&background); } void ShowGrid() { int idx,idy; for(int i = 0 ;i < ROW; i ++) for(int j = 0 ;j < COL ; j++) { idy = i * 48 + topedge ,idx = j * 42 + leftedge; putimage(idx,idy,&image[GridID[i + 1][j + 1]][0]); } } /////////////////////////////////鼠標(biāo)操作//////////////////////////////////////// void Mousemove (int leftx,int lefty) //鼠標(biāo)移動時的變化 { static int prex,prey,preidx,preidy, curidx,curidy; if(Judg_val(leftx,lefty)) { TranstoDracoor(leftx,lefty,&curidx,&curidy); //轉(zhuǎn)化為圖紙坐標(biāo) if(GridID[curidy][curidx] != 0) { GridPhy_coor(leftx,lefty); if(pre.idx == preidx && pre.idy == preidy) putimage(prex,prey,&image[GridID[preidy][preidx]][1]); else putimage(prex,prey,&image[GridID[preidy][preidx]][0]); prex = leftx, prey = lefty; preidx = curidx, preidy = curidy; Draw_frame(leftx,lefty); //繪制邊框 } } } void Leftbottondown (MOUSEMSG mouse) //左擊時的變化 { static int click = 0, idx,idy; click++; SeleReact (mouse.x,mouse.y); //顯示選中效果 if(click == 1) RecordInfor(mouse.x,mouse.y,pre); if(click == 2) { TranstoDracoor (mouse.x,mouse.y,&idx,&idy); if(idx != pre.idx || idy != pre.idy) { RecordInfor (mouse.x,mouse.y,cur); if(pre.GridID == cur.GridID && DesGrid(pre,cur)) { GridID[pre.idy][pre.idx] = GridID[cur.idy][cur.idx] =0; Link (); pn = 0; putimage(pre.leftx,pre.lefty,&image2); putimage(cur.leftx,cur.lefty,&image2); Init_Grid(pre); Init_Grid(cur); click = 0; } else { ExchaVal(dur,pre); ExchaVal(pre,cur); Init_Grid(cur); click = 1; putimage(dur.leftx,dur.lefty,&image[GridID[dur.idy][dur.idx]][0]); } } else click = 1; } } void SeleReact (int leftx,int lefty) //選中時效果 { if(Judg_val(leftx,lefty)) { int idx,idy; TranstoDracoor (leftx,lefty,&idx,&idy); GridPhy_coor (leftx,lefty); putimage(leftx,lefty,&image[GridID[idy][idx]][1]); } } bool Judg_val(int leftx,int lefty) //判斷鼠標(biāo)是否在游戲區(qū) { return leftx > leftedge && leftx < leftedge + GridW * COL && lefty > topedge && lefty < topedge + GridH * ROW; } void TranstoDracoor (int mousex,int mousey ,int *idx,int *idy) //鼠標(biāo)坐標(biāo)轉(zhuǎn)化為圖紙坐標(biāo) { if(Judg_val(mousex,mousey)) { *idx = (mousex - leftedge) / 42 + 1; *idy = (mousey - topedge) / 48 + 1 ; } } void RecordInfor(int leftx,int lefty,GridInfor &grid) //記錄選中的信息 { TranstoDracoor(leftx,lefty,&grid.idx,&grid.idy); grid.leftx = (grid.idx - 1) * 42 + leftedge; grid.lefty = (grid.idy - 1) * 48 + topedge; grid.GridID = GridID[grid.idy][grid.idx]; } bool Single_click_judge (int mousex,int mousey) //判斷單擊是否有效 { int idx,idy; TranstoDracoor (mousex,mousey,&idx,&idy); //轉(zhuǎn)化為圖紙坐標(biāo) if(Judg_val(mouse.x,mouse.y) && GridID[idy][idx] != 0) return true; return false; } void Draw_frame(int leftx,int lefty) //繪制方框 { setcolor(RGB(126,91,68)); setlinestyle(PS_SOLID,NULL,1); rectangle(leftx,lefty,leftx+41,lefty+47); rectangle(leftx + 2,lefty + 2,leftx+39,lefty+45); setcolor(RGB(250,230,169)); rectangle(leftx + 1,lefty + 1,leftx+40,lefty+46); } ////////////////////////////////判斷消除操作///////////////////////////////////// bool DesGrid (GridInfor pre,GridInfor cur) //判斷兩者是否能相消 { bool match = false; POINT ppre,pcur; ppre.x = pre.idx; ppre.y = pre.idy; pcur.x = cur.idx; pcur.y = cur.idy; if(Match_direct(ppre,pcur)) match = true; else if(Match_one_corner(ppre,pcur)) match = true; else if(Match_two_corner(ppre,pcur)) match =true; return match; } bool Match_direct(POINT ppre,POINT pcur) //判斷兩者是否能夠直接相消 { int k,t; if(ppre.x == pcur.x) { k = ppre.y > pcur.y ? ppre.y : pcur.y; t = ppre.y < pcur.y ? ppre.y : pcur.y; if(t + 1 == k) goto FIND; for(int i = t + 1;i < k ;i++) if(GridID[i][ppre.x] != 0) return false; if(i == k) goto FIND; } else if(ppre.y == pcur.y) { k = ppre.x > pcur.x ? ppre.x : pcur.x; t = ppre.x < pcur.x ? ppre.x : pcur.x; if(t + 1 == k) goto FIND; for(int i = t + 1;i < k ;i++) if(GridID[ppre.y][i] != 0) return false; if(i == k) goto FIND; } return false; FIND: point[pn].x = pcur.x, point[pn].y = pcur.y; pn++; point[pn].x = ppre.x, point[pn].y = ppre.y; pn++; return true; } bool Match_one_corner(POINT ppre,POINT pcur) //判斷兩者是否能一折相消 { int left,right,top,bottel,x = ppre.x,y = ppre.y; Explot(ppre,&left,&right,&top,&bottel); ppre.y = top - 1; RESEARCHX: if(ppre.y < bottel) ppre.y++; else goto BACK; if(Match_direct(ppre,pcur)) goto FIND; else goto RESEARCHX; BACK: ppre.y = y; ppre.x = left - 1; RESEARCHY: if(ppre.x < right) ppre.x++; else goto REBACK; if(Match_direct(ppre,pcur)) goto FIND; else goto RESEARCHY; REBACK: pn = 0; return false; FIND: point[pn].x = x,point[pn].y = y,pn++; return true; } bool Match_two_corner(POINT ppre,POINT pcur) //判斷兩者是否能兩折相消 { int left,right,top,bottel,x = ppre.x,y = ppre.y; Explot(ppre,&left,&right,&top,&bottel); ppre.y = top - 1; RESEARCHX: if(ppre.y < bottel) ppre.y++; else goto BACK; if(Match_one_corner(ppre,pcur)) goto FIND; else goto RESEARCHX; BACK: ppre.y = y; ppre.x = left - 1; RESEARCHY: if(ppre.x < right) ppre.x++; else goto REBACK; if(Match_one_corner(ppre,pcur)) goto FIND; else goto RESEARCHY; REBACK: pn = 0;return false; FIND: point[pn].x = x,point[pn].y = y,pn++; return true; } void Explot(POINT point,int *left,int *right,int *top,int *bottel) { int x = point.x,y = point.y; x++; while(x <= COL + 1 && GridID[y][x] == 0) x++; *right = x - 1; x = point.x; x--; while(x >= 0 && GridID[y][x] == 0) x--; *left = x + 1; x = point.x; y++; while(y <= ROW + 1 && GridID[y][x] == 0) y++; *bottel= y - 1; y = point.y; y--; while(y >= 0 && GridID[y][x] == 0) y--; *top = y + 1; } /////////////////////////////////消除操作//////////////////////////////////////// void Link () { switch(pn) { case 2: Des_direct(); break; case 3: Des_one_corner(); break; case 4: Des_two_corner(); break; default : break; } } void Des_direct () { TranstoPhycoor(&point[0].x,&point[0].y); TranstoPhycoor(&point[1].x,&point[1].y); DrawLine(point[0].x,point[0].y,point[1].x,point[1].y); Sleep(250); iPaint(point[0].x,point[0].y,point[1].x,point[1].y); } void Des_one_corner() { TranstoPhycoor(&point[0].x,&point[0].y); TranstoPhycoor(&point[1].x,&point[1].y); TranstoPhycoor(&point[2].x,&point[2].y); DrawLine(point[0].x,point[0].y,point[1].x,point[1].y); DrawLine(point[1].x,point[1].y,point[2].x,point[2].y); Sleep(250); iPaint(point[0].x,point[0].y,point[1].x,point[1].y); iPaint(point[1].x,point[1].y,point[2].x,point[2].y); } void Des_two_corner() { TranstoPhycoor(&point[0].x,&point[0].y); TranstoPhycoor(&point[1].x,&point[1].y); TranstoPhycoor(&point[2].x,&point[2].y); TranstoPhycoor(&point[3].x,&point[3].y); DrawLine(point[0].x,point[0].y,point[1].x,point[1].y); DrawLine(point[1].x,point[1].y,point[2].x,point[2].y); DrawLine(point[2].x,point[2].y,point[3].x,point[3].y); Sleep(250); iPaint(point[0].x,point[0].y,point[1].x,point[1].y); iPaint(point[1].x,point[1].y,point[2].x,point[2].y); iPaint(point[2].x,point[2].y,point[3].x,point[3].y); } void DrawLine (int x1,int y1,int x2,int y2) { setlinestyle(PS_SOLID,NULL,3); setcolor(RGB(90,43,9)); line(x1 + 21,y1 + 24,x2 + 21,y2 + 24); } void iPaint (long x1,long y1,long x2,long y2) { int minx,miny,maxx,maxy; if(x1 == x2) { maxy = y1 > y2? y1:y2; miny = y1 < y2? y1:y2; for(int i = miny; i <= maxy;i += 48) putimage(x1,i,&image2); } else if(y1 == y2) { maxx = x1 > x2? x1:x2; minx = x1 < x2? x1:x2; for(int j = minx; j <= maxx;j += 42 ) putimage(j,y1,&image2); } } ///////////////////////////////////////////////////////////////////////////////// void GridPhy_coor(int& leftx,int& lefty) //轉(zhuǎn)化為標(biāo)準(zhǔn)物理坐標(biāo) { leftx = ((leftx - leftedge) / 42) * 42 + leftedge; lefty = ((lefty - topedge) / 48) * 48 + topedge; } void ExchaVal(GridInfor& pre,GridInfor& cur) //交換格子信息 { pre.GridID = cur.GridID; pre.idx = cur.idx;pre.idy = cur.idy; pre.leftx = cur.leftx;pre.lefty = cur.lefty; } void Init_Grid(GridInfor& grid) //初始化格子 { grid.GridID = 0; grid.idx = 0; grid.idy = 0; grid.leftx = 0; grid.lefty = 0; } void TranstoPhycoor (int* idx,int* idy) //圖紙坐標(biāo)轉(zhuǎn)變?yōu)槠聊蛔鴺?biāo) { int x ,y;x =*idx,y = *idy; *idy = (y - 1) * 48 + leftedge; *idx = (x - 1) * 42 + topedge; }

寫在最后:對于準(zhǔn)備學(xué)習(xí)C/C++編程的小伙伴,如果你想更好的提升你的編程核心能力(內(nèi)功)不妨從現(xiàn)在開始!