文件名称:Snake
- 所属分类:
- C#编程
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 72kb
- 下载次数:
- 0次
- 提 供 者:
- 吴*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
蛇的活动区是由57×33个小方格组成,当这些小方格呈现深灰色时,便表示蛇身。蛇是由n个相邻的方格组成,将这些方格的坐标依蛇头到蛇尾的次序放入到一个数组中便代表了蛇身。当蛇在活动区中游动一格时,所对应的的数组操作为,将新的位置坐标插入到数组的头部,同时将数组中最后一个元素删除。
游戏使用四个方向键和A/W/S/D来控制蛇的前进方向,在OnKeyDown()消息处理函数中,根据不同的方向键设置了成员变量m_nDirect的值。当在菜单中选择开始时,启动定时器,游戏开始。在定时器消息处理函数中,根据m_nDirect的值判断出蛇的下一个位置。如果没有超出边界或碰到自身,则蛇可以移动到一个新位置。如果吃到了食物,则在CArray()中只插入而不删除最后一个元素,蛇身长度增加,否则弹出游戏结束对话框,框内显示所用时间和最终得分。
菜单栏的项目以实用性为主,另外每个按钮都设置有快捷键,分别为:F1-帮助;F2-开始游戏;F4-关闭窗口,退出游戏
-The snake s activity area is composed by 57 × 33 small squares, when these small squares presented a dark gray, and they said the snake. Snake n adjacent squares, the grid coordinates to the tail of the order in accordance with snakeheads into it on behalf of the snake into an array. Snake swimming in the activity area grid array operation corresponding to the new location coordinates inserted into the head of the array, while the last element in the array to delete.
The game uses the four arrow keys and A/W/the S/D to control the forward direction of the snake, OnKeyDown () message processing function, depending on the direction of the key to set the value of the member variables m_nDirect. When in the menu, select Start to start the timer, the start of the game. In the the timer message processing function, based on the value of m_nDirect determine the next position of the snake. If there is no out of bounds or encounter itself, the snake can move to a new location. If you eat the f
游戏使用四个方向键和A/W/S/D来控制蛇的前进方向,在OnKeyDown()消息处理函数中,根据不同的方向键设置了成员变量m_nDirect的值。当在菜单中选择开始时,启动定时器,游戏开始。在定时器消息处理函数中,根据m_nDirect的值判断出蛇的下一个位置。如果没有超出边界或碰到自身,则蛇可以移动到一个新位置。如果吃到了食物,则在CArray()中只插入而不删除最后一个元素,蛇身长度增加,否则弹出游戏结束对话框,框内显示所用时间和最终得分。
菜单栏的项目以实用性为主,另外每个按钮都设置有快捷键,分别为:F1-帮助;F2-开始游戏;F4-关闭窗口,退出游戏
-The snake s activity area is composed by 57 × 33 small squares, when these small squares presented a dark gray, and they said the snake. Snake n adjacent squares, the grid coordinates to the tail of the order in accordance with snakeheads into it on behalf of the snake into an array. Snake swimming in the activity area grid array operation corresponding to the new location coordinates inserted into the head of the array, while the last element in the array to delete.
The game uses the four arrow keys and A/W/the S/D to control the forward direction of the snake, OnKeyDown () message processing function, depending on the direction of the key to set the value of the member variables m_nDirect. When in the menu, select Start to start the timer, the start of the game. In the the timer message processing function, based on the value of m_nDirect determine the next position of the snake. If there is no out of bounds or encounter itself, the snake can move to a new location. If you eat the f
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Snake\MainFrm.cpp
.....\MainFrm.h
.....\ReadMe.txt
.....\resource.h
.....\Snake.aps
.....\Snake.clw
.....\Snake.cpp
.....\Snake.dsp
.....\Snake.dsw
.....\Snake.h
.....\Snake.ncb
.....\Snake.opt
.....\Snake.plg
.....\Snake.rc
.....\SnakeDoc.cpp
.....\SnakeDoc.h
.....\SnakeView.cpp
.....\SnakeView.h
.....\StdAfx.cpp
.....\StdAfx.h
.....\Release\MainFrm.obj
.....\.......\Snake.exe
.....\.......\Snake.obj
.....\.......\Snake.res
.....\.......\SnakeDoc.obj
.....\.......\SnakeView.obj
.....\.......\StdAfx.obj
.....\.......\vc60.idb
.....\res\Snake.ico
.....\...\Snake.rc2
.....\...\SnakeDoc.ico
.....\Release
.....\res
Snake