贪食蛇大作战为什么一进去游戏就看不见蛇
答案:2 悬赏:0 手机版
解决时间 2021-03-06 02:45
- 提问者网友:孤凫
- 2021-03-05 09:29
最佳答案
- 五星知识达人网友:梦中风几里
- 2021-03-05 10:19
不要标注网络游戏,这只是一款单机。边上的玩家名字都是系统弄的。里面跟你一起玩的对手也是系统。
全部回答
- 1楼网友:舊物识亽
- 2021-03-05 11:43
*玩游戏具体过程*/
void gameplay(void)
{
randomize();
food.yes=1;
snake.life=0;
snake.direction=1;
snake.x[0]=100;snake.y[0]=100;
snake.x[1]=110;snake.y[1]=100;
snake.node=2;
prscore();
while(1)
{
while(!kbhit())
{
if(food.yes==1)
{
food.x=rand()%400+60;
food.y=rand()%350+60;
while(food.x%10!=0)
food.x++;
while(food.y%10!=0)
food.y++;
food.yes=0;
}
if(food.yes==0)
{
setcolor(green);
rectangle(food.x,food.y,food.x+10,food.y-10);
}
for(i=snake.node-1;i>0;i--)
{
snake.x[i]=snake.x[i-1];
snake.y[i]=snake.y[i-1];
}
switch(snake.direction)
{
case 1:snake.x[0]+=10;break;
case 2: snake.x[0]-=10;break;
case 3: snake.y[0]-=10;break;
case 4: snake.y[0]+=10;break;
}
for(i=3;i595||snake.y[0]<55||
snake.y[0]>455)
{
gameover();
snake.life=1;
}
if(snake.life==1)
break;
if(snake.x[0]==food.x&&snake.y[0]==food.y)
{
setcolor(0);
rectangle(food.x,food.y,food.x+10,food.y-10);
snake.x[snake.node]=-20;snake.y[snake.node]=-20;
snake.node++;
food.yes=1;
score+=10;
prscore();
}
setcolor(4);
for(i=0;i
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯