闁衡偓閹増顥� (0) +1 閻犙嶆嫹 (0) +1 闂婎亷鎷� (0) +1
闁衡偓閹増顥戦柟瀛樺姇婵拷闁哄被鍎冲﹢鍛村绩閹増顥�>>

正在阅读:利用C++实现的贪吃蛇游戏利用C++实现的贪吃蛇游戏

2004-10-08 14:53 出处:CSDN 作者:oosky2004 责任编辑:linjixiong


  else
  {       //eat
  if(headx==randomNode.x&&heady==randomNode.y)
  {
  Enqueue(randomNode);
  setfillstyle(SOLID_FILL,BLUE);
  bar(randomNode.x+1,randomNode.y+1,randomNode.x-1+BlockWidth,randomNode.y-1+BlockHeight);
  neednode=true;
  }
  else     //no eat
  {
  newNode.x=headx;
  newNode.y=heady;
  newNode.next=NULL;
  Enqueue(newNode);
  outNode=Dequeue();
  setfillstyle(SOLID_FILL,LIGHTGRAY);
  bar(outNode.x+1,outNode.y+1,outNode.x+BlockWidth-1,outNode.y+BlockHeight-1);
  setfillstyle(SOLID_FILL,BLUE);
  bar(newNode.x+1,newNode.y+1,newNode.x-1+BlockWidth,newNode.y-1+BlockHeight);
  }
  }
  delay(speed);
  }
  }
  void ClearKeyBuf()
  {
  do
  bioskey(0);
  while(bioskey(1));
  }

  void Foot(int x,int y)
  {
  setcolor(BLUE);
  outtextxy(x,y,"writer:[T]RealXL E-MAIL:realgeneral@hotmail.com");
  }
  void Head(int x,int y)
  {
  setcolor(RED);
  outtextxy(x,y,"GREEDY SNAKE");
  }
  void Enqueue(Node inNode)
  {
  Node *p=new Node;
  p->x=inNode.x;
  p->y=inNode.y;
  p->next=inNode.next;
  snake.tail->next=p;
  snake.tail=p;
  snake.length++;
  }

察看评论详细内容 我要发表评论
作者笔名 简短内容 发表时间
:
键盘也能翻页,试试“← →”键

关注我们

最新资讯离线随时看 聊天吐槽赢奖品
闁归潧顑嗗┃鈧悹浣告健濡拷闁搞儳鍋涢崺灞俱亜閸洖鍔�