基于C++编程下的贪吃蛇游戏.docVIP

  • 11
  • 0
  • 约1.08万字
  • 约 12页
  • 2018-04-03 发布于河南
  • 举报
基于C编程下的贪吃蛇游戏

#include graphics.h #include stdio.h #include conio.h #include time.h #define UP 1 #define DOWN 2 #define LEFT 3 #define RIGHT 4 //////////////////////////////////////////// //格子类,定义一个格子的属性及行为 //////////////////////////////////////////// class Cell { public: friend class GameArea; //设置友元函数 void setxy(short x, short y) //设置格子左上角坐标 { m_x = x, m_y = y; } void setfull(short full) //设置格子属性,0为空,1为障碍,2为食物 { m_full = full; } void display(COLORREF color) //设置格子颜色并显示 { m_color = color; setfillstyle(m_color); bar(m_x, m_y, m_x+7, m_y+7); } void LaserDisplay() //显示镭射状态的格子 {

文档评论(0)

1亿VIP精品文档

相关文档