登录
首页 » Windows开发 » 迷宫追寻小游戏 C++MFC

迷宫追寻小游戏 C++MFC

于 2022-03-23 发布 文件大小:2.58 MB
0 265
下载积分: 2 下载次数: 1

代码说明:

应用背景 这个游戏为玩家控制红色方块,去吃掉棕色,绿色,蓝色的方块,一旦一个方块被吃,便会自动生成另一个相同颜色的方块。直到游戏时间结束为止。 程序函数功能: ondraw函数: 显示游戏界面(用画刷刷成白色),显示地图(黑色),显示食物0,1,2(分别为:棕色,绿色,蓝色),显示玩家(红色) 显示文字,时间,分数。 OnEraseBkgnd函数: 用来更新窗口背景,游戏以位图为窗口背景。 OnGameStart函数: 关联窗口菜单中的开始游戏。包括:     IniGame();(初始化游戏)     m_nGameStatus=1;(游戏状态1,开始)     SetTimer(1,100,NULL);(定时器0.1秒执行一次OnTime)     Invalidate();(转向OnDraw) IniGame函数: 初始化游戏,确定游戏显示位置,确定玩家初始位置,转向IniAim函数 IniAim函数: 初始化目标,这里的三个目标的位置为随机产生。 OnKeyDown函数: 监控设备按下的键,确定玩家移动方向。 ReDisPlay函数: 重画点所在的小方块。减少对Invalidate()的调用,使屏幕不太闪硕。 OmTimer函数: 完成时间的计算。 关键技术游戏中的人工智能: 棕色方块的移动算法为基本寻路算法—物体沿着墙走。 绿色方块的移动算法为基本的逃避算法—物体总会向玩家的反方向移动。 蓝色方块的移动算法为漫游算法—随机产生一个方向值,物体移动的方向不

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • Microsoft Windwos NT/2000 提供了一个强大的API集来访问系统事件和性能数据的众多计数器。我们既可以实时地得到计数器的值,也可以从一个日
    Microsoft Windwos NT/2000 提供了一个强大的API集来访问系统事件和性能数据的众多计数器。我们既可以实时地得到计数器的值,也可以从一个日志文件中读取计数器数据。功能可为强大,而且使用简单 。下面我就简单谈谈在VC中如何使用Windows的性能计数器。好,废话少说,我们开始。-Microsoft Windows NT/2000 provides a powerful set of APIs to access the system events and performance data of the many counters. We can get real-time counter to the values, they can log files from a counter reading data. Functions as a powerful, but simple to use. Now, I would simply talk about how to use the VC Windows performance counters. Well, nonsense least, we have begun.
    2022-05-28 01:04:29下载
    积分:1
  • first part of the init () method to load the game all the necessary resources, i...
     ? 部分内容   首先我们在init()方法中加载所有游戏必要的资源,包括声音,鼠标事件的监听、背景等相关设置。利用addBomb()方法增加bomb的数量、初始位置及初始化颜色。再利用start()启动线程。线程调用run()方法,处理炸弹下降运动down()。Repaint()会在每一个单位时间调用paint()方法不断的刷新屏幕,paint()调用Bomb.addBomb()绘制炸弹。当游戏者按下鼠标,mousePress()事件激活,判断是否点中了炸弹。如果点中addScore()自动加1分。如果没有点中炸弹,炸弹继续下降,当撞到屏幕wasHitEarth()方法激活,其内调用death()方法,减少Denfenser.life生命点,同时audio.play()处理声音的播放,用以提示游戏者。当你的生命点数小于0时”Game Over”。-first part of the init () method to load the game all the necessary resources, including the voices of the mouse wiretapping, and other relevant background set. Use addBomb () method to increase the number of bomb, the initial location and initialization color. Reuse start () activated threads. Call threads run () method to deal with bomb dropped down Movement (). Hamas () in a unit time per call to paint () method is constantly refresh the screen, paint () call Bomb.addBomb () to draw bomb. When pressed mouse game, mousePress () activation of the incident to determine whether the point of the bomb. If the
    2022-05-20 07:56:26下载
    积分:1
  • vb 自动关机
    vb 自动关机-vb automatic Guan Ji
    2022-05-25 21:29:04下载
    积分:1
  • 粘贴数据比复制更加复杂,因为你需要选择粘贴的格式。
    粘贴数据比复制更加复杂,因为你需要选择粘贴的格式。 ---- 1. 在你的视中,实现OnEditPaste来处理用户从编辑菜单选择粘贴命令的操作。 ---- 2. 在OnEditPaste函数中,建立一个COleDataObject对象并且访问它的AttachClipboard成员函数来将这个对象绑定到剪贴板。 ---- 3. 访问COleDataObject::IsDataAvailable函数来检查是否可以使用特殊的格式。当然,你也可以通过循环使用COleDataObject::BeginEnumFormats来寻找其它格式直到你找到了最适合的格式。 ---- 4. 粘贴数据。 -paste data replication more complicated than that because you need to choose paste format.---- 1. Depending on your, and realize OnEditPaste to users from the edit menu select paste ordered the operation.---- 2. In OnEditPaste function, the establishment of a visit COleDataObject object and its function AttachClipboard members will be bundled with the object to the clipboard.---- 3. Visit COleDataObject : : IsDataAvailable function can be used to check whether a special format. Of course, you can also cycle through the use of COleDataObject : : BeginEnumFormats to find other formats until you find the most suitable format.---- 4. Pasting data.
    2023-04-03 21:55:03下载
    积分:1
  • 滚动字幕 一个不错的例子 实现的功能就是滚动的字幕啦
    滚动字幕 一个不错的例子 实现的功能就是滚动的字幕啦-Scroll subtitles a good example of the function is to achieve rolling subtitles啦
    2022-05-24 02:00:58下载
    积分:1
  • Findnode
    用VB/C#查找图TreeView上的节点-Findnode
    2023-07-28 15:45:03下载
    积分:1
  • Exam1 iCarnegie
    埃斯特·埃斯·艾尔·奎兹(este es el quizz practico numero 1 de icarnegie)
    2022-01-28 22:49:28下载
    积分:1
  • C#中禁止使用Windows任务栏
    C#中禁止使用Windows任务栏完整代码,测试通过,欢迎大家下载学习,可以参考学习使用,对初学者有一定的帮助。 C#中禁止使用Windows任务栏完整代码,测试通过,欢迎大家下载学习,可以参考学习使用,对初学者有一定的帮助。
    2022-02-25 16:55:25下载
    积分:1
  • 一个挂钩鼠标,模拟鼠标移动HHOOK的原代码,希望对朋友们有用,
    一个挂钩鼠标,模拟鼠标移动HHOOK的原代码,希望对朋友们有用,-It is a mouse hook program, simulating a mouse moving. Hope it helpful.
    2022-10-29 13:20:03下载
    积分:1
  • 凌阳自动语音播放的源代码,只需要适当的硬件设备(凌阳61a开发版,下载线,开发软件,电源,pc机)就可以实现下载。...
    凌阳自动语音播放的源代码,只需要适当的硬件设备(凌阳61a开发版,下载线,开发软件,电源,pc机)就可以实现下载。-Sunplus automatic voice broadcast by the source code, only need the appropriate hardware device (61a Sunplus Developer Edition, download lines, development of software, power supply, pc machine) can be achieved download.
    2023-06-29 19:40:06下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载