[求贪吃蛇的C语言程序 TC20]#define N 200 #include#include#include#define LEFT 0x4b00 #define RIGHT 0x4d00 #define DOWN 0x5000 #define UP 0x4800 #define ESC 0x011b int i,key; int score=0;/*...+阅读
#include#include#include#include#includechin a i t p oe er . co mugTTCrI #include#include#include#include#define N 50 #define Time 10000 int A[N][N]; int IE=6;chin a i t p oe er . co mugTTCrI int SCORE=0; char a[]="9999"; void *ball; int maxx; unsigned int size;chin a i t p oe er . co mugTTCrI int head=1;/*0,1,2,3*/ int i=3,j=0,ii=0,jj=0; int length=3; int x,y;/*蛇头标志*/ int add=1;/*食物标志*/ int tii,tjj;/* 前蛇尾坐标 */ void start_image() { setlinestyle(SOLID_LINE,1,2); setcolor(GREEN); line(39,39,39,441); line(39,441,441,441); line(441,441,441,39); line(441,39,39,39);chin a i t p oe er . co mugTTCrI chin a i t p oe er . co mugTTCrI } void draw_image(int x,int y) { int i=x*400/N+40; int j=y*400/N+40; setfillstyle(1,4); bar(j,i,j+400/N,i+400/N); } void eraser_image(int x,int y) { int i=x*400/N+40; int j=y*400/N+40; setfillstyle(1,0); bar(j,i,j+400/N,i+400/N); }chin a i t p oe er . co mugTTCrI chin a i t p oe er . co mugTTCrI void tu() {/*tuxing jiemian*/ maxx=getmaxx(); size=imagesize(210,390,450,420); ball=malloc(size); setfillstyle(1,10); bar(160,170,473,253); setfillstyle(1,9); bar(163,173,470,250); setcolor(13); outtextxy(200,200,"Welcome to Greedy Snake Game"); setcolor(14); outtextxy(250,220,"Developer :Wu siyuan "); outtextxy(290,240,"2003.5"); outtextxy(210,390,"Press any key to contunue..."); getimage(210,390,450,420,ball);chin a i t p oe er . co mugTTCrI chin a i t p oe er . co mugTTCrI while(!kbhit()) {/* 没有键盘击键 */ putimage(210,390,ball,XOR_PUT); delay(30000); } cleardevice(); } void print()/*输出*/ { /*要将转化成图形模式*/ int a,b; /*start_image(); */chin a i t p oe er . co mugTTCrI for(a=0;a1&A[i-1][j]!=99) {printf("I hit myself!");exit
(1);} i--; if(IE>30)IE=2; A[i][j]=IE;IE++; del_tail(); A[tii][tjj]=0;chin a i t p oe er . co mugTTCrI } void left() { head=2; if(A[i][j-1]>1&A[i][j-1]!=99) {printf("I hit myself!");exit
(1);} j--; if(IE>30)IE=2; A[i][j]=IE;IE++; del_tail(); A[tii][tjj]=0;chin a i t p oe er . co mugTTCrI } void right() { head=3; if(A[i][j+1]>1&A[i][j+1]!=99) {printf("I hit myself!");exit
(1);} j++; if(IE>30)IE=2; A[i][j]=IE;IE++; del_tail(); A[tii][tjj]=0; }chin a i t p oe er . co mugTTCrI void test()/*测试是否到达边界*/ { if(iN-1||jN-1) { printf("出界! Game over."); exit
(1); } } void move()/*当前移动*/ { switch(head) { case 0:up();break; case 1:down();break; case 2:left();break; case 3:right();break; /*default:printf("方向出错!\\n");*/ }chin a i t p oe er . co mugTTCrI } int keyboard() { /*判断是否有键盘输入 // 有返回值0,1,2,3 // int k=keyboard; //判断方向是否是有效方向 //无效则什么也不做 //若方向有效则改变head的值*/ int a,key,h; for(a=0;a
以下为关联文档:
用C语言编写的代码程序 B A可立即执行 B是一个源程序 CC语言写的代码程序肯定是源程序,B是对的,它不能立即执行,必须经过编译成可执行代码, 所以A是错误的; 如果这个源程序中不含有main函数,编译后的代码也是不可执行的,所以C是错误的; C...
c语言贪吃蛇程序/* 贪吃蛇程序 by champking */#define N 200#include#include#include#define LEFT 0x4b00#define RIGHT 0x4d00#define DOWN 0x5000#define UP 0x4800#define ESC 0x011b...
用C语言编写贪吃蛇游戏的程序回答:Mr.emily 大师 6月3日 16:45 #define N 200 #include#include#include#define LEFT 0x4b00 #define RIGHT 0x4d00 #define DOWN 0x5000 #define UP 0x4800 #define Esc...
求贪吃蛇C语言代码原发布者:西瓜萝卜饭lala #include #include #include #include #include #include #include #defineN21 charapple[2]; chartail[2]; char**snake=NULL; intscore=0; intlen...
C语言编写贪吃蛇需要用哪些函数?#include#include#include/*引用的库函数*/ #define LEFT 0x4b00 #define RIGHT 0x4d00 #define DOWN 0x5000 #define UP 0x4800 #define ESC 0x011b/*宏定义键名*/ #define...
急求C语言程序设计贪吃蛇的总结 !不知道怎么写。。。c++ #include <iostream> using namespace std; char num[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c...
求用c语言编写的贪吃蛇程序#include#include#include#include/*引用的库函数*/ #define LEFT 0x4b00 #define RIGHT 0x4d00 #define DOWN 0x5000 #define UP 0x4800 #define ESC 0x011b/*宏定义键名*/...
用C语言写一个小游戏像贪吃蛇俄罗斯方块除了C语言还需要那除了C语言,还要学习WINDOWS,也就是WIN32,WINDOWS系统有很多函数,其中包括画图等等,所以要想写小游戏还得学WINDOWS的API。介绍本书给你,《WINDOWS程序设计》国外版。当然,如果你学...
关于用C语言编写的小游戏的游戏代码如黑白棋贪吃蛇等我这儿有c语言的自写俄罗斯方块,请指教: #include #include #include #include #include #include #include #define ESC 0x011b #define UP 0x4800 #define DOWN 0x5000 #def...