设计框图:

部分代码

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;entity move isPort ( fire,reset,start : in std_logic;         --子弹、复位、开始按键key_l:in std_logic;                   --左移key_r:in std_logic;                   --右移plane_x:out integer;                  --我方飞机的x坐标plane_y:out integer;                  --我方飞机的y坐标enemy_x:out integer;                  --敌方飞机1的x坐标enemy_y:out integer;                  --敌方飞机1的y坐标enemy_x2:out integer;                 --敌方飞机2的x坐标enemy_y2:out integer;                 --敌方飞机2的y坐标bullet_x:out integer;                 --子弹的x坐标bullet_y:out integer;                 --子弹的y坐标score:out integer;                    --分数life_bullet:out integer;              --子弹的生命life_plane:out integer;               --飞机的生命movclk:in std_logic);                 --移动的频率,为10HZ,可以更改div1文件的cout的加数以更改移动的快慢end move;architecture Behavioral of move is---------------------------------------------------------------------------------------------------------------
CONSTANT BOARD_LEN : INTEGER :=100;--THIE IS THE  LENGTH OF BOARDCONSTANT BOARD_X0:INTEGER :=320;--显示器的显示范围
CONSTANT BOARD_Y0:INTEGER :=400;
CONSTANT enemy_X0:INTEGER :=320;--敌机的初始位置
CONSTANT enemy_Y0:INTEGER :=40;
CONSTANT enemy2_X0:INTEGER :=100;
CONSTANT enemy2_Y0:INTEGER :=40;---------------------------------------------------------------------------------------------------------------
signal enemy_x_tmp,enemy_y_tmp,enemy_x_tmp2,enemy_y_tmp2:integer range 0 to 1000;signal plane_x_tmp,plane_y_tmp:integer range 0 to 1000;
signal bullet_x_tmp,bullet_y_tmp:integer range 0 to 1000;
signal dx_e,dx_e2,dy_e,dy_e2:integer range -7 to 7;---------------------------------------------------------------------------------------------------------------
signal score_tmp:integer range 0 to 15:=0;
signal life_plane_tmp,life_bullet_tmp:integer range 0 to 1;---------------------------------------------------------------------------------------------------------------begin
-----------------------------------------------------------------------
---控制我方飞机、敌方飞机、子弹的移动
-----------------------------------------------------------------------
move: process (movclk,reset,start,life_plane_tmp,life_bullet_tmp)
beginif reset='0' thenplane_x_tmp <= BOARD_X0;plane_y_tmp <= BOARD_Y0;enemy_x_tmp <= enemy_X0;enemy_y_tmp <= enemy_Y0;enemy_x_tmp2 <=enemy2_X0;enemy_y_tmp2 <=enemy2_Y0;dx_e<=2;dy_e<=3;dx_e2<=3;dy_e2<=2;life_bullet_tmp<=0;life_plane_tmp<=1;score_tmp<=0;elseif  start='1'   then     if (movclk'event and movclk='1') then
--------------------------------我方飞机的移动--------------------------------------plane move if key_l='1' and key_r='0' and plane_x_tmp>=BOARD_LEN  thenplane_x_tmp<=plane_x_tmp-2;elsif key_l='0' and key_r='1' and plane_x_tmp<=640-BOARD_LEN thenplane_x_tmp<=plane_x_tmp+2;end if;
----------------------------------敌方飞机1的移动------------------------------------enemy moveif life_plane_tmp/=0 thenif enemy_x_tmp>640-BOARD_LEN thendx_e<=-2-score_tmp;end if;if enemy_x_tmp<BOARD_LEN thendx_e<=1+score_tmp;end if;if enemy_y_tmp>400 thendy_e<=-1-score_tmp;end if;if enemy_y_tmp<30 thendy_e<=2+score_tmp;end if;enemy_x_tmp<=enemy_x_tmp+dx_e;enemy_y_tmp<=enemy_y_tmp+dy_e;------------------------------------敌方飞机2的移动----------------------------------enemy2if enemy_x_tmp2>640-BOARD_LEN thendx_e2<=-3-score_tmp;end if;if enemy_x_tmp2<BOARD_LEN thendx_e2<=2+score_tmp;end if;if enemy_y_tmp2>400 thendy_e2<=-2-score_tmp;end if;if enemy_y_tmp2<30 thendy_e2<=1+score_tmp;end if;enemy_x_tmp2<=enemy_x_tmp2+dx_e2;enemy_y_tmp2<=enemy_y_tmp2+dy_e2;----------------------------------子弹的移动------------------------------------bullet moveif fire='1' thenbullet_x_tmp <= plane_x_tmp+8;bullet_y_tmp <= plane_y_tmp;life_bullet_tmp<=1;elsebullet_y_tmp<=bullet_y_tmp-6;end if;end if;
---------------------判断我方飞机和敌方飞机三架,哪一架被摧毁----------------death judgeif bullet_x_tmp>=(enemy_x_tmp-16) and bullet_x_tmp<=(enemy_x_tmp+32) and bullet_y_tmp>=(enemy_y_tmp-16) and bullet_y_tmp<=(enemy_y_tmp+32) thenlife_bullet_tmp<=life_bullet_tmp-1;enemy_x_tmp<=enemy_X0;enemy_y_tmp<=enemy_Y0;score_tmp<=score_tmp+1;end if;if bullet_x_tmp>=(enemy_x_tmp2-16) and bullet_x_tmp<=(enemy_x_tmp2+32) and bullet_y_tmp>=(enemy_y_tmp2-16) and bullet_y_tmp<=(enemy_y_tmp2+32) thenlife_bullet_tmp<=life_bullet_tmp-1;enemy_x_tmp2<=enemy2_X0;enemy_y_tmp2<=enemy2_Y0;score_tmp<=score_tmp+1;end if;if (plane_x_tmp>=(enemy_x_tmp-32) and plane_x_tmp<=(enemy_x_tmp+32) and plane_y_tmp>=(enemy_y_tmp-32) and plane_y_tmp<=(enemy_y_tmp+32)) or (plane_x_tmp>=(enemy_x_tmp2-32) and plane_x_tmp<=(enemy_x_tmp2+32) and plane_y_tmp>=(enemy_y_tmp2-32) and plane_y_tmp<=(enemy_y_tmp2+32))thenlife_plane_tmp<=life_plane_tmp-1;end if;end if;end if;end if;
end process;-----------------------------------------------------------------life contral
score<=score_tmp;               --把分数发送到picture模块
life_bullet<=life_bullet_tmp;   --把子弹的生命发送到picture模块
life_plane<=life_plane_tmp;     --把我方飞机的生命发送到picture模块
plane_x<=plane_x_tmp;           --把我方飞机的x坐标发送到picture模块
plane_y<=plane_y_tmp;           --把我方飞机的y坐标发送到picture模块
enemy_x<=enemy_x_tmp;           --把敌方飞机1的x坐标发送到picture模块
enemy_y<=enemy_y_tmp;           --把敌方飞机1的y坐标发送到picture模块
enemy_x2<=enemy_x_tmp2;         --把敌方飞机2的x坐标发送到picture模块
enemy_y2<=enemy_y_tmp2;         --把敌方飞机2的y坐标发送到picture模块
bullet_x<=bullet_x_tmp;         --把子弹的x坐标发送到picture模块
bullet_y<=bullet_y_tmp;         --把子弹的y坐标发送到picture模块end Behavioral;

.
链接:https://pan.baidu.com/s/1MUk9CmkPWY-coTasji_inw
提取码:1234

基于FPGA的飞机小游戏设计vhdl相关推荐

  1. 基于c语言的小游戏,--基于C语言的小游戏设计.doc

    --基于C语言的小游戏设计.doc 级丌 密公 本科生毕业(学位)论文 基于c语言的爪游软设计 李俊佶 (2009061322) TOC \o "1-5" \h \z 指导教师姓名 ...

  2. 【Verilog】基于FPGA的五子棋小游戏(VGA显示、双人对战、胜负判别、附完整代码)

    基于FPGA的五子棋小游戏 有一些说明: 1.本文是基于VGA的显示小游戏,主要为VGA显示的拓展应用: 2.为适应不同显示屏的分辨率,棋盘确定为10X10的黑线白底的方格: 3.下棋主要用棋格颜色变 ...

  3. 基于python的飞机大战游戏设计与实现

    基于python的飞机大战游戏设计与实现,采用MySQL+pygame+Tkinter实现飞机大战游戏,主要功能有注册+登录+游戏初始化(开始游戏+游戏操作说明+版权信息)+游戏主界面[设置敌机种类并 ...

  4. imut FPGA课设 基于FPGA的VGA弹球游戏设计 *秋昊

    写在前面的话: 本文主要呈现了一篇IMUT的FPGA课设报告. 课设报告内容(word版),视频演示,程序源码,专业创新实践简介,专业创新实践指导书均已放入下面的百度云链接中,也不大,总共不到20MB ...

  5. 基于 FPGA 的飞机大战游戏系统设计

    第一部分 设计概述 1.1 设计目的 我们设计了一款基于 FPGA 的SEA开发板 的飞机大战游戏.飞机大战游戏是一款休闲益智类游戏,既简单又耐玩.在初始界面,我们有开始游戏.重新开始.皮肤选择和结束 ...

  6. 基于java的俄罗斯方块小游戏设计(含源文件)

    欢迎添加微信互相交流学习哦! 项目源码:https://gitee.com/oklongmm/biye 题 目          小游戏开发 摘    要     俄罗斯方块是我们最常见的游戏之一,该 ...

  7. python飞机大战功能模块图_基于Python的飞机大战游戏设计

    第 2 3 卷 第 1 期 2019年 3 月 扬 州 职 业 大 学 学 报 Journal of Yangzhou Polytechnic College Vol .23 No . 1 Mar . ...

  8. 基于Qt的飞机小游戏实现

    目录 前言 一.准备工作 二.基本功能实现 1.主菜单 2.核心玩法 3.其他 资源文件 前言 这是学习Qt时期做的一个小项目,现在看感觉有很多可优化的地方,放在这里给新人朋友们提供一个参考. 一.准 ...

  9. 基于FPGA的贪吃蛇游戏设计(1)整体架构设计

    软件环境:Quartus II 13.1 & Modelsim Starter Edition 13.1 & notepad++ & TimeGen 3.1 & Ima ...

最新文章

  1. oracle日期处理(一)
  2. 电气:电能扰动质量数据集模拟生成(matlab)
  3. boost::python::detail::result相关的测试程序
  4. leetcode53. 最大子数组和(动态规划)
  5. mysql分区表优缺点,Mysql 表分区和性能
  6. ASP.NET File.Delete只读文件引起的访问被拒绝,设置文件属性为Normal
  7. Java日志组件间关系
  8. 审计人员需要哪些计算机知识,审计人员应具备的知识与技能
  9. JS === 实现多个光标跟随事件
  10. DedeCMS顽固木马后门专杀工具
  11. unity3D -- 压缩图片
  12. 总结 Underlay 和 Overlay 网络,在k8s集群实现underlay网络,网络组件flannel vxlan/ calico IPIP模式的网络通信流程,基于二进制实现高可用的K8S集群
  13. GIS地图学习笔记一之基础概念
  14. iOS限制输入表情(emoji)
  15. 单元测试实践篇:Mock
  16. ExecutorService的submit()方法
  17. C语言新建文件写入数据
  18. android中的progressbar,ProgressBar使用详解
  19. 2023款联想小新 Pro 14 锐龙版和独显版的区别
  20. 数据库关系表 ---- Relational table

热门文章

  1. 各IasS/PasS测试工具汇总
  2. 社会心理学,第13章 冲突,14章 临床
  3. [附源码]SSM计算机毕业设计农产品网络销售系统JAVA
  4. 安全研发人员能力模型窥探
  5. 单片机的字节寻址c语言,单片机C语言通用万能编程模板
  6. 探究网上的一个用MATLAB写的SIFT
  7. 苹果自带跳语音服务器,iOS自带文本转语音技术(TTS)的实现即语音播报的实践
  8. 无线路由器中WMM/Short GI/AP隔离各是什么功能, 开启时PC无法ping通手机.
  9. 如何用手机访问自己电脑?
  10. 实时多人脸检测和识别