<= FZ_RIGHT) And (SnakeY >= FZ_TOP And SnakeY <= FZ_BOTTOM) Then m_funMoveForbiddenZone = False Else m_funMoveForbiddenZone = True End IfEnd Function'该自定义函数用于返回运动的蛇是否碰到自己的身体而导致游戏失败Private Function m_funTouchSnakeBody(SnakeX As Long, SnakeY As Long) As Boolean For m = 2 To g_intSnakeLength If SnakeX = g_udtSnake(m).Snake_CurX And SnakeY = g_udtSnake(m).Snake_CurY Then m_funTouchSnakeBody = True Exit For Else m_funTouchSnakeBody = False End If Next mEnd Function'该自定义函数用于返回运动的蛇是否吃到了果子Private Function m_funEatPoint(SnakeX As Long, SnakeY As Long) As Boolean If Abs(SnakeX - g_udtPoint.Point_X) <= SNAKEWIDTH And Abs(SnakeY - g_udtPoint.Point_Y) <= SNAKEWIDTH Then m_funEatPoint = True Else m_funEatPoint = False End IfEnd Function'(API函数调用过程_用以实现无标题窗体的拖动操作)--------------------------------- 'RleaseCapture函数用以释放鼠标捕获 Public Declare Function ReleaseCapture Lib "user32" () As Long 'SendMessage函数用作向Windows发送移动窗体的消息 Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As _ Long, ByVal wMsg As Long, ByVal wParam As Long, IParam As Any) As Long Public Const WM_SYSCOMMAND = &H112 '声明向Windows发送消息的常量 Public Const SC_MOVE = &HF012 '声明控制移动窗体常量'(游戏变量声明部分)------------------------------------------------------------- '定义蛇的数据类型结构 Public Type Snake Snake_OldX As Long Snake_OldY As Long Snake_CurX As Long Snake_CurY As Long Snake_Color As Long End Type '定义果子的数据类型结构 Public Type Point Point_X As Long Point_Y As Long Point_Color As Long End Type '定义蛇的动态数组 Public g_udtSnake() As Snake '定义果子 Public g_udtPoint As Point '定义蛇的长度 Public g_intSnakeLength As Integer '定义蛇的颜色 Public g_lngSnakeColor As Long '定义蛇的运动方向 Public g_intDirection As Integer '定义玩家的得分 Public g_intPlayerScore As Integer '定义游戏耗费的秒数 Public g_lngGameTime As Long
推荐阅读
- 错误代码0x0000004e解决办法 错误代码0x0000004e解决办法有什么
- “狂蟒天灾”里那条蛇刚开始被达夫杀了,为什么又活过来了?
- 蛇怎么过冬 蛇冬天需要冬眠吗
- 蛇是冷血动物不会产生感情 蛇和人有感情吗为什么
- 吃蛇有什么好处和坏处 吃蛇的功效和禁忌
- 什么属相的人不能养宠物蛇 哪种属相的人不能养宠物蛇
- 梦见狗和蛇是什么预兆 梦见狗和蛇预兆是什么
- 三国全面战争秘籍城市代码
- 贪心不足蛇吞象什么意思
- 蛇为什么不吃石蛙