C語言小遊戲 小熊跳板

2021-10-11 02:31:32 字數 1922 閱讀 8334

c語言**,有點簡陋,還有許多可以優化的地方,注釋也沒寫全,後期會補充,後期也可能新增更多功能,我會去盡量的完善**。

測試工具:vs2019,語言:c語言

#include

#include

#include

#include

#include

#include

#define high 40

#define width 60

//畫布大小

int people_x, people_y;

//小球座標

int canvas[high +1]

[width +1]

;//標記

int b1_left[3]

;//橫線板板起點

int b1_right[3]

;//橫線板板終點

int score =0;

//得分

int vv =

15, v_b =8;

//vv大小可以改變板板上公升速度

void

hidecursor()

;setconsolecursorinfo

(getstdhandle

(std_output_handle)

,&cursor_info);}

void

gotoxy

(int x,

int y)

void

startup()

t =3;

while

(t--)}

} people_x =2;

people_y =6;

// 小球橫縱座標

canvas[people_x]

[people_y]=1

;// 小球所在不能為橫線板板

for(i =

0; i < high; i++

)// 左右邊框為束線

for(j =

0; j < width; j++

)//上下邊框為t

}void

show()

printf

("\n");

}printf

("得分:%d\n"

, score);}

intupdatawithoutinput()

else

canvas[i -1]

[j]=2;

}else}}

} v_bord =0;

}for

(i =

1; i <= width -

2; i++)}

if(v_ball < v_b)

v_ball++;if

(v_ball == v_b && canvas[people_x +1]

[people_y]==0

)int cnt =0;

//判斷遊戲是否結束

if(people_x ==

0|| people_x == high -2)

if(flag)

t =3;

while

(t--)}

}//sleep(200);

restart:

return cnt;

}void

updatawithinput()

if((key ==

'd'|| key ==77)

&& canvas[people_x]

[people_y+1]

==0)}

}void

init()

intmain()

}

執行效果:

C語言小遊戲 生命遊戲

使用的是microsoft visual studio 2017開發環境 lifegame.cpp 定義控制台應用程式的入口點。include stdafx.h include include include include define high 25 define width 50 全域性變數 ...

C語言小遊戲 掃雷

1.這個小遊戲由兩個原始檔,乙個標頭檔案分工合作完成。test.c game.c game.h 2.確定基本框架,在test.c中寫主函式以及遊戲所需的基本框架 例如 menum switch 3.先確定這個遊戲需要的函式功能,在game.h中進行函式宣告,game.c中進行函式的定義,test.c...

C語言 掃雷小遊戲

第一次下子,不炸死 座標周圍沒雷,可以實現展開 遊戲結束後展示玩家用時 game.h ifndef game h define game h include include include include define row 12 define col 12 define count 10 棋盤中...