C《貪吃蛇》簡易字元版

2021-06-26 06:52:51 字數 1558 閱讀 2930

哇咔咔,這是我步入遊戲製作界的第一步。

忙活了乙個國慶,雖說bug略多,但是成就感滿滿的。

for (i = 0; i < h; i++)//畫地圖

printf("\n");

} }}void play(int speed, int hard)

if (_kbhit() != 0)//有鍵盤輸入則變換key的值,否則保持原方向

key = _getch();

direction(key, direct);

body = head;

if ((direct->x != fx) || (direct->y != fy))

}else

flashmap(head, fx, fy, hard);

life = live();

if (life)

break; }}

int live(void)

void flashmap(struct snake*showsnake, int fx, int fy, int hard)//重新整理螢幕

map[fx][fy] = '@';

if (hard == 0)

printf("\n");

} }else

printf("\n");

} }}void direction(char button, struct snake*direction)//改變方向

}

C字元貪吃蛇

演算法參照perl字元貪吃蛇,原始碼 include include define width 12 寬 define height 8 高 define debug 0 const char fence 柵欄const char head 蛇頭const char body 蛇身const cha...

簡易版貪吃蛇小遊戲。

以上就是我測試的結果,能完成基本的功能。ifndef game h define gamae h include include include include define rows 20 define cols 20 define snake length 20 20 define sleep ...

js canvas實現簡易版貪吃蛇

lang en charset utf 8 name viewport content width device width,initial scale 1.0 貪吃蛇title canvas style head snake width 600 height 600 canvas 食物 class...